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

Commit 752e6267 authored by omarmt's avatar omarmt
Browse files

STL remove unused symbols in SwipeAnimation

Test: Clean up
Bug: 378470603
Flag: com.android.systemui.scene_container
Change-Id: I5dfc470ad016a87c0ef4ef1d666abb01fbaaee50
parent da8d6bb9
Loading
Loading
Loading
Loading
+17 −81
Original line number Original line Diff line number Diff line
@@ -116,7 +116,6 @@ private fun createSwipeAnimation(
            val fromScene = layoutState.currentScene
            val fromScene = layoutState.currentScene
            val toScene = result.toScene
            val toScene = result.toScene
            ChangeSceneSwipeTransition(
            ChangeSceneSwipeTransition(
                    layoutState = layoutState,
                swipeAnimation = swipeAnimation(fromContent = fromScene, toContent = toScene),
                swipeAnimation = swipeAnimation(fromContent = fromScene, toContent = toScene),
                key = result.transitionKey,
                key = result.transitionKey,
                replacedTransition = null,
                replacedTransition = null,
@@ -127,10 +126,9 @@ private fun createSwipeAnimation(
            val fromScene = layoutState.currentScene
            val fromScene = layoutState.currentScene
            val overlay = result.overlay
            val overlay = result.overlay
            ShowOrHideOverlaySwipeTransition(
            ShowOrHideOverlaySwipeTransition(
                    layoutState = layoutState,
                    fromOrToScene = fromScene,
                    overlay = overlay,
                swipeAnimation = swipeAnimation(fromContent = fromScene, toContent = overlay),
                swipeAnimation = swipeAnimation(fromContent = fromScene, toContent = overlay),
                overlay = overlay,
                fromOrToScene = fromScene,
                key = result.transitionKey,
                key = result.transitionKey,
                replacedTransition = null,
                replacedTransition = null,
                )
                )
@@ -140,10 +138,9 @@ private fun createSwipeAnimation(
            val toScene = layoutState.currentScene
            val toScene = layoutState.currentScene
            val overlay = result.overlay
            val overlay = result.overlay
            ShowOrHideOverlaySwipeTransition(
            ShowOrHideOverlaySwipeTransition(
                    layoutState = layoutState,
                    fromOrToScene = toScene,
                    overlay = overlay,
                swipeAnimation = swipeAnimation(fromContent = overlay, toContent = toScene),
                swipeAnimation = swipeAnimation(fromContent = overlay, toContent = toScene),
                overlay = overlay,
                fromOrToScene = toScene,
                key = result.transitionKey,
                key = result.transitionKey,
                replacedTransition = null,
                replacedTransition = null,
                )
                )
@@ -159,7 +156,6 @@ private fun createSwipeAnimation(


            val toOverlay = result.overlay
            val toOverlay = result.overlay
            ReplaceOverlaySwipeTransition(
            ReplaceOverlaySwipeTransition(
                    layoutState = layoutState,
                swipeAnimation =
                swipeAnimation =
                    swipeAnimation(fromContent = fromOverlay, toContent = toOverlay),
                    swipeAnimation(fromContent = fromOverlay, toContent = toOverlay),
                key = result.transitionKey,
                key = result.transitionKey,
@@ -170,22 +166,6 @@ private fun createSwipeAnimation(
    }
    }
}
}


internal fun createSwipeAnimation(old: SwipeAnimation<*>): SwipeAnimation<*> {
    return when (val transition = old.contentTransition) {
        is TransitionState.Transition.ChangeScene -> {
            ChangeSceneSwipeTransition(transition as ChangeSceneSwipeTransition).swipeAnimation
        }
        is TransitionState.Transition.ShowOrHideOverlay -> {
            ShowOrHideOverlaySwipeTransition(transition as ShowOrHideOverlaySwipeTransition)
                .swipeAnimation
        }
        is TransitionState.Transition.ReplaceOverlay -> {
            ReplaceOverlaySwipeTransition(transition as ReplaceOverlaySwipeTransition)
                .swipeAnimation
        }
    }
}

/** A helper class that contains the main logic for swipe transitions. */
/** A helper class that contains the main logic for swipe transitions. */
internal class SwipeAnimation<T : ContentKey>(
internal class SwipeAnimation<T : ContentKey>(
    val layoutState: MutableSceneTransitionLayoutStateImpl,
    val layoutState: MutableSceneTransitionLayoutStateImpl,
@@ -279,20 +259,6 @@ internal class SwipeAnimation<T : ContentKey>(
    override val absoluteDistance: Float
    override val absoluteDistance: Float
        get() = distance().absoluteValue
        get() = distance().absoluteValue


    constructor(
        other: SwipeAnimation<T>
    ) : this(
        layoutState = other.layoutState,
        fromContent = other.fromContent,
        toContent = other.toContent,
        orientation = other.orientation,
        isUpOrLeft = other.isUpOrLeft,
        requiresFullDistanceSwipe = other.requiresFullDistanceSwipe,
        distance = other.distance,
        currentContent = other.currentContent,
        dragOffset = other.offsetAnimation?.value ?: other.dragOffset,
    )

    suspend fun run() {
    suspend fun run() {
        // This animation will first be driven by finger, then when the user lift their finger we
        // This animation will first be driven by finger, then when the user lift their finger we
        // start an animation to the target offset (progress = 1f or progress = 0f). We await() for
        // start an animation to the target offset (progress = 1f or progress = 0f). We await() for
@@ -503,7 +469,6 @@ private object DefaultSwipeDistance : UserActionDistance {
}
}


private class ChangeSceneSwipeTransition(
private class ChangeSceneSwipeTransition(
    val layoutState: MutableSceneTransitionLayoutStateImpl,
    val swipeAnimation: SwipeAnimation<SceneKey>,
    val swipeAnimation: SwipeAnimation<SceneKey>,
    override val key: TransitionKey?,
    override val key: TransitionKey?,
    replacedTransition: ChangeSceneSwipeTransition?,
    replacedTransition: ChangeSceneSwipeTransition?,
@@ -515,15 +480,6 @@ private class ChangeSceneSwipeTransition(
    ),
    ),
    TransitionState.DirectionProperties by swipeAnimation {
    TransitionState.DirectionProperties by swipeAnimation {


    constructor(
        other: ChangeSceneSwipeTransition
    ) : this(
        layoutState = other.layoutState,
        swipeAnimation = SwipeAnimation(other.swipeAnimation),
        key = other.key,
        replacedTransition = other,
    )

    init {
    init {
        swipeAnimation.contentTransition = this
        swipeAnimation.contentTransition = this
    }
    }
@@ -561,7 +517,6 @@ private class ChangeSceneSwipeTransition(
}
}


private class ShowOrHideOverlaySwipeTransition(
private class ShowOrHideOverlaySwipeTransition(
    val layoutState: MutableSceneTransitionLayoutStateImpl,
    val swipeAnimation: SwipeAnimation<ContentKey>,
    val swipeAnimation: SwipeAnimation<ContentKey>,
    overlay: OverlayKey,
    overlay: OverlayKey,
    fromOrToScene: SceneKey,
    fromOrToScene: SceneKey,
@@ -576,16 +531,6 @@ private class ShowOrHideOverlaySwipeTransition(
        replacedTransition,
        replacedTransition,
    ),
    ),
    TransitionState.DirectionProperties by swipeAnimation {
    TransitionState.DirectionProperties by swipeAnimation {
    constructor(
        other: ShowOrHideOverlaySwipeTransition
    ) : this(
        layoutState = other.layoutState,
        swipeAnimation = SwipeAnimation(other.swipeAnimation),
        overlay = other.overlay,
        fromOrToScene = other.fromOrToScene,
        key = other.key,
        replacedTransition = other,
    )


    init {
    init {
        swipeAnimation.contentTransition = this
        swipeAnimation.contentTransition = this
@@ -624,7 +569,6 @@ private class ShowOrHideOverlaySwipeTransition(
}
}


private class ReplaceOverlaySwipeTransition(
private class ReplaceOverlaySwipeTransition(
    val layoutState: MutableSceneTransitionLayoutStateImpl,
    val swipeAnimation: SwipeAnimation<OverlayKey>,
    val swipeAnimation: SwipeAnimation<OverlayKey>,
    override val key: TransitionKey?,
    override val key: TransitionKey?,
    replacedTransition: ReplaceOverlaySwipeTransition?,
    replacedTransition: ReplaceOverlaySwipeTransition?,
@@ -635,14 +579,6 @@ private class ReplaceOverlaySwipeTransition(
        replacedTransition,
        replacedTransition,
    ),
    ),
    TransitionState.DirectionProperties by swipeAnimation {
    TransitionState.DirectionProperties by swipeAnimation {
    constructor(
        other: ReplaceOverlaySwipeTransition
    ) : this(
        layoutState = other.layoutState,
        swipeAnimation = SwipeAnimation(other.swipeAnimation),
        key = other.key,
        replacedTransition = other,
    )


    init {
    init {
        swipeAnimation.contentTransition = this
        swipeAnimation.contentTransition = this