Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt +8 −13 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ abstract class CrossActivityBackAnimation( private var triggerBack = false private var finishCallback: IRemoteAnimationFinishedCallback? = null private val progressAnimator = BackProgressAnimator() private val displayBoundsMargin = protected val displayBoundsMargin = context.resources.getDimension(R.dimen.cross_task_back_vertical_margin) private val gestureInterpolator = Interpolators.BACK_GESTURE Loading Loading @@ -116,6 +116,12 @@ abstract class CrossActivityBackAnimation( */ abstract val allowEnteringYShift: Boolean /** * Subclasses must set the [startClosingRect] and [targetClosingRect] to define the movement * of the closingTarget during pre-commit phase. */ abstract fun preparePreCommitClosingRectMovement(@BackEvent.SwipeEdge swipeEdge: Int) /** * Subclasses must set the [startEnteringRect] and [targetEnteringRect] to define the movement * of the enteringTarget during pre-commit phase. Loading Loading @@ -170,18 +176,7 @@ abstract class CrossActivityBackAnimation( // Offset start rectangle to align task bounds. backAnimRect.offsetTo(0, 0) startClosingRect.set(backAnimRect) // scale closing target into the middle for rhs and to the right for lhs targetClosingRect.set(startClosingRect) targetClosingRect.scaleCentered(MAX_SCALE) if (backMotionEvent.swipeEdge != BackEvent.EDGE_RIGHT) { targetClosingRect.offset( startClosingRect.right - targetClosingRect.right - displayBoundsMargin, 0f ) } preparePreCommitClosingRectMovement(backMotionEvent.swipeEdge) preparePreCommitEnteringRectMovement() background.ensureBackground( Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/CustomCrossActivityBackAnimation.kt +16 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.view.Choreographer import android.view.SurfaceControl import android.view.animation.Animation import android.view.animation.Transformation import android.window.BackEvent import android.window.BackMotionEvent import android.window.BackNavigationInfo import com.android.internal.R Loading Loading @@ -74,6 +75,21 @@ class CustomCrossActivityBackAnimation( ) ) override fun preparePreCommitClosingRectMovement(swipeEdge: Int) { startClosingRect.set(backAnimRect) // scale closing target to the left for right-hand-swipe and to the right for // left-hand-swipe targetClosingRect.set(startClosingRect) targetClosingRect.scaleCentered(MAX_SCALE) val offset = if (swipeEdge != BackEvent.EDGE_RIGHT) { startClosingRect.right - targetClosingRect.right - displayBoundsMargin } else { -targetClosingRect.left + displayBoundsMargin } targetClosingRect.offset(offset, 0f) } override fun preparePreCommitEnteringRectMovement() { // No movement for the entering rect startEnteringRect.set(startClosingRect) Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/DefaultCrossActivityBackAnimation.kt +15 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.wm.shell.back import android.content.Context import android.view.Choreographer import android.view.SurfaceControl import android.window.BackEvent import com.android.wm.shell.R import com.android.wm.shell.RootTaskDisplayAreaOrganizer import com.android.wm.shell.animation.Interpolators Loading Loading @@ -47,6 +48,20 @@ constructor( context.resources.getDimension(R.dimen.cross_activity_back_entering_start_offset) override val allowEnteringYShift = true override fun preparePreCommitClosingRectMovement(swipeEdge: Int) { startClosingRect.set(backAnimRect) // scale closing target into the middle for rhs and to the right for lhs targetClosingRect.set(startClosingRect) targetClosingRect.scaleCentered(MAX_SCALE) if (swipeEdge != BackEvent.EDGE_RIGHT) { targetClosingRect.offset( startClosingRect.right - targetClosingRect.right - displayBoundsMargin, 0f ) } } override fun preparePreCommitEnteringRectMovement() { // the entering target starts 96dp to the left of the screen edge... startEnteringRect.set(startClosingRect) Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt +8 −13 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ abstract class CrossActivityBackAnimation( private var triggerBack = false private var finishCallback: IRemoteAnimationFinishedCallback? = null private val progressAnimator = BackProgressAnimator() private val displayBoundsMargin = protected val displayBoundsMargin = context.resources.getDimension(R.dimen.cross_task_back_vertical_margin) private val gestureInterpolator = Interpolators.BACK_GESTURE Loading Loading @@ -116,6 +116,12 @@ abstract class CrossActivityBackAnimation( */ abstract val allowEnteringYShift: Boolean /** * Subclasses must set the [startClosingRect] and [targetClosingRect] to define the movement * of the closingTarget during pre-commit phase. */ abstract fun preparePreCommitClosingRectMovement(@BackEvent.SwipeEdge swipeEdge: Int) /** * Subclasses must set the [startEnteringRect] and [targetEnteringRect] to define the movement * of the enteringTarget during pre-commit phase. Loading Loading @@ -170,18 +176,7 @@ abstract class CrossActivityBackAnimation( // Offset start rectangle to align task bounds. backAnimRect.offsetTo(0, 0) startClosingRect.set(backAnimRect) // scale closing target into the middle for rhs and to the right for lhs targetClosingRect.set(startClosingRect) targetClosingRect.scaleCentered(MAX_SCALE) if (backMotionEvent.swipeEdge != BackEvent.EDGE_RIGHT) { targetClosingRect.offset( startClosingRect.right - targetClosingRect.right - displayBoundsMargin, 0f ) } preparePreCommitClosingRectMovement(backMotionEvent.swipeEdge) preparePreCommitEnteringRectMovement() background.ensureBackground( Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/CustomCrossActivityBackAnimation.kt +16 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.view.Choreographer import android.view.SurfaceControl import android.view.animation.Animation import android.view.animation.Transformation import android.window.BackEvent import android.window.BackMotionEvent import android.window.BackNavigationInfo import com.android.internal.R Loading Loading @@ -74,6 +75,21 @@ class CustomCrossActivityBackAnimation( ) ) override fun preparePreCommitClosingRectMovement(swipeEdge: Int) { startClosingRect.set(backAnimRect) // scale closing target to the left for right-hand-swipe and to the right for // left-hand-swipe targetClosingRect.set(startClosingRect) targetClosingRect.scaleCentered(MAX_SCALE) val offset = if (swipeEdge != BackEvent.EDGE_RIGHT) { startClosingRect.right - targetClosingRect.right - displayBoundsMargin } else { -targetClosingRect.left + displayBoundsMargin } targetClosingRect.offset(offset, 0f) } override fun preparePreCommitEnteringRectMovement() { // No movement for the entering rect startEnteringRect.set(startClosingRect) Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/DefaultCrossActivityBackAnimation.kt +15 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.wm.shell.back import android.content.Context import android.view.Choreographer import android.view.SurfaceControl import android.window.BackEvent import com.android.wm.shell.R import com.android.wm.shell.RootTaskDisplayAreaOrganizer import com.android.wm.shell.animation.Interpolators Loading Loading @@ -47,6 +48,20 @@ constructor( context.resources.getDimension(R.dimen.cross_activity_back_entering_start_offset) override val allowEnteringYShift = true override fun preparePreCommitClosingRectMovement(swipeEdge: Int) { startClosingRect.set(backAnimRect) // scale closing target into the middle for rhs and to the right for lhs targetClosingRect.set(startClosingRect) targetClosingRect.scaleCentered(MAX_SCALE) if (swipeEdge != BackEvent.EDGE_RIGHT) { targetClosingRect.offset( startClosingRect.right - targetClosingRect.right - displayBoundsMargin, 0f ) } } override fun preparePreCommitEnteringRectMovement() { // the entering target starts 96dp to the left of the screen edge... startEnteringRect.set(startClosingRect) Loading