mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
fix: poor subscriptions filter options menu performance
This commit is contained in:
parent
4736271c81
commit
02ae08a709
@ -40,9 +40,10 @@ class FilterSortBottomSheet : ExpandedBottomSheet() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
addSortOptions()
|
addSortOptions()
|
||||||
|
setInitialFiltersState()
|
||||||
|
|
||||||
observeSortChanges()
|
observeSortChanges()
|
||||||
observeHideWatchedChanges()
|
observeHideWatchedChanges()
|
||||||
setInitialFiltersState()
|
|
||||||
observeFiltersChanges()
|
observeFiltersChanges()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +67,13 @@ class FilterSortBottomSheet : ExpandedBottomSheet() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setInitialFiltersState() {
|
||||||
|
binding.filterVideos.isChecked = ContentFilter.VIDEOS.isEnabled
|
||||||
|
binding.filterShorts.isChecked = ContentFilter.SHORTS.isEnabled
|
||||||
|
binding.filterLivestreams.isChecked = ContentFilter.LIVESTREAMS.isEnabled
|
||||||
|
binding.hideWatchedCheckbox.isChecked = hideWatched
|
||||||
|
}
|
||||||
|
|
||||||
private fun observeSortChanges() {
|
private fun observeSortChanges() {
|
||||||
binding.sortRadioGroup.setOnCheckedChangeListener { group, checkedId ->
|
binding.sortRadioGroup.setOnCheckedChangeListener { group, checkedId ->
|
||||||
val index = group.findViewById<RadioButton>(checkedId).tag as Int
|
val index = group.findViewById<RadioButton>(checkedId).tag as Int
|
||||||
@ -81,13 +89,6 @@ class FilterSortBottomSheet : ExpandedBottomSheet() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setInitialFiltersState() {
|
|
||||||
binding.filterVideos.isChecked = ContentFilter.VIDEOS.isEnabled
|
|
||||||
binding.filterShorts.isChecked = ContentFilter.SHORTS.isEnabled
|
|
||||||
binding.filterLivestreams.isChecked = ContentFilter.LIVESTREAMS.isEnabled
|
|
||||||
binding.hideWatchedCheckbox.isChecked = hideWatched
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun observeFiltersChanges() {
|
private fun observeFiltersChanges() {
|
||||||
binding.filters.setOnCheckedStateChangeListener { _, _ ->
|
binding.filters.setOnCheckedStateChangeListener { _, _ ->
|
||||||
ContentFilter.VIDEOS.isEnabled = binding.filterVideos.isChecked
|
ContentFilter.VIDEOS.isEnabled = binding.filterVideos.isChecked
|
||||||
|
Loading…
Reference in New Issue
Block a user