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

Commit 3acf6f2a authored by Andrew Xu's avatar Andrew Xu Committed by Android (Google) Code Review
Browse files

Merge "Introduce sizing tokens to the QS shade brightness bar" into main

parents 8fb1bc7f 8e1c7989
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2279,6 +2279,9 @@

    <!-- Spacing attributes to overwrite -->
    <dimen name="aux_spacing_overlay_panel_shape_radius">46dp</dimen>
    <dimen name="overlay_qs_layout_brightness_thumb_height">52dp</dimen>
    <dimen name="overlay_qs_layout_brightness_thumb_width">4dp</dimen>
    <dimen name="overlay_qs_layout_brightness_track_height">40dp</dimen>
    <!-- Spacing attributes to overwrite end -->

    <!-- Tile Details start-->
+25 −2
Original line number Diff line number Diff line
@@ -70,10 +70,12 @@ import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.input.pointer.pointerInteropFilter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.text
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
@@ -92,8 +94,11 @@ import com.android.systemui.brightness.ui.compose.Dimensions.IconPadding
import com.android.systemui.brightness.ui.compose.Dimensions.IconSize
import com.android.systemui.brightness.ui.compose.Dimensions.SliderBackgroundFrameSize
import com.android.systemui.brightness.ui.compose.Dimensions.SliderBackgroundRoundedCorner
import com.android.systemui.brightness.ui.compose.Dimensions.ThumbHeight
import com.android.systemui.brightness.ui.compose.Dimensions.SliderTrackRoundedCorner
import com.android.systemui.brightness.ui.compose.Dimensions.ThumbTrackGapSize
import com.android.systemui.brightness.ui.compose.Dimensions.ThumbWidth
import com.android.systemui.brightness.ui.compose.Dimensions.TrackHeight
import com.android.systemui.brightness.ui.viewmodel.BrightnessSliderViewModel
import com.android.systemui.brightness.ui.viewmodel.Drag
import com.android.systemui.common.shared.model.Icon
@@ -236,7 +241,7 @@ fun BrightnessSlider(
            SliderDefaults.Thumb(
                interactionSource = interactionSource,
                enabled = enabled,
                thumbSize = DpSize(4.dp, 52.dp),
                thumbSize = DpSize(ThumbWidth, ThumbHeight),
                colors = colors,
            )
        },
@@ -281,7 +286,7 @@ fun BrightnessSlider(
                            iconInactiveAlphaAnimatable.value exportAs
                                BrightnessSliderMotionTestKeys.InactiveIconAlpha
                        }
                        .height(40.dp)
                        .height(TrackHeight)
                        .drawWithContent {
                            drawContent()

@@ -444,6 +449,24 @@ private object Dimensions {
    val IconSize = DpSize(28.dp, 28.dp)
    val IconPadding = 6.dp
    val ThumbTrackGapSize = 6.dp

    val ThumbHeight : Dp
        @Composable
        @ReadOnlyComposable
        get() =
            dimensionResource(id = R.dimen.overlay_qs_layout_brightness_thumb_height)

    val ThumbWidth : Dp
        @Composable
        @ReadOnlyComposable
        get() =
            dimensionResource(id = R.dimen.overlay_qs_layout_brightness_thumb_width)

    val TrackHeight: Dp
        @Composable
        @ReadOnlyComposable
        get() =
            dimensionResource(id = R.dimen.overlay_qs_layout_brightness_track_height)
}

private object AnimationSpecs {
+10 −0
Original line number Diff line number Diff line
@@ -27,15 +27,19 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertHeightIsEqualTo
import androidx.compose.ui.test.hasStateDescription
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.unit.dp
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.compose.theme.PlatformTheme
import com.android.systemui.SysuiTestCase
import com.android.systemui.brightness.ui.viewmodel.BrightnessSliderViewModel
import com.android.systemui.common.shared.model.asIcon
import com.android.systemui.compose.modifiers.resIdToTestTag
import com.android.systemui.haptics.slider.sliderHapticsViewModelFactory
import com.android.systemui.res.R
import com.android.systemui.testKosmos
@@ -86,9 +90,15 @@ class BrightnessSliderTest : SysuiTestCase() {
                }
            }
        }

        composeRule
            .onNodeWithText(context.getString(R.string.accessibility_brightness))
            .assert(hasStateDescription("12%"))

        // Verify the slider's height.
        composeRule
            .onNodeWithTag(resIdToTestTag("slider"))
            .assertHeightIsEqualTo(52.dp)
    }

    @Test