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


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