Skip to content

Commit

Permalink
Fix wrong timing in assignation of headerColorState
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Feb 2, 2024
1 parent 91e9dd6 commit 8f9b63a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/infomaniak/mail/utils/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,11 @@ fun Fragment.changeToolbarColorOnScroll(
val isAtTheTop = view.isAtTheTop()
if (!isAtTheTop && headerColorState == HeaderState.ELEVATED) return@setOnScrollChangeListener

headerColorState = if (isAtTheTop) HeaderState.LOWERED else HeaderState.ELEVATED

val newColor = view.context.getColor(if (isAtTheTop) loweredColor else elevatedColor)
if (newColor == oldColor) return@setOnScrollChangeListener

headerColorState = if (isAtTheTop) HeaderState.LOWERED else HeaderState.ELEVATED

valueAnimator?.cancel()
valueAnimator = UiUtils.animateColorChange(oldColor, newColor, animate = true) { color ->
oldColor = color
Expand Down

0 comments on commit 8f9b63a

Please sign in to comment.