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

Commit 08d81f55 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Avoid using the inlined label for current tiles in edit mode" into main

parents c4d9d988 9050353e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ class EditTileListStateTest : SysuiTestCase() {
                tileSpec = TileSpec.create(tileSpec),
                icon = Icon.Resource(0, null),
                label = AnnotatedString("unused"),
                inlinedLabel = null,
                appName = null,
                isCurrent = true,
                isDualTarget = false,
+3 −2
Original line number Diff line number Diff line
@@ -1009,9 +1009,10 @@ private fun AvailableTileGridCell(
            )
        }
        Box(Modifier.fillMaxSize()) {
            val inlinedLabel = cell.inlinedLabel
            val icon = cell.appIcon
            if (icon != null && icon is Icon.Loaded) {
                AppIconText(icon, cell.label, colors.label)
            if (inlinedLabel != null && icon != null && icon is Icon.Loaded) {
                AppIconText(icon, inlinedLabel, colors.label)
            } else {
                Text(
                    cell.label.text,
+22 −2
Original line number Diff line number Diff line
@@ -56,12 +56,13 @@ data class UnloadedEditTileViewModel(
                    append(loadedLabel)
                }
            } else {
                loadedLabel
                null
            }
        return EditTileViewModel(
            tileSpec = tileSpec,
            icon = icon,
            label = inlinedLabel,
            label = loadedLabel,
            inlinedLabel = inlinedLabel,
            appName = appName?.toAnnotatedString(context),
            appIcon = appIcon,
            isCurrent = isCurrent,
@@ -72,11 +73,30 @@ data class UnloadedEditTileViewModel(
    }
}

/**
 * Viewmodel for a loaded tile within Quick Settings edit mode.
 *
 * This represents a tile that has been loaded with localized resources and is ready to be displayed
 * in the UI.
 *
 * @property tileSpec The [TileSpec] for this tile.
 * @property icon The icon for the tile.
 * @property label The main label for the tile.
 * @property inlinedLabel An optional [AnnotatedString] with an inlined app icon.
 * @property appName The name of the associated app, if applicable.
 * @property appIcon The icon of the associated app, if applicable.
 * @property isCurrent True if the tile is in the user's active set of tiles, false otherwise.
 * @property isDualTarget True if the tile supports dual-target clicks, false otherwise.
 * @property availableEditActions A set of [AvailableEditActions] that can be performed on this tile
 *   in edit mode.
 * @property category The [TileCategory] the tile belongs to.
 */
@Immutable
data class EditTileViewModel(
    val tileSpec: TileSpec,
    val icon: Icon,
    val label: AnnotatedString,
    val inlinedLabel: AnnotatedString?,
    val appName: AnnotatedString?,
    val appIcon: Icon?,
    val isCurrent: Boolean,
+1 −0
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@ class DragAndDropTest : SysuiTestCase() {
                icon =
                    Icon.Resource(android.R.drawable.star_on, ContentDescription.Loaded(tileSpec)),
                label = AnnotatedString(tileSpec),
                inlinedLabel = null,
                appName = null,
                isCurrent = true,
                isDualTarget = false,
+1 −0
Original line number Diff line number Diff line
@@ -230,6 +230,7 @@ class EditModeTest : SysuiTestCase() {
                icon =
                    Icon.Resource(android.R.drawable.star_on, ContentDescription.Loaded(tileSpec)),
                label = AnnotatedString(tileSpec),
                inlinedLabel = null,
                appName = null,
                isCurrent = isCurrent,
                isDualTarget = false,
Loading