mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-11 21:39:10 +01:00
Filters sheet can be hidden while active now
This commit is contained in:
parent
54a0c3fded
commit
44bb8de84f
@ -151,10 +151,10 @@ class LibraryController(
|
|||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
super.onScrolled(recyclerView, dx, dy)
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
val order = getCategoryOrder()
|
val order = getCategoryOrder()
|
||||||
if (filter_bottom_sheet.canHide()) {
|
if (filter_bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_HIDDEN) {
|
||||||
scrollDistance += abs(dy)
|
scrollDistance += abs(dy)
|
||||||
if (scrollDistance > scrollDistanceTilHidden) {
|
if (scrollDistance > scrollDistanceTilHidden) {
|
||||||
filter_bottom_sheet.hideIfPossible()
|
filter_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
|
||||||
scrollDistance = 0f
|
scrollDistance = 0f
|
||||||
}
|
}
|
||||||
} else scrollDistance = 0f
|
} else scrollDistance = 0f
|
||||||
|
@ -103,7 +103,6 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
|||||||
}
|
}
|
||||||
|
|
||||||
val activeFilters = hasActiveFiltersFromPref()
|
val activeFilters = hasActiveFiltersFromPref()
|
||||||
sheetBehavior?.isHideable = !activeFilters
|
|
||||||
if (activeFilters && sheetBehavior?.state == BottomSheetBehavior.STATE_HIDDEN &&
|
if (activeFilters && sheetBehavior?.state == BottomSheetBehavior.STATE_HIDDEN &&
|
||||||
sheetBehavior?.skipCollapsed == false)
|
sheetBehavior?.skipCollapsed == false)
|
||||||
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||||
@ -285,21 +284,12 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
|||||||
filterItems.remove(trackers!!)
|
filterItems.remove(trackers!!)
|
||||||
}
|
}
|
||||||
val hasFilters = hasActiveFilters()
|
val hasFilters = hasActiveFilters()
|
||||||
sheetBehavior?.isHideable = !hasFilters
|
|
||||||
if (hasFilters && clearButton.parent == null)
|
if (hasFilters && clearButton.parent == null)
|
||||||
filter_layout.addView(clearButton, 0)
|
filter_layout.addView(clearButton, 0)
|
||||||
else if (!hasFilters && clearButton.parent != null)
|
else if (!hasFilters && clearButton.parent != null)
|
||||||
filter_layout.removeView(clearButton)
|
filter_layout.removeView(clearButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hideIfPossible() {
|
|
||||||
if (!hasActiveFilters() && sheetBehavior?.isHideable == true)
|
|
||||||
sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
|
|
||||||
}
|
|
||||||
|
|
||||||
fun canHide(): Boolean = sheetBehavior?.isHideable == true && sheetBehavior?.state !=
|
|
||||||
BottomSheetBehavior.STATE_HIDDEN
|
|
||||||
|
|
||||||
private fun clearFilters() {
|
private fun clearFilters() {
|
||||||
preferences.filterDownloaded().set(0)
|
preferences.filterDownloaded().set(0)
|
||||||
preferences.filterUnread().set(0)
|
preferences.filterUnread().set(0)
|
||||||
@ -318,7 +308,6 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
|||||||
filterItems.remove(trackers!!)
|
filterItems.remove(trackers!!)
|
||||||
reSortViews()
|
reSortViews()
|
||||||
onGroupClicked(ACTION_FILTER)
|
onGroupClicked(ACTION_FILTER)
|
||||||
sheetBehavior?.isHideable = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun reSortViews() {
|
private fun reSortViews() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user