Merge "Dismiss split select when tapping on home button" into udc-qpr-dev am: 64f3766ba7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23986000 Change-Id: I6728ffc217017fad591b0ada439b4587197d6352 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -111,7 +111,7 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
&& !toState.overviewUi;
|
||||
if (mRecentsView.isSplitSelectionActive() && exitingOverview) {
|
||||
setter.add(mRecentsView.getSplitSelectController().getSplitAnimationController()
|
||||
.animateAwayPlaceholder(mLauncher));
|
||||
.createPlaceholderDismissAnim(mLauncher));
|
||||
setter.setViewAlpha(
|
||||
mRecentsView.getSplitInstructionsView(),
|
||||
0,
|
||||
|
||||
@@ -549,7 +549,7 @@ public class QuickstepLauncher extends Launcher {
|
||||
list.add(getDragController());
|
||||
Consumer<AnimatorSet> splitAnimator = animatorSet -> {
|
||||
AnimatorSet anim = mSplitSelectStateController.getSplitAnimationController()
|
||||
.animateAwayPlaceholder(QuickstepLauncher.this);
|
||||
.createPlaceholderDismissAnim(QuickstepLauncher.this);
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
@@ -1000,6 +1000,13 @@ public class QuickstepLauncher extends Launcher {
|
||||
return mSplitToWorkspaceController;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleSplitAnimationGoingToHome() {
|
||||
super.handleSplitAnimationGoingToHome();
|
||||
mSplitSelectStateController.getSplitAnimationController()
|
||||
.playPlaceholderDismissAnim(this);
|
||||
}
|
||||
|
||||
public <T extends OverviewActionsView> T getActionsView() {
|
||||
return (T) mActionsView;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
package com.android.quickstep.util
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.AnimatorListenerAdapter
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ObjectAnimator
|
||||
import android.graphics.Bitmap
|
||||
@@ -185,17 +187,32 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
}
|
||||
}
|
||||
|
||||
/** Does not play any animation if user is not currently in split selection state. */
|
||||
fun playPlaceholderDismissAnim(launcher: Launcher) {
|
||||
if (!splitSelectStateController.isSplitSelectActive) {
|
||||
return
|
||||
}
|
||||
|
||||
fun animateAwayPlaceholder(mLauncher: Launcher) : AnimatorSet {
|
||||
val anim = createPlaceholderDismissAnim(launcher)
|
||||
anim.addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
splitSelectStateController.resetState()
|
||||
}
|
||||
})
|
||||
anim.start()
|
||||
}
|
||||
|
||||
/** Returns [AnimatorSet] which slides initial split placeholder view offscreen. */
|
||||
fun createPlaceholderDismissAnim(launcher: Launcher) : AnimatorSet {
|
||||
val animatorSet = AnimatorSet()
|
||||
val recentsView : RecentsView<*, *> = mLauncher.getOverviewPanel()
|
||||
val recentsView : RecentsView<*, *> = launcher.getOverviewPanel()
|
||||
val floatingTask: FloatingTaskView = splitSelectStateController.firstFloatingTaskView
|
||||
?: return animatorSet
|
||||
|
||||
// We are in split selection state currently, transitioning to another state
|
||||
val dragLayer: DragLayer = mLauncher.dragLayer
|
||||
val dragLayer: DragLayer = launcher.dragLayer
|
||||
val onScreenRectF = RectF()
|
||||
Utilities.getBoundsForViewInDragLayer(mLauncher.dragLayer, floatingTask,
|
||||
Utilities.getBoundsForViewInDragLayer(launcher.dragLayer, floatingTask,
|
||||
Rect(0, 0, floatingTask.width, floatingTask.height),
|
||||
false, null, onScreenRectF)
|
||||
// Get the part of the floatingTask that intersects with the DragLayer (i.e. the
|
||||
@@ -214,7 +231,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
floatingTask,
|
||||
onScreenRectF,
|
||||
floatingTask.stagePosition,
|
||||
mLauncher.deviceProfile
|
||||
launcher.deviceProfile
|
||||
)))
|
||||
return animatorSet
|
||||
}
|
||||
|
||||
@@ -86,6 +86,10 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
StateManager stateManager = mActivity.getStateManager();
|
||||
animated &= stateManager.shouldAnimateStateChange();
|
||||
stateManager.goToState(NORMAL, animated);
|
||||
if (FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
|
||||
mSplitSelectStateController.getSplitAnimationController()
|
||||
.playPlaceholderDismissAnim(mActivity);
|
||||
}
|
||||
AbstractFloatingView.closeAllOpenViews(mActivity, animated);
|
||||
}
|
||||
|
||||
|
||||
@@ -1693,6 +1693,9 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
if (mLauncherCallbacks != null) {
|
||||
mLauncherCallbacks.onHomeIntent(internalStateHandled);
|
||||
}
|
||||
if (FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
|
||||
handleSplitAnimationGoingToHome();
|
||||
}
|
||||
mOverlayManager.hideOverlay(isStarted() && !isForceInvisible());
|
||||
handleGestureContract(intent);
|
||||
} else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) {
|
||||
@@ -1706,6 +1709,11 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
TraceHelper.INSTANCE.endSection();
|
||||
}
|
||||
|
||||
/** Handle animating away split placeholder view when user taps on home button */
|
||||
protected void handleSplitAnimationGoingToHome() {
|
||||
// Overridden
|
||||
}
|
||||
|
||||
protected void toggleAllAppsFromIntent(boolean alreadyOnHome) {
|
||||
if (getStateManager().isInStableState(ALL_APPS)) {
|
||||
getStateManager().goToState(NORMAL, alreadyOnHome);
|
||||
|
||||
Reference in New Issue
Block a user