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

Commit e7b1ff94 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "sports-background-start-padding" into main

* changes:
  Add SmartspaceView.setHorizontalPaddings.
  Reduce Lockscreen Smartspace start padding to 16dp, same as end padding.
parents 6ae82e5d e46fd73b
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
+2 −0
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ class CommunalSmartspaceControllerTest : SysuiTestCase() {
        override fun getCurrentCardTopPadding(): Int {
            return 0
        }

        override fun setHorizontalPaddings(horizontalPadding: Int) {}
    }

    @Before
+2 −0
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ class DreamSmartspaceControllerTest : SysuiTestCase() {
        override fun getCurrentCardTopPadding(): Int {
            return 0
        }

        override fun setHorizontalPaddings(horizontalPadding: Int) {}
    }

    @Before
+3 −0
Original line number Diff line number Diff line
@@ -1109,6 +1109,9 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() {
            override fun getCurrentCardTopPadding(): Int {
                return 0
            }

            override fun setHorizontalPaddings(horizontalPadding: Int) {
            }
        })
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -213,6 +213,13 @@ public interface BcSmartspaceDataPlugin extends Plugin {
        default int getCurrentCardTopPadding() {
            throw new UnsupportedOperationException("Not implemented by " + getClass());
        }

        /**
         * Set the horizontal paddings for applicable children inside the SmartspaceView.
         */
        default void setHorizontalPaddings(int horizontalPadding) {
            throw new UnsupportedOperationException("Not implemented by " + getClass());
        }
    }

    /** Interface for launching Intents, which can differ on the lockscreen */
Loading