mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-13 00:55:08 +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) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
val order = getCategoryOrder()
|
||||
if (filter_bottom_sheet.canHide()) {
|
||||
if (filter_bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_HIDDEN) {
|
||||
scrollDistance += abs(dy)
|
||||
if (scrollDistance > scrollDistanceTilHidden) {
|
||||
filter_bottom_sheet.hideIfPossible()
|
||||
filter_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
|
||||
scrollDistance = 0f
|
||||
}
|
||||
} else scrollDistance = 0f
|
||||
|
@ -103,7 +103,6 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
}
|
||||
|
||||
val activeFilters = hasActiveFiltersFromPref()
|
||||
sheetBehavior?.isHideable = !activeFilters
|
||||
if (activeFilters && sheetBehavior?.state == BottomSheetBehavior.STATE_HIDDEN &&
|
||||
sheetBehavior?.skipCollapsed == false)
|
||||
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
@ -285,21 +284,12 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
filterItems.remove(trackers!!)
|
||||
}
|
||||
val hasFilters = hasActiveFilters()
|
||||
sheetBehavior?.isHideable = !hasFilters
|
||||
if (hasFilters && clearButton.parent == null)
|
||||
filter_layout.addView(clearButton, 0)
|
||||
else if (!hasFilters && clearButton.parent != null)
|
||||
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() {
|
||||
preferences.filterDownloaded().set(0)
|
||||
preferences.filterUnread().set(0)
|
||||
@ -318,7 +308,6 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
filterItems.remove(trackers!!)
|
||||
reSortViews()
|
||||
onGroupClicked(ACTION_FILTER)
|
||||
sheetBehavior?.isHideable = true
|
||||
}
|
||||
|
||||
private fun reSortViews() {
|
||||
|
Loading…
Reference in New Issue
Block a user