mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
More fixes to app bar when switching controllers
This commit is contained in:
parent
fc4bb9c36f
commit
861e0c3ba8
1 changed files with 9 additions and 6 deletions
|
@ -379,9 +379,11 @@ fun Controller.scrollViewWith(
|
|||
colorToolbar(!atTopOfRecyclerView())
|
||||
|
||||
recycler.post {
|
||||
if (isControllerVisible) {
|
||||
activityBinding!!.appBar.updateAppBarAfterY(recycler)
|
||||
colorToolbar(!atTopOfRecyclerView())
|
||||
}
|
||||
}
|
||||
recycler.addOnScrollListener(
|
||||
object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
|
@ -455,8 +457,7 @@ fun Controller.scrollViewWith(
|
|||
if (newState == RecyclerView.SCROLL_STATE_IDLE &&
|
||||
(this@scrollViewWith as? BaseController<*>)?.isDragging != true
|
||||
) {
|
||||
if (router?.backstack?.lastOrNull()
|
||||
?.controller == this@scrollViewWith && statusBarHeight > -1 &&
|
||||
if (isControllerVisible && statusBarHeight > -1 &&
|
||||
activity != null && activityBinding!!.appBar.height > 0 &&
|
||||
recycler.translationY == 0f
|
||||
) {
|
||||
|
@ -512,7 +513,7 @@ fun Controller.setItemAnimatorForAppBar(recycler: RecyclerView) {
|
|||
var itemAppBarAnimator: Animator? = null
|
||||
|
||||
fun animateAppBar() {
|
||||
if (this !is SmallToolbarInterface) {
|
||||
if (this !is SmallToolbarInterface && isControllerVisible) {
|
||||
itemAppBarAnimator?.cancel()
|
||||
val duration = (recycler.itemAnimator?.changeDuration ?: 250) * 2
|
||||
itemAppBarAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
|
||||
|
@ -538,7 +539,9 @@ fun Controller.setItemAnimatorForAppBar(recycler: RecyclerView) {
|
|||
}
|
||||
|
||||
override fun onAnimationFinished(viewHolder: RecyclerView.ViewHolder) {
|
||||
if (isControllerVisible) {
|
||||
activityBinding?.appBar?.updateAppBarAfterY(recycler)
|
||||
}
|
||||
super.onAnimationFinished(viewHolder)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue