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

Commit 26ab8de1 authored by Xiaowen Lei's avatar Xiaowen Lei
Browse files

Reduce Lockscreen Smartspace start padding to 16dp, same as end padding.

The non-RemoteViews cards, as well as the page indicator, will have
internal padding added, so that the total padding remains 32dp for them.

Also applied ktfmt fixes: diff patch 2 vs 1.

Flag: EXEMPT bugfix
Bug: 382345130
Test: on device, trigger multiple Smartspace cards including Sports
Test: on device, check wallpaper preview is not changed
Change-Id: Ifd2dbe73889ce14e99e3d76630cf1b100bb4b8a9
parent 74f35cb9
Loading
Loading
Loading
Loading
+10 −23
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ constructor(
                                    resources.getDimensionPixelSize(
                                        R.dimen.keyguard_status_view_bottom_margin
                                    )
                                }
                                },
                            )
                ) {
                    if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) {
@@ -87,6 +87,7 @@ constructor(
                    val paddingBelowClockStart =
                        dimensionResource(R.dimen.below_clock_padding_start)
                    val paddingBelowClockEnd = dimensionResource(R.dimen.below_clock_padding_end)
                    val paddingCardHorizontal = paddingBelowClockEnd

                    if (keyguardSmartspaceViewModel.isDateWeatherDecoupled) {
                        Row(
@@ -96,16 +97,14 @@ constructor(
                                    // All items will be constrained to be as tall as the shortest
                                    // item.
                                    .height(IntrinsicSize.Min)
                                    .padding(
                                        start = paddingBelowClockStart,
                                    ),
                                    .padding(start = paddingBelowClockStart),
                        ) {
                            Date(
                                modifier =
                                    Modifier.burnInAware(
                                        viewModel = aodBurnInViewModel,
                                        params = burnInParams,
                                    ),
                                    )
                            )
                            Spacer(modifier = Modifier.width(4.dp))
                            Weather(
@@ -113,7 +112,7 @@ constructor(
                                    Modifier.burnInAware(
                                        viewModel = aodBurnInViewModel,
                                        params = burnInParams,
                                    ),
                                    )
                            )
                        }
                    }
@@ -121,14 +120,8 @@ constructor(
                    Card(
                        modifier =
                            Modifier.fillMaxWidth()
                                .padding(
                                    start = paddingBelowClockStart,
                                    end = paddingBelowClockEnd,
                                )
                                .burnInAware(
                                    viewModel = aodBurnInViewModel,
                                    params = burnInParams,
                                ),
                                .padding(start = paddingCardHorizontal, end = paddingCardHorizontal)
                                .burnInAware(viewModel = aodBurnInViewModel, params = burnInParams)
                    )
                }
            }
@@ -136,9 +129,7 @@ constructor(
    }

    @Composable
    private fun Card(
        modifier: Modifier = Modifier,
    ) {
    private fun Card(modifier: Modifier = Modifier) {
        AndroidView(
            factory = { context ->
                FrameLayout(context).apply {
@@ -161,9 +152,7 @@ constructor(
    }

    @Composable
    private fun Weather(
        modifier: Modifier = Modifier,
    ) {
    private fun Weather(modifier: Modifier = Modifier) {
        val isVisible by keyguardSmartspaceViewModel.isWeatherVisible.collectAsStateWithLifecycle()
        if (!isVisible) {
            return
@@ -188,9 +177,7 @@ constructor(
    }

    @Composable
    private fun Date(
        modifier: Modifier = Modifier,
    ) {
    private fun Date(modifier: Modifier = Modifier) {
        val isVisible by keyguardSmartspaceViewModel.isDateVisible.collectAsStateWithLifecycle()
        if (!isVisible) {
            return
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@
    <dimen name="below_clock_padding_start">32dp</dimen>
    <dimen name="below_clock_padding_end">16dp</dimen>
    <dimen name="below_clock_padding_start_icons">28dp</dimen>
    <dimen name="smartspace_padding_horizontal">16dp</dimen>

    <!-- Proportion of the screen height to use to set the maximum height of the bouncer to when
         the device is in the DEVICE_POSTURE_HALF_OPENED posture, for the PIN/pattern entry. 0 will
+2 −2
Original line number Diff line number Diff line
@@ -368,8 +368,8 @@ constructor(
                    SceneContainerFlag.isEnabled,
                )
            )
        val startPadding: Int = smartspaceViewModel.getSmartspaceStartPadding(previewContext)
        val endPadding: Int = smartspaceViewModel.getSmartspaceEndPadding(previewContext)
        val startPadding: Int = smartspaceViewModel.getDateWeatherStartPadding(previewContext)
        val endPadding: Int = smartspaceViewModel.getDateWeatherEndPadding(previewContext)

        smartSpaceView?.let {
            it.setPaddingRelative(startPadding, topPadding, endPadding, 0)
+7 −6
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@ import com.android.systemui.keyguard.shared.model.KeyguardSection
import com.android.systemui.keyguard.ui.binder.KeyguardSmartspaceViewBinder
import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.res.R as R
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.shared.R as sharedR
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController
import dagger.Lazy
@@ -113,8 +113,9 @@ constructor(
    override fun applyConstraints(constraintSet: ConstraintSet) {
        if (!MigrateClocksToBlueprint.isEnabled) return
        if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) return
        val horizontalPaddingStart = KeyguardSmartspaceViewModel.getSmartspaceStartMargin(context)
        val horizontalPaddingEnd = KeyguardSmartspaceViewModel.getSmartspaceEndMargin(context)
        val dateWeatherPaddingStart = KeyguardSmartspaceViewModel.getDateWeatherStartMargin(context)
        val smartspaceHorizontalPadding =
            KeyguardSmartspaceViewModel.getSmartspaceHorizontalMargin(context)
        constraintSet.apply {
            // migrate addDateWeatherView, addWeatherView from KeyguardClockSwitchController
            constrainHeight(sharedR.id.date_smartspace_view, ConstraintSet.WRAP_CONTENT)
@@ -124,7 +125,7 @@ constructor(
                ConstraintSet.START,
                ConstraintSet.PARENT_ID,
                ConstraintSet.START,
                horizontalPaddingStart,
                dateWeatherPaddingStart,
            )

            // migrate addSmartspaceView from KeyguardClockSwitchController
@@ -135,7 +136,7 @@ constructor(
                ConstraintSet.START,
                ConstraintSet.PARENT_ID,
                ConstraintSet.START,
                horizontalPaddingStart,
                smartspaceHorizontalPadding,
            )
            connect(
                sharedR.id.bc_smartspace_view,
@@ -143,7 +144,7 @@ constructor(
                if (keyguardSmartspaceViewModel.isShadeLayoutWide.value) R.id.split_shade_guideline
                else ConstraintSet.PARENT_ID,
                ConstraintSet.END,
                horizontalPaddingEnd,
                smartspaceHorizontalPadding,
            )

            if (keyguardClockViewModel.hasCustomWeatherDataDisplay.value) {
+4 −4
Original line number Diff line number Diff line
@@ -62,12 +62,12 @@ constructor(
        overrideClockSize.value = clockSize
    }

    fun getSmartspaceStartPadding(context: Context): Int {
        return KeyguardSmartspaceViewModel.getSmartspaceStartMargin(context)
    fun getDateWeatherStartPadding(context: Context): Int {
        return KeyguardSmartspaceViewModel.getDateWeatherStartMargin(context)
    }

    fun getSmartspaceEndPadding(context: Context): Int {
        return KeyguardSmartspaceViewModel.getSmartspaceEndMargin(context)
    fun getDateWeatherEndPadding(context: Context): Int {
        return KeyguardSmartspaceViewModel.getDateWeatherEndMargin(context)
    }

    /*
Loading