Performance: uses primitive instead of the wrapped object.
This commit is contained in:
@@ -261,7 +261,7 @@ fun MainScreen(
|
|||||||
val nestedScrollConnection = remember {
|
val nestedScrollConnection = remember {
|
||||||
object : NestedScrollConnection {
|
object : NestedScrollConnection {
|
||||||
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
||||||
val newOffset = bottomBarOffsetHeightPx.value + available.y
|
val newOffset = bottomBarOffsetHeightPx.floatValue + available.y
|
||||||
|
|
||||||
if (accountViewModel.settings.automaticallyHideNavigationBars == BooleanType.ALWAYS) {
|
if (accountViewModel.settings.automaticallyHideNavigationBars == BooleanType.ALWAYS) {
|
||||||
val newBottomBarOffset = if (navState.value?.destination?.route !in InvertedLayouts) {
|
val newBottomBarOffset = if (navState.value?.destination?.route !in InvertedLayouts) {
|
||||||
@@ -270,16 +270,16 @@ fun MainScreen(
|
|||||||
newOffset.coerceIn(0f, bottomBarHeightPx)
|
newOffset.coerceIn(0f, bottomBarHeightPx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newBottomBarOffset != bottomBarOffsetHeightPx.value) {
|
if (newBottomBarOffset != bottomBarOffsetHeightPx.floatValue) {
|
||||||
bottomBarOffsetHeightPx.value = newBottomBarOffset
|
bottomBarOffsetHeightPx.floatValue = newBottomBarOffset
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (abs(bottomBarOffsetHeightPx.value) > 0.1) {
|
if (abs(bottomBarOffsetHeightPx.floatValue) > 0.1) {
|
||||||
bottomBarOffsetHeightPx.value = 0f
|
bottomBarOffsetHeightPx.floatValue = 0f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val newShouldShow = abs(bottomBarOffsetHeightPx.value) < bottomBarHeightPx / 2.0f
|
val newShouldShow = abs(bottomBarOffsetHeightPx.floatValue) < bottomBarHeightPx / 2.0f
|
||||||
|
|
||||||
if (shouldShow.value != newShouldShow) {
|
if (shouldShow.value != newShouldShow) {
|
||||||
shouldShow.value = newShouldShow
|
shouldShow.value = newShouldShow
|
||||||
|
|||||||
Reference in New Issue
Block a user