diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/MainScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/MainScreen.kt index f2e2b9662..df6cec710 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/MainScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/MainScreen.kt @@ -239,18 +239,26 @@ fun MainScreen( val newOffset = bottomBarOffsetHeightPx.value + available.y if (accountViewModel.account.settings.automaticallyHideNavigationBars == BooleanType.ALWAYS) { - bottomBarOffsetHeightPx.value = if (navState.value?.destination?.route !in InvertedLayouts) { + val newBottomBarOffset = if (navState.value?.destination?.route !in InvertedLayouts) { newOffset.coerceIn(-bottomBarHeightPx, 0f) } else { newOffset.coerceIn(0f, bottomBarHeightPx) } + + if (newBottomBarOffset != bottomBarOffsetHeightPx.value) { + bottomBarOffsetHeightPx.value = newBottomBarOffset + } } else { if (abs(bottomBarOffsetHeightPx.value) > 0.1) { bottomBarOffsetHeightPx.value = 0f } } - shouldShow.value = abs(bottomBarOffsetHeightPx.value) < bottomBarHeightPx / 2.0f + val newShouldShow = abs(bottomBarOffsetHeightPx.value) < bottomBarHeightPx / 2.0f + + if (shouldShow.value != newShouldShow) { + shouldShow.value = newShouldShow + } return Offset.Zero }