mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
chore: remove alternative videos layout option
This commit is contained in:
parent
bf07874ef9
commit
5cb0e7b76c
@ -28,7 +28,6 @@ object PreferenceKeys {
|
|||||||
const val APP_ICON = "icon_change"
|
const val APP_ICON = "icon_change"
|
||||||
const val LEGACY_SUBSCRIPTIONS = "legacy_subscriptions"
|
const val LEGACY_SUBSCRIPTIONS = "legacy_subscriptions"
|
||||||
const val LEGACY_SUBSCRIPTIONS_COLUMNS = "legacy_subscriptions_columns"
|
const val LEGACY_SUBSCRIPTIONS_COLUMNS = "legacy_subscriptions_columns"
|
||||||
const val ALTERNATIVE_VIDEOS_LAYOUT = "alternative_videos_layout"
|
|
||||||
const val NEW_VIDEOS_BADGE = "new_videos_badge"
|
const val NEW_VIDEOS_BADGE = "new_videos_badge"
|
||||||
const val PLAYLISTS_ORDER = "playlists_order"
|
const val PLAYLISTS_ORDER = "playlists_order"
|
||||||
const val PLAYLIST_SORT_ORDER = "playlist_sort_order"
|
const val PLAYLIST_SORT_ORDER = "playlist_sort_order"
|
||||||
|
@ -81,11 +81,6 @@ class VideosAdapter(
|
|||||||
VideoRowBinding.inflate(layoutInflater, parent, false)
|
VideoRowBinding.inflate(layoutInflater, parent, false)
|
||||||
)
|
)
|
||||||
|
|
||||||
PreferenceHelper.getBoolean(
|
|
||||||
PreferenceKeys.ALTERNATIVE_VIDEOS_LAYOUT,
|
|
||||||
false
|
|
||||||
) -> VideosViewHolder(VideoRowBinding.inflate(layoutInflater, parent, false))
|
|
||||||
|
|
||||||
else -> VideosViewHolder(TrendingRowBinding.inflate(layoutInflater, parent, false))
|
else -> VideosViewHolder(TrendingRowBinding.inflate(layoutInflater, parent, false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,18 +190,6 @@ class VideosAdapter(
|
|||||||
RELATED_COLUMN
|
RELATED_COLUMN
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLayout(context: Context, gridItems: Int): LayoutManager {
|
|
||||||
return if (PreferenceHelper.getBoolean(
|
|
||||||
PreferenceKeys.ALTERNATIVE_VIDEOS_LAYOUT,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
GridLayoutManager(context, gridItems.ceilHalf())
|
|
||||||
} else {
|
|
||||||
GridLayoutManager(context, gridItems)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private const val NORMAL_TYPE = 0
|
private const val NORMAL_TYPE = 0
|
||||||
private const val CAUGHT_UP_TYPE = 1
|
private const val CAUGHT_UP_TYPE = 1
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ import com.github.libretube.helpers.ImageHelper
|
|||||||
import com.github.libretube.helpers.NavigationHelper
|
import com.github.libretube.helpers.NavigationHelper
|
||||||
import com.github.libretube.obj.ShareData
|
import com.github.libretube.obj.ShareData
|
||||||
import com.github.libretube.ui.adapters.VideosAdapter
|
import com.github.libretube.ui.adapters.VideosAdapter
|
||||||
import com.github.libretube.ui.base.DynamicLayoutManagerFragment
|
|
||||||
import com.github.libretube.ui.dialogs.ShareDialog
|
import com.github.libretube.ui.dialogs.ShareDialog
|
||||||
import com.github.libretube.ui.extensions.setupFragmentAnimation
|
import com.github.libretube.ui.extensions.setupFragmentAnimation
|
||||||
import com.github.libretube.ui.extensions.setupSubscriptionButton
|
import com.github.libretube.ui.extensions.setupSubscriptionButton
|
||||||
@ -40,7 +39,7 @@ import kotlinx.coroutines.withContext
|
|||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
class ChannelFragment : DynamicLayoutManagerFragment(R.layout.fragment_channel) {
|
class ChannelFragment : Fragment(R.layout.fragment_channel) {
|
||||||
private var _binding: FragmentChannelBinding? = null
|
private var _binding: FragmentChannelBinding? = null
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
private val args by navArgs<ChannelFragmentArgs>()
|
private val args by navArgs<ChannelFragmentArgs>()
|
||||||
@ -72,8 +71,6 @@ class ChannelFragment : DynamicLayoutManagerFragment(R.layout.fragment_channel)
|
|||||||
channelId = args.channelId
|
channelId = args.channelId
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setLayoutManagers(gridItems: Int) {}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
_binding = FragmentChannelBinding.bind(view)
|
_binding = FragmentChannelBinding.bind(view)
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
@ -87,7 +87,7 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
|
|||||||
private val channelsAdapter = SubscriptionChannelAdapter()
|
private val channelsAdapter = SubscriptionChannelAdapter()
|
||||||
|
|
||||||
override fun setLayoutManagers(gridItems: Int) {
|
override fun setLayoutManagers(gridItems: Int) {
|
||||||
_binding?.subFeed?.layoutManager = VideosAdapter.getLayout(requireContext(), gridItems)
|
_binding?.subFeed?.layoutManager = GridLayoutManager(context, gridItems)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@ -109,7 +109,7 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
|
|||||||
context,
|
context,
|
||||||
PreferenceHelper.getString(
|
PreferenceHelper.getString(
|
||||||
PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS,
|
PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS,
|
||||||
"4"
|
"3"
|
||||||
).toInt()
|
).toInt()
|
||||||
)
|
)
|
||||||
binding.subChannels.adapter = legacySubscriptionsAdapter
|
binding.subChannels.adapter = legacySubscriptionsAdapter
|
||||||
|
@ -6,6 +6,7 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.databinding.FragmentTrendsBinding
|
import com.github.libretube.databinding.FragmentTrendsBinding
|
||||||
@ -23,7 +24,7 @@ class TrendsFragment : DynamicLayoutManagerFragment(R.layout.fragment_trends) {
|
|||||||
private val viewModel: TrendsViewModel by activityViewModels()
|
private val viewModel: TrendsViewModel by activityViewModels()
|
||||||
|
|
||||||
override fun setLayoutManagers(gridItems: Int) {
|
override fun setLayoutManagers(gridItems: Int) {
|
||||||
_binding?.recview?.layoutManager = VideosAdapter.getLayout(requireContext(), gridItems)
|
_binding?.recview?.layoutManager = GridLayoutManager(context, gridItems)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
@ -62,16 +62,6 @@ class AppearanceSettings : BasePreferenceFragment() {
|
|||||||
NavBarOptionsDialog().show(childFragmentManager, null)
|
NavBarOptionsDialog().show(childFragmentManager, null)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
val legacySubscriptionView =
|
|
||||||
findPreference<SwitchPreferenceCompat>(PreferenceKeys.LEGACY_SUBSCRIPTIONS)
|
|
||||||
val legacySubscriptionColumns =
|
|
||||||
findPreference<ListPreference>(PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS)
|
|
||||||
legacySubscriptionColumns?.isVisible = legacySubscriptionView?.isChecked!!
|
|
||||||
legacySubscriptionView.setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
legacySubscriptionColumns?.isVisible = newValue as Boolean
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,27 +64,6 @@
|
|||||||
android:title="@string/home_tab_content"
|
android:title="@string/home_tab_content"
|
||||||
app:defaultValue="@array/homeTabItemsValues" />
|
app:defaultValue="@array/homeTabItemsValues" />
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
|
||||||
app:defaultValue="false"
|
|
||||||
app:icon="@drawable/ic_list"
|
|
||||||
app:key="legacy_subscriptions"
|
|
||||||
app:title="@string/legacy_subscriptions" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:entries="@array/grid"
|
|
||||||
android:entryValues="@array/grid"
|
|
||||||
app:defaultValue="3"
|
|
||||||
app:icon="@drawable/ic_grid"
|
|
||||||
app:isPreferenceVisible="false"
|
|
||||||
app:key="legacy_subscriptions_columns"
|
|
||||||
app:title="@string/grid" />
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
|
||||||
android:icon="@drawable/ic_trending"
|
|
||||||
app:defaultValue="false"
|
|
||||||
app:key="alternative_videos_layout"
|
|
||||||
app:title="@string/alternative_videos_layout" />
|
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:icon="@drawable/ic_grid"
|
android:icon="@drawable/ic_grid"
|
||||||
app:defaultValue="@integer/grid_items"
|
app:defaultValue="@integer/grid_items"
|
||||||
@ -105,4 +84,24 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
app:title="@string/legacy_subscriptions">
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:icon="@drawable/ic_list"
|
||||||
|
app:key="legacy_subscriptions"
|
||||||
|
app:title="@string/legacy_subscriptions" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:entries="@array/grid"
|
||||||
|
android:entryValues="@array/grid"
|
||||||
|
app:defaultValue="3"
|
||||||
|
app:icon="@drawable/ic_grid"
|
||||||
|
app:dependency="legacy_subscriptions"
|
||||||
|
app:key="legacy_subscriptions_columns"
|
||||||
|
app:title="@string/grid" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
x
Reference in New Issue
Block a user