public boolean showWorkspace(boolean animated, Runnable onCompleteRunnable) {
boolean changed = mState != State.WORKSPACE ||
mWorkspace.getState() != Workspace.State.NORMAL;
- if (changed) {
+ if (changed || mAllAppsController.isTransitioning()) {
mWorkspace.setVisibility(View.VISIBLE);
mStateTransitionAnimation.startAnimationToWorkspace(mState, mWorkspace.getState(),
Workspace.State.NORMAL, animated, onCompleteRunnable);
// TODO: calling method should use the return value so that when {@code false} is returned
// the workspace transition doesn't fall into invalid state.
private boolean showAppsOrWidgets(State toState, boolean animated, boolean focusSearchBar) {
- if (mState != State.WORKSPACE && mState != State.APPS_SPRING_LOADED &&
- mState != State.WIDGETS_SPRING_LOADED) {
+ if (!(mState == State.WORKSPACE ||
+ mState == State.APPS_SPRING_LOADED ||
+ mState == State.WIDGETS_SPRING_LOADED ||
+ (mState == State.APPS && mAllAppsController.isTransitioning()))) {
return false;
}
if (toState != State.APPS && toState != State.WIDGETS) {
Log.e(TAG, "Unexpected call to startAnimationToWorkspace");
}
- if (fromState == Launcher.State.APPS || fromState == Launcher.State.APPS_SPRING_LOADED) {
+ if (fromState == Launcher.State.APPS || fromState == Launcher.State.APPS_SPRING_LOADED
+ || mAllAppsController.isTransitioning()) {
int animType = CIRCULAR_REVEAL;
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
animType = PULLUP;
pCb.onTransitionComplete();
}
});
- mAllAppsController.animateToAllApps(animation, revealDuration, false);
+ mAllAppsController.animateToAllApps(animation, revealDuration);
dispatchOnLauncherTransitionPrepare(fromView, animated, false);
dispatchOnLauncherTransitionPrepare(toView, animated, false);
@Override
public void onAnimationEnd(Animator animation) {
if (canceled) return;
- dispatchOnLauncherTransitionEnd(fromView, animated, false);
- dispatchOnLauncherTransitionEnd(toView, animated, false);
-
+ dispatchOnLauncherTransitionEnd(fromView, animated, true);
+ dispatchOnLauncherTransitionEnd(toView, animated, true);
// Run any queued runnables
if (onCompleteRunnable != null) {
onCompleteRunnable.run();
}
});
- mAllAppsController.animateToWorkspace(animation, revealDuration, false);
+ mAllAppsController.animateToWorkspace(animation, revealDuration);
// Dispatch the prepare transition signal
dispatchOnLauncherTransitionPrepare(fromView, animated, multiplePagesVisible);
if (mDetector.isSettlingState() && (isInDisallowRecatchBottomZone() || isInDisallowRecatchTopZone())) {
return false;
}
- return mDetector.shouldIntercept();
+ return mDetector.isDraggingOrSettling();
}
private boolean shouldPossiblyIntercept(MotionEvent ev) {
LauncherLogProto.Action.FLING,
LauncherLogProto.Action.UP,
LauncherLogProto.HOTSEAT);
- mLauncher.showAppsView(true, true, false, false);
- } else {
- animateToAllApps(mCurrentAnimation, mAnimationDuration, true);
}
+ mLauncher.showAppsView(true, true, false, false);
} else {
calculateDuration(velocity, Math.abs(mShiftRange - mAppsView.getTranslationY()));
- if (mLauncher.isAllAppsVisible()) {
- mLauncher.showWorkspace(true);
- } else {
- animateToWorkspace(mCurrentAnimation, mAnimationDuration, true);
- }
+ mLauncher.showWorkspace(true);
}
// snap to top or bottom using the release velocity
} else {
if (mAppsView.getTranslationY() > mShiftRange / 2) {
calculateDuration(velocity, Math.abs(mShiftRange - mAppsView.getTranslationY()));
- if (mLauncher.isAllAppsVisible()) {
- mLauncher.showWorkspace(true);
- } else {
- animateToWorkspace(mCurrentAnimation, mAnimationDuration, true);
- }
+ mLauncher.showWorkspace(true);
} else {
calculateDuration(velocity, Math.abs(mAppsView.getTranslationY()));
if (!mLauncher.isAllAppsVisible()) {
LauncherLogProto.Action.SWIPE,
LauncherLogProto.Action.UP,
LauncherLogProto.HOTSEAT);
- mLauncher.showAppsView(true, true, false, false);
- } else {
- animateToAllApps(mCurrentAnimation, mAnimationDuration, true);
}
-
+ mLauncher.showAppsView(true, true, false, false);
}
}
}
+ public boolean isTransitioning() {
+ return mDetector.isDraggingOrSettling();
+ }
/**
* @param start {@code true} if start of new drag.
*/
}
}
- public void animateToAllApps(AnimatorSet animationOut, long duration, boolean start) {
+ public void animateToAllApps(AnimatorSet animationOut, long duration) {
if (animationOut == null) {
return;
}
}
});
mCurrentAnimation = animationOut;
- if (start) {
- mCurrentAnimation.start();
- }
}
public void showDiscoveryBounce() {
});
}
- public void animateToWorkspace(AnimatorSet animationOut, long duration, boolean start) {
+ public void animateToWorkspace(AnimatorSet animationOut, long duration) {
if (animationOut == null) {
return;
}
}
});
mCurrentAnimation = animationOut;
- if (start) {
- mCurrentAnimation.start();
- }
}
public void finishPullUp() {