diff options
author | Chet Haase <chet@google.com> | 2012-10-29 14:24:08 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-29 14:24:08 -0700 |
commit | 36095e861b8aba1069cf1e28c89de8f3f299114a (patch) | |
tree | 8fbf7aba2a4bef05792cde43fdc9b5f3b312a331 /src/com | |
parent | e57e793bbdc6c51ba13481f82ff17a2f3e6910c5 (diff) | |
parent | bc2f082dac475eff7fc0e40f90eb6c0552511170 (diff) | |
download | packages_apps_trebuchet-36095e861b8aba1069cf1e28c89de8f3f299114a.zip packages_apps_trebuchet-36095e861b8aba1069cf1e28c89de8f3f299114a.tar.gz packages_apps_trebuchet-36095e861b8aba1069cf1e28c89de8f3f299114a.tar.bz2 |
Merge "Stop animating All Apps during transition to Home" into jb-mr1-dev
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 23 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 0225d28..c221815 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2697,6 +2697,7 @@ public final class Launcher extends Activity dispatchOnLauncherTransitionPrepare(fromView, animated, true); dispatchOnLauncherTransitionPrepare(toView, animated, true); + mAppsCustomizeContent.pauseScrolling(); mStateAnimation.addListener(new AnimatorListenerAdapter() { @Override @@ -2711,6 +2712,8 @@ public final class Launcher extends Activity if (onCompleteRunnable != null) { onCompleteRunnable.run(); } + mAppsCustomizeContent.updateCurrentPageScroll(); + mAppsCustomizeContent.resumeScrolling(); } }); diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 2fc788b..2cb943d 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -182,6 +182,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected static final int sScrollIndicatorFadeInDuration = 150; protected static final int sScrollIndicatorFadeOutDuration = 650; protected static final int sScrollIndicatorFlashDuration = 650; + private boolean mScrollingPaused = false; // If set, will defer loading associated pages until the scrolling settles private boolean mDeferLoadAssociatedPagesUntilScrollCompletes; @@ -305,6 +306,24 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } /** + * Called during AllApps/Home transitions to avoid unnecessary work. When that other animation + * ends, {@link #resumeScrolling()} should be called, along with + * {@link #updateCurrentPageScroll()} to correctly set the final state and re-enable scrolling. + */ + void pauseScrolling() { + mScroller.forceFinished(true); + cancelScrollingIndicatorAnimations(); + mScrollingPaused = true; + } + + /** + * Enables scrolling again. + * @see #pauseScrolling() + */ + void resumeScrolling() { + mScrollingPaused = false; + } + /** * Sets the current page. */ void setCurrentPage(int currentPage) { @@ -1745,7 +1764,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc updateScrollingIndicatorPosition(); mScrollIndicator.setVisibility(View.VISIBLE); cancelScrollingIndicatorAnimations(); - if (immediately) { + if (immediately || mScrollingPaused) { mScrollIndicator.setAlpha(1f); } else { mScrollIndicatorAnimator = LauncherAnimUtils.ofFloat(mScrollIndicator, "alpha", 1f); @@ -1770,7 +1789,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc // Fade the indicator out updateScrollingIndicatorPosition(); cancelScrollingIndicatorAnimations(); - if (immediately) { + if (immediately || mScrollingPaused) { mScrollIndicator.setVisibility(View.INVISIBLE); mScrollIndicator.setAlpha(0f); } else { |