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

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

Merge "Fix volume panel paddings according to the mocks" into main

parents 7fcc5ea8 66871343
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@ constructor(
    @Composable
    @Composable
    override fun VolumePanelComposeScope.Content(modifier: Modifier) {
    override fun VolumePanelComposeScope.Content(modifier: Modifier) {
        Row(
        Row(
            modifier = modifier.height(48.dp).fillMaxWidth(),
            modifier = modifier.height(if (isLargeScreen) 54.dp else 48.dp).fillMaxWidth(),
            horizontalArrangement = Arrangement.SpaceBetween,
            horizontalArrangement = Arrangement.SpaceBetween,
            verticalAlignment = Alignment.CenterVertically,
            verticalAlignment = Alignment.CenterVertically,
        ) {
        ) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -52,7 +52,7 @@ fun VolumePanelComposeScope.VerticalVolumePanelContent(
        if (layout.footerComponents.isNotEmpty()) {
        if (layout.footerComponents.isNotEmpty()) {
            Row(
            Row(
                modifier = Modifier.fillMaxWidth().wrapContentHeight(),
                modifier = Modifier.fillMaxWidth().wrapContentHeight(),
                horizontalArrangement = Arrangement.spacedBy(20.dp),
                horizontalArrangement = Arrangement.spacedBy(if (isLargeScreen) 28.dp else 20.dp),
            ) {
            ) {
                for (component in layout.footerComponents) {
                for (component in layout.footerComponents) {
                    AnimatedVisibility(component.isVisible) {
                    AnimatedVisibility(component.isVisible) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -27,8 +27,8 @@ class VolumePanelComposeScope(private val state: VolumePanelState) {
    val orientation: Int
    val orientation: Int
        get() = state.orientation
        get() = state.orientation


    /** Is true when Volume Panel is using wide-screen layout and false the otherwise. */
    /** Is true when Volume Panel is using large-screen layout and false the otherwise. */
    val isWideScreen: Boolean
    val isLargeScreen: Boolean
        get() = state.isWideScreen
        get() = state.isWideScreen
}
}


+40 −26
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.volume.panel.ui.composable
import android.content.res.Configuration
import android.content.res.Configuration
import androidx.compose.foundation.clickable
import androidx.compose.foundation.clickable
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxSize
@@ -26,6 +27,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Surface
@@ -43,6 +45,8 @@ import com.android.systemui.volume.panel.ui.layout.ComponentsLayout
import com.android.systemui.volume.panel.ui.viewmodel.VolumePanelState
import com.android.systemui.volume.panel.ui.viewmodel.VolumePanelState
import com.android.systemui.volume.panel.ui.viewmodel.VolumePanelViewModel
import com.android.systemui.volume.panel.ui.viewmodel.VolumePanelViewModel


private val padding = 24.dp

@Composable
@Composable
fun VolumePanelRoot(
fun VolumePanelRoot(
    viewModel: VolumePanelViewModel,
    viewModel: VolumePanelViewModel,
@@ -84,7 +88,18 @@ fun VolumePanelRoot(
                    shape = RoundedCornerShape(topStart = radius, topEnd = radius),
                    shape = RoundedCornerShape(topStart = radius, topEnd = radius),
                    color = MaterialTheme.colorScheme.surfaceContainer,
                    color = MaterialTheme.colorScheme.surfaceContainer,
                ) {
                ) {
                    Column { components?.let { componentsState -> Components(componentsState) } }
                    components?.let { componentsState ->
                        Components(
                            componentsState,
                            Modifier.padding(
                                    start = padding,
                                    top = padding,
                                    end = padding,
                                    bottom = 20.dp,
                                )
                                .navigationBarsPadding()
                        )
                    }
                }
                }
            }
            }
        }
        }
@@ -92,36 +107,35 @@ fun VolumePanelRoot(
}
}


@Composable
@Composable
private fun VolumePanelComposeScope.Components(components: ComponentsLayout) {
private fun VolumePanelComposeScope.Components(
    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
    layout: ComponentsLayout,
        VerticalVolumePanelContent(
    modifier: Modifier = Modifier
            components,
) {
            modifier = Modifier.padding(24.dp),
    var columnModifier = modifier.widthIn(max = 800.dp)
        )
    if (!isLargeScreen && orientation != Configuration.ORIENTATION_PORTRAIT) {
        columnModifier = columnModifier.heightIn(max = 332.dp)
    }
    Column(modifier = columnModifier, verticalArrangement = Arrangement.spacedBy(padding)) {
        if (orientation == Configuration.ORIENTATION_PORTRAIT || isLargeScreen) {
            VerticalVolumePanelContent(layout)
        } else {
        } else {
        HorizontalVolumePanelContent(
            HorizontalVolumePanelContent(layout)
            components,
        }
            modifier =
        BottomBar(layout = layout, modifier = Modifier)
                Modifier.padding(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 20.dp)
    }
                    .heightIn(max = 236.dp),
        )
}
}


    if (components.bottomBarComponent.isVisible) {
@Composable
        val horizontalPadding =
private fun VolumePanelComposeScope.BottomBar(
            dimensionResource(R.dimen.volume_panel_bottom_bar_horizontal_padding)
    layout: ComponentsLayout,
    modifier: Modifier = Modifier
) {
    if (layout.bottomBarComponent.isVisible) {
        Box(
        Box(
            modifier =
            modifier = modifier.fillMaxWidth(),
                Modifier.fillMaxWidth()
                    .navigationBarsPadding()
                    .padding(
                        start = horizontalPadding,
                        end = horizontalPadding,
                        bottom = dimensionResource(R.dimen.volume_panel_bottom_bar_bottom_padding),
                    ),
            contentAlignment = Alignment.Center,
            contentAlignment = Alignment.Center,
        ) {
        ) {
            with(components.bottomBarComponent.component as ComposeVolumePanelUiComponent) {
            with(layout.bottomBarComponent.component as ComposeVolumePanelUiComponent) {
                Content(Modifier)
                Content(Modifier)
            }
            }
        }
        }
+0 −2
Original line number Original line Diff line number Diff line
@@ -608,8 +608,6 @@
    <dimen name="volume_panel_slice_horizontal_padding">24dp</dimen>
    <dimen name="volume_panel_slice_horizontal_padding">24dp</dimen>


    <dimen name="volume_panel_corner_radius">52dp</dimen>
    <dimen name="volume_panel_corner_radius">52dp</dimen>
    <dimen name="volume_panel_bottom_bar_horizontal_padding">24dp</dimen>
    <dimen name="volume_panel_bottom_bar_bottom_padding">20dp</dimen>


    <!-- Size of each item in the ringer selector drawer. -->
    <!-- Size of each item in the ringer selector drawer. -->
    <dimen name="volume_ringer_drawer_item_size">42dp</dimen>
    <dimen name="volume_ringer_drawer_item_size">42dp</dimen>