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

Commit 66871343 authored by Anton Potapov's avatar Anton Potapov
Browse files

Fix volume panel paddings according to the mocks

Flag: aconfig new_volume_panel DISABLED
Test: manual on phone, tablet and foldable
Fixes: 325667720
Change-Id: Iffdaf5bfc674ecec4a8ea480d5907ef7fd678e76
parent 3fdca447
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ constructor(
    @Composable
    override fun VolumePanelComposeScope.Content(modifier: Modifier) {
        Row(
            modifier = modifier.height(48.dp).fillMaxWidth(),
            modifier = modifier.height(if (isLargeScreen) 54.dp else 48.dp).fillMaxWidth(),
            horizontalArrangement = Arrangement.SpaceBetween,
            verticalAlignment = Alignment.CenterVertically,
        ) {
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ fun VolumePanelComposeScope.VerticalVolumePanelContent(
        if (layout.footerComponents.isNotEmpty()) {
            Row(
                modifier = Modifier.fillMaxWidth().wrapContentHeight(),
                horizontalArrangement = Arrangement.spacedBy(20.dp),
                horizontalArrangement = Arrangement.spacedBy(if (isLargeScreen) 28.dp else 20.dp),
            ) {
                for (component in layout.footerComponents) {
                    AnimatedVisibility(component.isVisible) {
+2 −2
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ class VolumePanelComposeScope(private val state: VolumePanelState) {
    val orientation: Int
        get() = state.orientation

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

+40 −26
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.volume.panel.ui.composable
import android.content.res.Configuration
import androidx.compose.foundation.clickable
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
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.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
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.VolumePanelViewModel

private val padding = 24.dp

@Composable
fun VolumePanelRoot(
    viewModel: VolumePanelViewModel,
@@ -84,7 +88,18 @@ fun VolumePanelRoot(
                    shape = RoundedCornerShape(topStart = radius, topEnd = radius),
                    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
private fun VolumePanelComposeScope.Components(components: ComponentsLayout) {
    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        VerticalVolumePanelContent(
            components,
            modifier = Modifier.padding(24.dp),
        )
private fun VolumePanelComposeScope.Components(
    layout: ComponentsLayout,
    modifier: Modifier = Modifier
) {
    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 {
        HorizontalVolumePanelContent(
            components,
            modifier =
                Modifier.padding(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 20.dp)
                    .heightIn(max = 236.dp),
        )
            HorizontalVolumePanelContent(layout)
        }
        BottomBar(layout = layout, modifier = Modifier)
    }
}

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