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

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

Merge "STL: ContentScope replaces SceneScope 1/3" into main

parents 78fd834f 19a6d700
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -87,10 +87,10 @@ import androidx.compose.ui.unit.times
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.PlatformButton
import com.android.compose.animation.Easings
import com.android.compose.animation.scene.ContentScope
import com.android.compose.animation.scene.ElementKey
import com.android.compose.animation.scene.MutableSceneTransitionLayoutState
import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.SceneTransitionLayout
import com.android.compose.animation.scene.transitions
import com.android.compose.windowsizeclass.LocalWindowSizeClass
@@ -515,7 +515,7 @@ private fun FoldAware(
}

@Composable
private fun SceneScope.FoldableScene(
private fun ContentScope.FoldableScene(
    aboveFold: @Composable BoxScope.() -> Unit,
    belowFold: @Composable BoxScope.() -> Unit,
    isSplit: Boolean,
+5 −5
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.ui.Modifier
import com.android.compose.animation.scene.ContentScope
import com.android.compose.animation.scene.ElementKey
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.UserAction
import com.android.compose.animation.scene.UserActionResult
import com.android.systemui.bouncer.ui.BouncerDialogFactory
@@ -73,7 +73,7 @@ constructor(
    }

    @Composable
    override fun SceneScope.Content(modifier: Modifier) =
    override fun ContentScope.Content(modifier: Modifier) =
        BouncerScene(
            viewModel = rememberViewModel("BouncerScene") { contentViewModelFactory.create() },
            dialogFactory = dialogFactory,
@@ -82,7 +82,7 @@ constructor(
}

@Composable
private fun SceneScope.BouncerScene(
private fun ContentScope.BouncerScene(
    viewModel: BouncerSceneContentViewModel,
    dialogFactory: BouncerDialogFactory,
    modifier: Modifier = Modifier,
@@ -96,8 +96,8 @@ private fun SceneScope.BouncerScene(
            drawRect(color = backgroundColor)
        }

        // Separate the bouncer content into a reusable composable that doesn't have any SceneScope
        // dependencies
        // Separate the bouncer content into a reusable composable that doesn't have any
        // ContentScope dependencies
        BouncerContent(
            viewModel,
            dialogFactory,
+2 −2
Original line number Diff line number Diff line
@@ -33,13 +33,13 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.scene.ContentKey
import com.android.compose.animation.scene.ContentScope
import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.ElementKey
import com.android.compose.animation.scene.ElementMatcher
import com.android.compose.animation.scene.LowestZIndexContentPicker
import com.android.compose.animation.scene.MutableSceneTransitionLayoutState
import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.SceneTransitionLayout
import com.android.compose.animation.scene.Swipe
import com.android.compose.animation.scene.observableTransitionState
@@ -229,7 +229,7 @@ fun CommunalContainer(

/** Scene containing the glanceable hub UI. */
@Composable
fun SceneScope.CommunalScene(
fun ContentScope.CommunalScene(
    backgroundType: CommunalBackgroundType,
    colors: CommunalColors,
    content: CommunalContent,
+4 −3
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntRect
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.ContentScope
import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor
import com.android.systemui.communal.smartspace.SmartspaceInteractionHandler
import com.android.systemui.communal.ui.compose.section.AmbientStatusBarSection
@@ -65,7 +65,7 @@ constructor(
) {

    @Composable
    fun SceneScope.Content(modifier: Modifier = Modifier) {
    fun ContentScope.Content(modifier: Modifier = Modifier) {
        CommunalTouchableSurface(viewModel = viewModel, modifier = modifier) {
            Layout(
                modifier = Modifier.fillMaxSize(),
@@ -81,7 +81,7 @@ constructor(
                            dialogFactory = dialogFactory,
                            widgetSection = widgetSection,
                            modifier = Modifier.element(Communal.Elements.Grid),
                            sceneScope = this@Content,
                            contentScope = this@Content,
                        )
                    }
                    if (communalSettingsInteractor.isV2FlagEnabled()) {
@@ -193,6 +193,7 @@ constructor(
    companion object {
        private val screensaverButtonSize: Dp = 64.dp
        private val screensaverButtonPadding: Dp = 24.dp

        // TODO(b/382739998): Remove these hardcoded values once lock icon size and bottom area
        // position are sorted.
        private val lockIconSize: Dp = 54.dp
+10 −10
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ import androidx.compose.ui.zIndex
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.window.layout.WindowMetricsCalculator
import com.android.compose.animation.Easings.Emphasized
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.ContentScope
import com.android.compose.modifiers.thenIf
import com.android.compose.ui.graphics.painter.rememberDrawablePainter
import com.android.internal.R.dimen.system_app_widget_background_radius
@@ -217,7 +217,7 @@ fun CommunalHub(
    widgetConfigurator: WidgetConfigurator? = null,
    onOpenWidgetPicker: (() -> Unit)? = null,
    onEditDone: (() -> Unit)? = null,
    sceneScope: SceneScope? = null,
    contentScope: ContentScope? = null,
) {
    val communalContent by
        viewModel.communalContent.collectAsStateWithLifecycle(initialValue = emptyList())
@@ -437,7 +437,7 @@ fun CommunalHub(
                            widgetConfigurator = widgetConfigurator,
                            interactionHandler = interactionHandler,
                            widgetSection = widgetSection,
                            sceneScope = sceneScope,
                            contentScope = contentScope,
                        )
                    }
                }
@@ -827,7 +827,7 @@ private fun BoxScope.CommunalHubLazyGrid(
    widgetConfigurator: WidgetConfigurator?,
    interactionHandler: RemoteViews.InteractionHandler?,
    widgetSection: CommunalAppWidgetSection,
    sceneScope: SceneScope?,
    contentScope: ContentScope?,
) {
    var gridModifier =
        Modifier.align(Alignment.TopStart).onGloballyPositioned { setGridCoordinates(it) }
@@ -1009,7 +1009,7 @@ private fun BoxScope.CommunalHubLazyGrid(
                    interactionHandler = interactionHandler,
                    widgetSection = widgetSection,
                    resizeableItemFrameViewModel = resizeableItemFrameViewModel,
                    sceneScope = sceneScope,
                    contentScope = contentScope,
                )
            }
        }
@@ -1261,7 +1261,7 @@ private fun CommunalContent(
    interactionHandler: RemoteViews.InteractionHandler?,
    widgetSection: CommunalAppWidgetSection,
    resizeableItemFrameViewModel: ResizeableItemFrameViewModel,
    sceneScope: SceneScope? = null,
    contentScope: ContentScope? = null,
) {
    when (model) {
        is CommunalContentModel.WidgetContent.Widget ->
@@ -1285,7 +1285,7 @@ private fun CommunalContent(
        is CommunalContentModel.CtaTileInViewMode -> CtaTileInViewModeContent(viewModel, modifier)
        is CommunalContentModel.Smartspace -> SmartspaceContent(interactionHandler, model, modifier)
        is CommunalContentModel.Tutorial -> TutorialContent(modifier)
        is CommunalContentModel.Umo -> Umo(viewModel, sceneScope, modifier)
        is CommunalContentModel.Umo -> Umo(viewModel, contentScope, modifier)
        is CommunalContentModel.Spacer -> Box(Modifier.fillMaxSize())
    }
}
@@ -1701,11 +1701,11 @@ private fun TutorialContent(modifier: Modifier = Modifier) {
@Composable
private fun Umo(
    viewModel: BaseCommunalViewModel,
    sceneScope: SceneScope?,
    contentScope: ContentScope?,
    modifier: Modifier = Modifier,
) {
    if (SceneContainerFlag.isEnabled && sceneScope != null) {
        sceneScope.MediaCarousel(
    if (SceneContainerFlag.isEnabled && contentScope != null) {
        contentScope.MediaCarousel(
            modifier = modifier.fillMaxSize(),
            isVisible = true,
            mediaHost = viewModel.mediaHost,
Loading