mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 01:35:09 +01:00
Category hopper now follows same snap distance as bottom nav
Also fixed hopper not scrolling away when bottom nav is locked
This commit is contained in:
parent
4df422d2e0
commit
84e7c33cb3
@ -222,6 +222,9 @@ class LibraryController(
|
|||||||
hopperOffset += dy
|
hopperOffset += dy
|
||||||
hopperOffset = hopperOffset.coerceIn(0f, 55f.dpToPx)
|
hopperOffset = hopperOffset.coerceIn(0f, 55f.dpToPx)
|
||||||
}
|
}
|
||||||
|
if (!preferences.hideBottomNavOnScroll().get()) {
|
||||||
|
updateFilterSheetY()
|
||||||
|
}
|
||||||
up_category.alpha = if (isAtTop()) 0.25f else 1f
|
up_category.alpha = if (isAtTop()) 0.25f else 1f
|
||||||
down_category.alpha = if (isAtBottom()) 0.25f else 1f
|
down_category.alpha = if (isAtBottom()) 0.25f else 1f
|
||||||
}
|
}
|
||||||
@ -291,12 +294,18 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateHopperPosition(show: Boolean = false) {
|
fun updateHopperPosition() {
|
||||||
val shortAnimationDuration = resources?.getInteger(
|
val shortAnimationDuration = resources?.getInteger(
|
||||||
android.R.integer.config_shortAnimTime
|
android.R.integer.config_shortAnimTime
|
||||||
) ?: 0
|
) ?: 0
|
||||||
if (preferences.autohideHopper().get()) {
|
if (preferences.autohideHopper().get()) {
|
||||||
val end = if (!show && hopperOffset > 25f.dpToPx) 55f.dpToPx else 0f
|
// Flow same snap rules as bottom nav
|
||||||
|
val closerToHopperBottom = hopperOffset > 25f.dpToPx
|
||||||
|
val halfWayBottom = activity!!.bottom_nav.height.toFloat() / 2
|
||||||
|
val closerToBottom = activity!!.bottom_nav.translationY > halfWayBottom
|
||||||
|
val atTop = !recycler.canScrollVertically(-1)
|
||||||
|
val closerToEdge = if (preferences.hideBottomNavOnScroll().get()) (closerToBottom && !atTop) else closerToHopperBottom
|
||||||
|
val end = if (closerToEdge) 55f.dpToPx else 0f
|
||||||
val alphaAnimation = ValueAnimator.ofFloat(hopperOffset, end)
|
val alphaAnimation = ValueAnimator.ofFloat(hopperOffset, end)
|
||||||
alphaAnimation.addUpdateListener { valueAnimator ->
|
alphaAnimation.addUpdateListener { valueAnimator ->
|
||||||
hopperOffset = valueAnimator.animatedValue as Float
|
hopperOffset = valueAnimator.animatedValue as Float
|
||||||
|
Loading…
Reference in New Issue
Block a user