summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2016-07-27 10:55:51 -0700
committerHyunyoung Song <hyunyoungs@google.com>2016-07-27 10:55:51 -0700
commit9dcf0a3ef7595f58aedec7773e7bc3b9075fb3ca (patch)
tree1090de98d9913bcca8c7eae3eeeb7d41873f93f2 /src
parent10717bfcae5fc6d34818f09d4f2ce584222cdba0 (diff)
downloadandroid_packages_apps_Trebuchet-9dcf0a3ef7595f58aedec7773e7bc3b9075fb3ca.tar.gz
android_packages_apps_Trebuchet-9dcf0a3ef7595f58aedec7773e7bc3b9075fb3ca.tar.bz2
android_packages_apps_Trebuchet-9dcf0a3ef7595f58aedec7773e7bc3b9075fb3ca.zip
AllAppsTransitionController always use LauncherStateTransitionAnimation
b/30375760 Change-Id: Iee2f8060e4d272d276ddd5d40b4bc6053e8c7778
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Launcher.java8
-rw-r--r--src/com/android/launcher3/LauncherStateTransitionAnimation.java12
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java36
-rw-r--r--src/com/android/launcher3/allapps/VerticalPullDetector.java2
4 files changed, 22 insertions, 36 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index f8b7c7421..deac73be8 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3296,7 +3296,7 @@ public class Launcher extends Activity
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);
@@ -3393,8 +3393,10 @@ public class Launcher extends Activity
// 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) {
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index 1fe0813e1..9cb842742 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -207,7 +207,8 @@ public class LauncherStateTransitionAnimation {
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;
@@ -434,7 +435,7 @@ public class LauncherStateTransitionAnimation {
pCb.onTransitionComplete();
}
});
- mAllAppsController.animateToAllApps(animation, revealDuration, false);
+ mAllAppsController.animateToAllApps(animation, revealDuration);
dispatchOnLauncherTransitionPrepare(fromView, animated, false);
dispatchOnLauncherTransitionPrepare(toView, animated, false);
@@ -898,9 +899,8 @@ public class LauncherStateTransitionAnimation {
@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();
@@ -918,7 +918,7 @@ public class LauncherStateTransitionAnimation {
}
});
- mAllAppsController.animateToWorkspace(animation, revealDuration, false);
+ mAllAppsController.animateToWorkspace(animation, revealDuration);
// Dispatch the prepare transition signal
dispatchOnLauncherTransitionPrepare(fromView, animated, multiplePagesVisible);
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 78280f724..cff77d3e1 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -153,7 +153,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
if (mDetector.isSettlingState() && (isInDisallowRecatchBottomZone() || isInDisallowRecatchTopZone())) {
return false;
}
- return mDetector.shouldIntercept();
+ return mDetector.isDraggingOrSettling();
}
private boolean shouldPossiblyIntercept(MotionEvent ev) {
@@ -222,27 +222,17 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
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()) {
@@ -250,15 +240,15 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
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.
*/
@@ -354,7 +344,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
}
}
- public void animateToAllApps(AnimatorSet animationOut, long duration, boolean start) {
+ public void animateToAllApps(AnimatorSet animationOut, long duration) {
if (animationOut == null) {
return;
}
@@ -390,9 +380,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
}
});
mCurrentAnimation = animationOut;
- if (start) {
- mCurrentAnimation.start();
- }
}
public void showDiscoveryBounce() {
@@ -425,7 +412,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
});
}
- public void animateToWorkspace(AnimatorSet animationOut, long duration, boolean start) {
+ public void animateToWorkspace(AnimatorSet animationOut, long duration) {
if (animationOut == null) {
return;
}
@@ -462,9 +449,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
}
});
mCurrentAnimation = animationOut;
- if (start) {
- mCurrentAnimation.start();
- }
}
public void finishPullUp() {
diff --git a/src/com/android/launcher3/allapps/VerticalPullDetector.java b/src/com/android/launcher3/allapps/VerticalPullDetector.java
index 0e8ba7f84..8bb845aa6 100644
--- a/src/com/android/launcher3/allapps/VerticalPullDetector.java
+++ b/src/com/android/launcher3/allapps/VerticalPullDetector.java
@@ -72,7 +72,7 @@ public class VerticalPullDetector {
mState = newState;
}
- public boolean shouldIntercept() {
+ public boolean isDraggingOrSettling() {
return mState == ScrollState.DRAGGING || mState == ScrollState.SETTLING;
}