Only changes shouldShow if the value is different.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user