Skip to content

Commit 3f3f321

Browse files
Fix wrong timing in assignation of headerColorState
1 parent bfafd77 commit 3f3f321

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/com/infomaniak/mail/utils/Extensions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,11 @@ fun Fragment.changeToolbarColorOnScroll(
467467
val isAtTheTop = view.isAtTheTop()
468468
if (!isAtTheTop && headerColorState == HeaderState.ELEVATED) return@setOnScrollChangeListener
469469

470+
headerColorState = if (isAtTheTop) HeaderState.LOWERED else HeaderState.ELEVATED
471+
470472
val newColor = view.context.getColor(if (isAtTheTop) loweredColor else elevatedColor)
471473
if (newColor == oldColor) return@setOnScrollChangeListener
472474

473-
headerColorState = if (isAtTheTop) HeaderState.LOWERED else HeaderState.ELEVATED
474-
475475
valueAnimator?.cancel()
476476
valueAnimator = UiUtils.animateColorChange(oldColor, newColor, animate = true) { color ->
477477
oldColor = color

0 commit comments

Comments
 (0)