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

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

Merge "Add LockscreenScope to encapsulate context & factory" into main

parents 19c5df9e 35a4d5c0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.keyguard.ui.composable.elements.LockIconElementProvi
import com.android.systemui.keyguard.ui.composable.elements.LockscreenElementFactoryImpl
import com.android.systemui.keyguard.ui.composable.elements.LockscreenElementFactoryImpl.Companion.createRemembered
import com.android.systemui.keyguard.ui.composable.elements.LockscreenLowerRegionElementProvider
import com.android.systemui.keyguard.ui.composable.elements.LockscreenScopeImpl
import com.android.systemui.keyguard.ui.composable.elements.LockscreenUpperRegionElementProvider
import com.android.systemui.keyguard.ui.composable.elements.MediaElementProvider
import com.android.systemui.keyguard.ui.composable.elements.NotificationStackElementProvider
@@ -131,7 +132,8 @@ constructor(
                    },
                )

            LockscreenSceneLayout(viewModel, elementFactory, elementContext)
            LockscreenScopeImpl(this@Content, elementFactory, elementContext)
                .LockscreenSceneLayout(viewModel)
        }
    }
}
+4 −12
Original line number Diff line number Diff line
@@ -40,10 +40,9 @@ import com.android.systemui.common.ui.ConfigurationState
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElement
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementContext
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementFactory
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementKeys
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementProvider
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenScope
import com.android.systemui.res.R
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.statusbar.notification.icon.ui.viewbinder.AlwaysOnDisplayNotificationIconViewStore
@@ -78,20 +77,13 @@ constructor(
        override val context = this@AodNotificationIconsElementProvider.context

        @Composable
        override fun ElementContentScope.LockscreenElement(
            factory: LockscreenElementFactory,
            context: LockscreenElementContext,
        ) {
            AodNotificationIcons(factory, context)
        override fun LockscreenScope<ElementContentScope>.LockscreenElement() {
            AodNotificationIcons()
        }
    }

    @Composable
    private fun ContentScope.AodNotificationIcons(
        factory: LockscreenElementFactory,
        context: LockscreenElementContext,
        modifier: Modifier = Modifier,
    ) {
    private fun LockscreenScope<ContentScope>.AodNotificationIcons(modifier: Modifier = Modifier) {
        val isVisible by
            keyguardRootViewModel.isNotifIconContainerVisible.collectAsStateWithLifecycle()
        val transitionState = remember { MutableTransitionState(isVisible.value) }
+5 −11
Original line number Diff line number Diff line
@@ -36,10 +36,9 @@ import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElement
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementContext
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementFactory
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementKeys
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementProvider
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenScope
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.statusbar.notification.promoted.AODPromotedNotification
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi
@@ -65,21 +64,16 @@ constructor(
        override val context = this@AodPromotedNotificationAreaElementProvider.context

        @Composable
        override fun ElementContentScope.LockscreenElement(
            factory: LockscreenElementFactory,
            context: LockscreenElementContext,
        ) {
        override fun LockscreenScope<ElementContentScope>.LockscreenElement() {
            if (PromotedNotificationUi.isEnabled) {
                AodPromotedNotificationArea(factory, context)
                AodPromotedNotificationArea()
            }
        }
    }

    @Composable
    private fun ContentScope.AodPromotedNotificationArea(
        factory: LockscreenElementFactory,
        context: LockscreenElementContext,
        modifier: Modifier = Modifier,
    private fun LockscreenScope<ContentScope>.AodPromotedNotificationArea(
        modifier: Modifier = Modifier
    ) {
        val isVisible by
            keyguardRootViewModel.isAodPromotedNotifVisible.collectAsStateWithLifecycle()
+76 −90
Original line number Diff line number Diff line
@@ -36,12 +36,12 @@ import com.android.compose.modifiers.padding
import com.android.systemui.customization.clocks.R as clocksR
import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElement
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementContext
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementFactory
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementKeys
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementKeys.Clock
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementKeys.Smartspace
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementProvider
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenScope
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenScope.Companion.LockscreenElement
import com.android.systemui.res.R
import com.android.systemui.shade.ShadeDisplayAware
import javax.inject.Inject
@@ -63,11 +63,7 @@ constructor(
        override val context = this@ClockRegionElementProvider.context

        @Composable
        override fun ElementContentScope.LockscreenElement(
            factory: LockscreenElementFactory,
            context: LockscreenElementContext,
        ) {
            with(factory) {
        override fun LockscreenScope<ElementContentScope>.LockscreenElement() {
            val shouldDateWeatherBeBelowSmallClock: Boolean by
                keyguardClockViewModel.shouldDateWeatherBeBelowSmallClock
                    .collectAsStateWithLifecycle()
@@ -83,12 +79,11 @@ constructor(
                        Modifier.padding(horizontal = xPadding)
                            .padding(top = dimensionResource(R.dimen.keyguard_clock_top_margin)),
                ) {
                        LockscreenElement(Clock.Small, context, Modifier)
                    LockscreenElement(Clock.Small)

                    if (!shouldDateWeatherBeBelowSmallClock) {
                        LockscreenElement(
                            Smartspace.DWA.SmallClock.Column,
                                context,
                            Modifier.padding(
                                horizontal =
                                    dimensionResource(R.dimen.smartspace_padding_horizontal)
@@ -100,13 +95,11 @@ constructor(
                if (shouldDateWeatherBeBelowSmallClock) {
                    LockscreenElement(
                        Smartspace.DWA.SmallClock.Row,
                            context,
                        Modifier.padding(horizontal = xPadding),
                    )
                }

                    LockscreenElement(Smartspace.Cards, context, Modifier)
                }
                LockscreenElement(Smartspace.Cards)
            }
        }
    }
@@ -116,11 +109,7 @@ constructor(
        override val context = this@ClockRegionElementProvider.context

        @Composable
        override fun ElementContentScope.LockscreenElement(
            factory: LockscreenElementFactory,
            context: LockscreenElementContext,
        ) {
            with(factory) {
        override fun LockscreenScope<ElementContentScope>.LockscreenElement() {
            val shouldDateWeatherBeBelowLargeClock: Boolean by
                keyguardClockViewModel.shouldDateWeatherBeBelowLargeClock
                    .collectAsStateWithLifecycle()
@@ -144,14 +133,12 @@ constructor(
                    if (!shouldDateWeatherBeBelowLargeClock) {
                        LockscreenElement(
                            Smartspace.DWA.LargeClock.Above,
                                context,
                            Modifier.padding(horizontal = xPadding),
                        )
                    }

                    LockscreenElement(
                        Smartspace.Cards,
                            context,
                        // Always reserve space for smartspace cards, even if they're not
                        // visible. This keeps the clock position stable when smartspace
                        // enters/exits.
@@ -170,10 +157,9 @@ constructor(
                        ),
                    modifier = Modifier.padding(horizontal = xPadding).fillMaxWidth().weight(1f),
                ) {
                        LockscreenElement(Clock.Large, context, Modifier)
                    LockscreenElement(Clock.Large)
                    if (shouldDateWeatherBeBelowLargeClock) {
                            LockscreenElement(Smartspace.DWA.LargeClock.Below, context, Modifier)
                        }
                        LockscreenElement(Smartspace.DWA.LargeClock.Below)
                    }
                }
            }
+2 −6
Original line number Diff line number Diff line
@@ -31,10 +31,9 @@ import com.android.systemui.keyguard.ui.binder.KeyguardIndicationAreaBinder
import com.android.systemui.keyguard.ui.view.KeyguardIndicationArea
import com.android.systemui.keyguard.ui.viewmodel.KeyguardIndicationAreaViewModel
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElement
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementContext
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementFactory
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementKeys
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementProvider
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenScope
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.statusbar.KeyguardIndicationController
import javax.inject.Inject
@@ -55,10 +54,7 @@ constructor(
        override val context = this@IndicationAreaElementProvider.context

        @Composable
        override fun ElementContentScope.LockscreenElement(
            factory: LockscreenElementFactory,
            context: LockscreenElementContext,
        ) {
        override fun LockscreenScope<ElementContentScope>.LockscreenElement() {
            IndicationArea()
        }
    }
Loading