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

Commit 3055d5c6 authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Update colours to match the updated scheme" into main

parents 3116b729 37b076ce
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -69,9 +69,9 @@ class ButtonComponent(
                            role = Role.Button
                            contentDescription = label
                        },
                    color = MaterialTheme.colorScheme.primaryContainer,
                    color = MaterialTheme.colorScheme.tertiaryContainer,
                    shape = RoundedCornerShape(28.dp),
                    contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
                    contentColor = MaterialTheme.colorScheme.onTertiaryContainer,
                    onClick = onClick,
                ) {
                    Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+2 −2
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ class ToggleButtonComponent(
                val colors =
                    if (viewModel.isChecked) {
                        ButtonDefaults.buttonColors(
                            containerColor = MaterialTheme.colorScheme.primaryContainer,
                            contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
                            containerColor = MaterialTheme.colorScheme.tertiaryContainer,
                            contentColor = MaterialTheme.colorScheme.onTertiaryContainer,
                        )
                    } else {
                        ButtonDefaults.buttonColors(
+36 −4
Original line number Diff line number Diff line
@@ -30,9 +30,11 @@ import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
@@ -119,6 +121,7 @@ fun VolumePanelRadioButtonBar(
            ) {
                for (itemIndex in items.indices) {
                    val item = items[itemIndex]
                    val isSelected = itemIndex == scope.selectedIndex
                    Row(
                        modifier =
                            Modifier.height(48.dp)
@@ -126,7 +129,7 @@ fun VolumePanelRadioButtonBar(
                                .semantics {
                                    item.contentDescription?.let { contentDescription = it }
                                    role = Role.Switch
                                    selected = itemIndex == scope.selectedIndex
                                    selected = isSelected
                                }
                                .clickable(
                                    interactionSource = null,
@@ -137,11 +140,15 @@ fun VolumePanelRadioButtonBar(
                        verticalAlignment = Alignment.CenterVertically,
                    ) {
                        if (item.icon !== Empty) {
                            CompositionLocalProvider(
                                LocalContentColor provides colors.getIconColor(isSelected)
                            ) {
                                with(items[itemIndex]) { icon() }
                            }
                        }
                    }
                }
            }
            Row(
                modifier =
                    Modifier.layoutId(RadioButtonBarComponent.Labels)
@@ -163,11 +170,14 @@ fun VolumePanelRadioButtonBar(
                    ) {
                        val item = items[itemIndex]
                        if (item.icon !== Empty) {
                            val textColor = colors.getLabelColor(itemIndex == scope.selectedIndex)
                            CompositionLocalProvider(LocalContentColor provides textColor) {
                                with(items[itemIndex]) { label() }
                            }
                        }
                    }
                }
            }
        },
        measurePolicy =
            with(LocalDensity.current) {
@@ -265,8 +275,22 @@ data class VolumePanelRadioButtonBarColors(
    val indicatorColor: Color,
    /** Color of the indicator background. */
    val indicatorBackgroundColor: Color,
    /** Color of the icon. */
    val iconColor: Color,
    /** Color of the icon when it's selected. */
    val selectedIconColor: Color,
    /** Color of the label. */
    val labelColor: Color,
    /** Color of the label when it's selected. */
    val selectedLabelColor: Color,
)

private fun VolumePanelRadioButtonBarColors.getIconColor(selected: Boolean): Color =
    if (selected) selectedIconColor else iconColor

private fun VolumePanelRadioButtonBarColors.getLabelColor(selected: Boolean): Color =
    if (selected) selectedLabelColor else labelColor

object VolumePanelRadioButtonBarDefaults {

    val DefaultIndicatorBackgroundPadding = 8.dp
@@ -283,12 +307,20 @@ object VolumePanelRadioButtonBarDefaults {
     */
    @Composable
    fun defaultColors(
        indicatorColor: Color = MaterialTheme.colorScheme.primaryContainer,
        indicatorColor: Color = MaterialTheme.colorScheme.tertiaryContainer,
        indicatorBackgroundColor: Color = MaterialTheme.colorScheme.surface,
        iconColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
        selectedIconColor: Color = MaterialTheme.colorScheme.onTertiaryContainer,
        labelColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
        selectedLabelColor: Color = MaterialTheme.colorScheme.onSurface,
    ): VolumePanelRadioButtonBarColors =
        VolumePanelRadioButtonBarColors(
            indicatorColor = indicatorColor,
            indicatorBackgroundColor = indicatorBackgroundColor,
            iconColor = iconColor,
            selectedIconColor = selectedIconColor,
            labelColor = labelColor,
            selectedLabelColor = selectedLabelColor,
        )
}

+3 −8
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.volume.panel.component.spatialaudio.ui.composable

import androidx.compose.foundation.basicMarquee
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -29,7 +30,6 @@ import androidx.compose.ui.text.style.TextAlign
import com.android.internal.logging.UiEventLogger
import com.android.systemui.animation.Expandable
import com.android.systemui.common.ui.compose.Icon
import com.android.systemui.common.ui.compose.toColor
import com.android.systemui.res.R
import com.android.systemui.statusbar.phone.SystemUIDialog
import com.android.systemui.volume.panel.component.popup.ui.composable.VolumePanelPopup
@@ -88,18 +88,13 @@ constructor(
                    isSelected = buttonViewModel.button.isChecked,
                    onItemSelected = { viewModel.setEnabled(buttonViewModel.model) },
                    contentDescription = label,
                    icon = {
                        Icon(
                            icon = buttonViewModel.button.icon,
                            tint = buttonViewModel.iconColor.toColor(),
                        )
                    },
                    icon = { Icon(icon = buttonViewModel.button.icon) },
                    label = {
                        Text(
                            modifier = Modifier.basicMarquee(),
                            text = label,
                            style = MaterialTheme.typography.labelMedium,
                            color = buttonViewModel.labelColor.toColor(),
                            color = LocalContentColor.current,
                            textAlign = TextAlign.Center,
                            maxLines = 2
                        )
+0 −3
Original line number Diff line number Diff line
@@ -16,13 +16,10 @@

package com.android.systemui.volume.panel.component.spatial.ui.viewmodel

import com.android.systemui.common.shared.model.Color
import com.android.systemui.volume.panel.component.button.ui.viewmodel.ToggleButtonViewModel
import com.android.systemui.volume.panel.component.spatial.domain.model.SpatialAudioEnabledModel

data class SpatialAudioButtonViewModel(
    val model: SpatialAudioEnabledModel,
    val button: ToggleButtonViewModel,
    val iconColor: Color,
    val labelColor: Color,
)
Loading