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

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

Merge "Adjust colors of the Volume Panel to comply with the a11y guidelines" into main

parents 2a8cf295 1f645f40
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ class ButtonComponent(
                        } else {
                            MaterialTheme.colorScheme.onSurface
                        },
                    useModifierBasedImplementation = true,
                    onClick = { onClick(it, gravity) },
                ) {
                    Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ class MediaOutputComponent @Inject constructor(private val viewModel: MediaOutpu
                    MaterialTheme.colorScheme.surfaceContainerHighest
                },
            shape = RoundedCornerShape(28.dp),
            useModifierBasedImplementation = true,
            onClick =
                if (enabled) {
                    { viewModel.onBarClick(it) }
+5 −8
Original line number Diff line number Diff line
@@ -68,10 +68,7 @@ constructor(
        content: @Composable (SystemUIDialog) -> Unit,
    ) {
        val dialog =
            dialogFactory.create(
                theme = R.style.Theme_VolumePanel_Popup,
                dialogGravity = gravity,
            ) {
            dialogFactory.create(theme = R.style.Theme_VolumePanel_Popup, dialogGravity = gravity) {
                PopupComposable(it, title, content)
            }
        val controller = expandable?.dialogTransitionController()
@@ -97,7 +94,7 @@ constructor(
                Box(
                    modifier =
                        Modifier.padding(horizontal = 80.dp).fillMaxWidth().wrapContentHeight(),
                    contentAlignment = Alignment.Center
                    contentAlignment = Alignment.Center,
                ) {
                    title(dialog)
                }
@@ -105,7 +102,7 @@ constructor(
                Box(
                    modifier =
                        Modifier.padding(horizontal = 16.dp).fillMaxWidth().wrapContentHeight(),
                    contentAlignment = Alignment.Center
                    contentAlignment = Alignment.Center,
                ) {
                    content(dialog)
                }
@@ -116,8 +113,8 @@ constructor(
                onClick = { dialog.dismiss() },
                colors =
                    IconButtonDefaults.iconButtonColors(
                        contentColor = MaterialTheme.colorScheme.outline
                    )
                        contentColor = MaterialTheme.colorScheme.onSurfaceVariant
                    ),
            ) {
                Icon(
                    painterResource(R.drawable.ic_close),
+9 −12
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ fun VolumePanelRadioButtonBar(
    indicatorBackgroundCornerSize: CornerSize =
        CornerSize(VolumePanelRadioButtonBarDefaults.DefaultIndicatorBackgroundCornerRadius),
    colors: VolumePanelRadioButtonBarColors = VolumePanelRadioButtonBarDefaults.defaultColors(),
    content: VolumePanelRadioButtonBarScope.() -> Unit
    content: VolumePanelRadioButtonBarScope.() -> Unit,
) {
    val scope =
        VolumePanelRadioButtonBarScopeImpl().apply(content).apply {
@@ -108,16 +108,13 @@ fun VolumePanelRadioButtonBar(
                    Modifier.layoutId(RadioButtonBarComponent.Indicator)
                        .offset { IntOffset(offsetAnimatable.value, 0) }
                        .padding(indicatorBackgroundPadding)
                        .background(
                            colors.indicatorColor,
                            RoundedCornerShape(indicatorCornerSize),
                        )
                        .background(colors.indicatorColor, RoundedCornerShape(indicatorCornerSize))
            )
            Row(
                modifier =
                    Modifier.layoutId(RadioButtonBarComponent.Buttons)
                        .padding(indicatorBackgroundPadding),
                horizontalArrangement = Arrangement.spacedBy(spacing)
                horizontalArrangement = Arrangement.spacedBy(spacing),
            ) {
                for (itemIndex in items.indices) {
                    val item = items[itemIndex]
@@ -134,7 +131,7 @@ fun VolumePanelRadioButtonBar(
                                .clickable(
                                    interactionSource = null,
                                    indication = null,
                                    onClick = { items[itemIndex].onItemSelected() }
                                    onClick = { items[itemIndex].onItemSelected() },
                                ),
                        horizontalArrangement = Arrangement.Center,
                        verticalAlignment = Alignment.CenterVertically,
@@ -155,7 +152,7 @@ fun VolumePanelRadioButtonBar(
                        .padding(
                            start = indicatorBackgroundPadding,
                            top = labelIndicatorBackgroundSpacing,
                            end = indicatorBackgroundPadding
                            end = indicatorBackgroundPadding,
                        )
                        .clearAndSetSemantics {},
                horizontalArrangement = Arrangement.spacedBy(spacing),
@@ -166,7 +163,7 @@ fun VolumePanelRadioButtonBar(
                        modifier = Modifier.weight(1f),
                        onClick = { items[itemIndex].onItemSelected() },
                        shape = RoundedCornerShape(cornersRadius),
                        contentPadding = PaddingValues(cornersRadius)
                        contentPadding = PaddingValues(cornersRadius),
                    ) {
                        val item = items[itemIndex]
                        if (item.icon !== Empty) {
@@ -210,7 +207,7 @@ private class BarMeasurePolicy(

    override fun MeasureScope.measure(
        measurables: List<Measurable>,
        constraints: Constraints
        constraints: Constraints,
    ): MeasureResult {
        val fillWidthConstraints = constraints.copy(minWidth = constraints.maxWidth)
        val buttonsPlaceable: Placeable =
@@ -307,10 +304,10 @@ object VolumePanelRadioButtonBarDefaults {
     */
    @Composable
    fun defaultColors(
        indicatorColor: Color = MaterialTheme.colorScheme.tertiaryContainer,
        indicatorColor: Color = MaterialTheme.colorScheme.tertiary,
        indicatorBackgroundColor: Color = MaterialTheme.colorScheme.surface,
        iconColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
        selectedIconColor: Color = MaterialTheme.colorScheme.onTertiaryContainer,
        selectedIconColor: Color = MaterialTheme.colorScheme.onTertiary,
        labelColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
        selectedLabelColor: Color = MaterialTheme.colorScheme.onSurface,
    ): VolumePanelRadioButtonBarColors =
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ constructor(
            text = stringResource(R.string.volume_panel_spatial_audio_title),
            style = MaterialTheme.typography.titleMedium,
            textAlign = TextAlign.Center,
            color = MaterialTheme.colorScheme.onSurface,
            maxLines = 1,
        )
    }
Loading