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,8 +379,10 @@ fun Controller.scrollViewWith(
|
||||||
colorToolbar(!atTopOfRecyclerView())
|
colorToolbar(!atTopOfRecyclerView())
|
||||||
|
|
||||||
recycler.post {
|
recycler.post {
|
||||||
activityBinding!!.appBar.updateAppBarAfterY(recycler)
|
if (isControllerVisible) {
|
||||||
colorToolbar(!atTopOfRecyclerView())
|
activityBinding!!.appBar.updateAppBarAfterY(recycler)
|
||||||
|
colorToolbar(!atTopOfRecyclerView())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
recycler.addOnScrollListener(
|
recycler.addOnScrollListener(
|
||||||
object : RecyclerView.OnScrollListener() {
|
object : RecyclerView.OnScrollListener() {
|
||||||
|
@ -455,8 +457,7 @@ fun Controller.scrollViewWith(
|
||||||
if (newState == RecyclerView.SCROLL_STATE_IDLE &&
|
if (newState == RecyclerView.SCROLL_STATE_IDLE &&
|
||||||
(this@scrollViewWith as? BaseController<*>)?.isDragging != true
|
(this@scrollViewWith as? BaseController<*>)?.isDragging != true
|
||||||
) {
|
) {
|
||||||
if (router?.backstack?.lastOrNull()
|
if (isControllerVisible && statusBarHeight > -1 &&
|
||||||
?.controller == this@scrollViewWith && statusBarHeight > -1 &&
|
|
||||||
activity != null && activityBinding!!.appBar.height > 0 &&
|
activity != null && activityBinding!!.appBar.height > 0 &&
|
||||||
recycler.translationY == 0f
|
recycler.translationY == 0f
|
||||||
) {
|
) {
|
||||||
|
@ -512,7 +513,7 @@ fun Controller.setItemAnimatorForAppBar(recycler: RecyclerView) {
|
||||||
var itemAppBarAnimator: Animator? = null
|
var itemAppBarAnimator: Animator? = null
|
||||||
|
|
||||||
fun animateAppBar() {
|
fun animateAppBar() {
|
||||||
if (this !is SmallToolbarInterface) {
|
if (this !is SmallToolbarInterface && isControllerVisible) {
|
||||||
itemAppBarAnimator?.cancel()
|
itemAppBarAnimator?.cancel()
|
||||||
val duration = (recycler.itemAnimator?.changeDuration ?: 250) * 2
|
val duration = (recycler.itemAnimator?.changeDuration ?: 250) * 2
|
||||||
itemAppBarAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
|
itemAppBarAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
|
||||||
|
@ -538,7 +539,9 @@ fun Controller.setItemAnimatorForAppBar(recycler: RecyclerView) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAnimationFinished(viewHolder: RecyclerView.ViewHolder) {
|
override fun onAnimationFinished(viewHolder: RecyclerView.ViewHolder) {
|
||||||
activityBinding?.appBar?.updateAppBarAfterY(recycler)
|
if (isControllerVisible) {
|
||||||
|
activityBinding?.appBar?.updateAppBarAfterY(recycler)
|
||||||
|
}
|
||||||
super.onAnimationFinished(viewHolder)
|
super.onAnimationFinished(viewHolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue