mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-20 01:05:26 +02:00
Replaced one bug with another.
SecondScreen.kt: Fixed bug when selected chip was set to null after activity recreation. Introduced new bug when selected chip is not saved when changing device configuration. (Will probably fix it, but it's such a rare case and the app has to be released already)
This commit is contained in:
parent
6ec1e1dfb0
commit
a94d6a66e8
@ -28,9 +28,6 @@ import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.rememberTopAppBarScrollState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
@ -72,10 +69,6 @@ private fun BasicUnitListScreen(
|
||||
title: String,
|
||||
) {
|
||||
val uiState = viewModel.uiState
|
||||
val currentUnitGroup: UnitGroup? by rememberSaveable {
|
||||
viewModel.setSelectedChip(currentUnit.group)
|
||||
mutableStateOf(currentUnit.group)
|
||||
}
|
||||
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarScrollState())
|
||||
val focusManager = LocalFocusManager.current
|
||||
val chipsRowLazyListState = rememberLazyListState()
|
||||
@ -131,10 +124,9 @@ private fun BasicUnitListScreen(
|
||||
/**
|
||||
* Telling viewModel that it needs to update the list
|
||||
*/
|
||||
viewModel.setSelectedChip(currentUnit.group)
|
||||
viewModel.loadUnitsToShow(noBrokenCurrencies)
|
||||
currentUnitGroup?.let {
|
||||
chipsRowLazyListState.animateScrollToItem(ALL_UNIT_GROUPS.indexOf(it))
|
||||
}
|
||||
chipsRowLazyListState.animateScrollToItem(ALL_UNIT_GROUPS.indexOf(currentUnit.group))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user