Fix incorrect appbar lift state when opening MangaController in hidden state (#5990)
This commit is contained in:
parent
7ed25704d6
commit
09f0ac866f
@ -77,6 +77,10 @@ class HideToolbarOnScrollBehavior : AppBarLayout.Behavior() {
|
|||||||
child: AppBarLayout,
|
child: AppBarLayout,
|
||||||
isVisible: Boolean
|
isVisible: Boolean
|
||||||
) {
|
) {
|
||||||
|
val current = getTopBottomOffsetForScrollingSibling(child)
|
||||||
|
val target = if (isVisible) 0 else -toolbarHeight
|
||||||
|
if (current == target) return
|
||||||
|
|
||||||
offsetAnimator?.cancel()
|
offsetAnimator?.cancel()
|
||||||
offsetAnimator = ValueAnimator().apply {
|
offsetAnimator = ValueAnimator().apply {
|
||||||
interpolator = DecelerateInterpolator()
|
interpolator = DecelerateInterpolator()
|
||||||
@ -85,18 +89,12 @@ class HideToolbarOnScrollBehavior : AppBarLayout.Behavior() {
|
|||||||
setHeaderTopBottomOffset(coordinatorLayout, child, it.animatedValue as Int)
|
setHeaderTopBottomOffset(coordinatorLayout, child, it.animatedValue as Int)
|
||||||
}
|
}
|
||||||
doOnEnd {
|
doOnEnd {
|
||||||
if (!isVisible &&
|
if ((child as? ElevationAppBarLayout)?.isTransparentWhenNotLifted == true) {
|
||||||
!child.isLifted &&
|
child.isLifted = !isVisible
|
||||||
(child as? ElevationAppBarLayout)?.isTransparentWhenNotLifted == true
|
|
||||||
) {
|
|
||||||
child.isLifted = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setIntValues(current, target)
|
||||||
|
start()
|
||||||
}
|
}
|
||||||
offsetAnimator?.setIntValues(
|
|
||||||
getTopBottomOffsetForScrollingSibling(child),
|
|
||||||
if (isVisible) 0 else -toolbarHeight
|
|
||||||
)
|
|
||||||
offsetAnimator?.start()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user