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

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

Merge "Use the tile's size when selecting which colors to use." into main

parents 708a9f96 0bd686a9
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ fun Tile(
    val currentBounceableInfo by rememberUpdatedState(bounceableInfo)
    val resources = resources()
    val uiState = remember(state, resources) { state.toUiState(resources) }
    val colors = TileDefaults.getColorForState(uiState)
    val colors = TileDefaults.getColorForState(uiState, iconOnly)
    val hapticsViewModel: TileHapticsViewModel? =
        rememberViewModel(traceName = "TileHapticsViewModel") {
            tileHapticsViewModelFactoryProvider.getHapticsViewModelFactory()?.create(tile)
@@ -365,22 +365,24 @@ private object TileDefaults {
        )

    @Composable
    fun getColorForState(uiState: TileUiState): TileColors {
    fun getColorForState(uiState: TileUiState, iconOnly: Boolean): TileColors {
        return when (uiState.state) {
            STATE_ACTIVE -> {
                if (uiState.handlesSecondaryClick) {
                if (uiState.handlesSecondaryClick && !iconOnly) {
                    activeDualTargetTileColors()
                } else {
                    activeTileColors()
                }
            }

            STATE_INACTIVE -> {
                if (uiState.handlesSecondaryClick) {
                if (uiState.handlesSecondaryClick && !iconOnly) {
                    inactiveDualTargetTileColors()
                } else {
                    inactiveTileColors()
                }
            }

            else -> unavailableTileColors()
        }
    }