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

Commit 2ee96faa authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Recompose sized tiles in InfiniteGrid when the large tiles set changes

We previously assumed that tile sizes could only change in edit mode while QS was not composed.
The recent change allowing QS to be fully composed at all times broke that assumption and we now have to listen to updates to the large tiles set in order to reflect the most up to date sizes.

Test: manually editing tiles
Flag: com.android.systemui.qs_ui_refactor_compose_fragment
Fixes: 401549185
Change-Id: Ib89b3fe03188b8f11000f9fb4af03da14c8b5e93
parent ae8da20d
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -78,8 +78,15 @@ constructor(
            }

        val columns = columnsWithMediaViewModel.columns
        val largeTiles by iconTilesViewModel.largeTilesState
        val largeTilesSpan by iconTilesViewModel.largeTilesSpanState
        val sizedTiles = tiles.map { SizedTileImpl(it, it.spec.width(largeTilesSpan)) }
        // Tiles or largeTiles may be updated while this is composed, so listen to any changes
        val sizedTiles =
            remember(tiles, largeTiles, largeTilesSpan) {
                tiles.map {
                    SizedTileImpl(it, if (largeTiles.contains(it.spec)) largeTilesSpan else 1)
                }
            }
        val bounceables =
            remember(sizedTiles) { List(sizedTiles.size) { BounceableTileViewModel() } }
        val squishiness by viewModel.squishinessViewModel.squishiness.collectAsStateWithLifecycle()
+3 −0
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@ constructor(
    private val hydrator = Hydrator("DynamicIconTilesViewModel")
    private val interactor = interactorFactory.create()

    val largeTilesState =
        hydrator.hydratedStateOf(traceName = "largeTiles", source = iconTilesViewModel.largeTiles)

    val largeTilesSpanState =
        hydrator.hydratedStateOf(
            traceName = "largeTilesSpan",