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

Commit d7567596 authored by Danny Burakov's avatar Danny Burakov Committed by Android (Google) Code Review
Browse files

Merge "[bc25] Define animated transitions for Dual Shade overlays." into main

parents 1cd5f1d0 ff78b0ba
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import com.android.compose.animation.scene.TransitionKey
import com.android.compose.animation.scene.transitions
import com.android.systemui.bouncer.ui.composable.Bouncer
import com.android.systemui.notifications.ui.composable.Notifications
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.TransitionKeys.SlightlyFasterShadeCollapse
import com.android.systemui.scene.shared.model.TransitionKeys.ToSplitShade
@@ -20,7 +21,11 @@ import com.android.systemui.scene.ui.composable.transitions.lockscreenToGoneTran
import com.android.systemui.scene.ui.composable.transitions.lockscreenToQuickSettingsTransition
import com.android.systemui.scene.ui.composable.transitions.lockscreenToShadeTransition
import com.android.systemui.scene.ui.composable.transitions.lockscreenToSplitShadeTransition
import com.android.systemui.scene.ui.composable.transitions.notificationsShadeToQuickSettingsShadeTransition
import com.android.systemui.scene.ui.composable.transitions.shadeToQuickSettingsTransition
import com.android.systemui.scene.ui.composable.transitions.toNotificationsShadeTransition
import com.android.systemui.scene.ui.composable.transitions.toQuickSettingsShadeTransition
import com.android.systemui.shade.ui.composable.OverlayShade
import com.android.systemui.shade.ui.composable.Shade

/**
@@ -74,6 +79,14 @@ val SceneContainerTransitions = transitions {
    from(Scenes.Lockscreen, to = Scenes.Gone) { lockscreenToGoneTransition() }
    from(Scenes.Shade, to = Scenes.QuickSettings) { shadeToQuickSettingsTransition() }

    // Overlay transitions

    to(Overlays.NotificationsShade) { toNotificationsShadeTransition() }
    to(Overlays.QuickSettingsShade) { toQuickSettingsShadeTransition() }
    from(Overlays.NotificationsShade, Overlays.QuickSettingsShade) {
        notificationsShadeToQuickSettingsShadeTransition()
    }

    // Scene overscroll

    overscrollDisabled(Scenes.Gone, Orientation.Vertical)
@@ -91,4 +104,10 @@ val SceneContainerTransitions = transitions {
            y = Shade.Dimensions.ScrimOverscrollLimit,
        )
    }
    overscroll(Overlays.NotificationsShade, Orientation.Vertical) {
        translate(OverlayShade.Elements.Panel, y = OverlayShade.Dimensions.OverscrollLimit)
    }
    overscroll(Overlays.QuickSettingsShade, Orientation.Vertical) {
        translate(OverlayShade.Elements.Panel, y = OverlayShade.Dimensions.OverscrollLimit)
    }
}
+0 −27
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.scene.ui.composable.transitions

import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.TransitionBuilder

fun TransitionBuilder.goneToQuickSettingsShadeTransition(
    edge: Edge = Edge.Top,
    durationScale: Double = 1.0,
) {
    toQuickSettingsShadeTransition(edge, durationScale)
}
+0 −25
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.scene.ui.composable.transitions

import com.android.compose.animation.scene.TransitionBuilder

fun TransitionBuilder.lockscreenToNotificationsShadeTransition(
    durationScale: Double = 1.0,
) {
    toNotificationsShadeTransition(durationScale = durationScale)
}
+0 −26
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.scene.ui.composable.transitions

import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.TransitionBuilder

fun TransitionBuilder.lockscreenToQuickSettingsShadeTransition(
    durationScale: Double = 1.0,
) {
    toQuickSettingsShadeTransition(Edge.Top, durationScale)
}
+15 −3
Original line number Diff line number Diff line
@@ -16,10 +16,22 @@

package com.android.systemui.scene.ui.composable.transitions

import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween
import com.android.compose.animation.scene.TransitionBuilder
import com.android.systemui.shade.ui.composable.Shade
import kotlin.time.Duration.Companion.milliseconds

fun TransitionBuilder.goneToNotificationsShadeTransition(
    durationScale: Double = 1.0,
fun TransitionBuilder.notificationsShadeToQuickSettingsShadeTransition(
    durationScale: Double = 1.0
) {
    toNotificationsShadeTransition(durationScale)
    spec = tween(durationMillis = (DefaultDuration * durationScale).inWholeMilliseconds.toInt())
    swipeSpec =
        spring(
            stiffness = Spring.StiffnessMediumLow,
            visibilityThreshold = Shade.Dimensions.ScrimVisibilityThreshold,
        )
}

private val DefaultDuration = 300.milliseconds
Loading