Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6771b84 authored by Prince's avatar Prince
Browse files

Saving scroll position when entering edit mode

Fixes: 357975391
Test: device tested
Flag: NONE small ui fix
Change-Id: Id96f189b23484ad732be6c5d6621c9cca0077776
parent 4f76b942
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -196,7 +196,12 @@ fun CommunalHub(

    val gridState =
        rememberLazyGridState(viewModel.savedFirstScrollIndex, viewModel.savedFirstScrollOffset)

    LaunchedEffect(Unit) {
        if (!viewModel.isEditMode) {
            viewModel.clearPersistedScrollPosition()
        }
    }

    val contentListState = rememberContentListState(widgetConfigurator, communalContent, viewModel)
    val reorderingWidgets by viewModel.reorderingWidgets.collectAsStateWithLifecycle()
@@ -219,7 +224,6 @@ fun CommunalHub(
    val windowMetrics = WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(context)
    val screenWidth = windowMetrics.bounds.width()
    val layoutDirection = LocalLayoutDirection.current

    if (viewModel.isEditMode) {
        ObserveNewWidgetAddedEffect(communalContent, gridState, viewModel)
    } else {
@@ -543,7 +547,6 @@ private fun ScrollOnUpdatedLiveContentEffect(
    communalContent: List<CommunalContentModel>,
    gridState: LazyGridState,
) {
    val coroutineScope = rememberCoroutineScope()
    val liveContentKeys = remember { mutableListOf<String>() }
    var communalContentPending by remember { mutableStateOf(true) }