summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-10-26 17:59:53 -0700
committerChet Haase <chet@google.com>2012-10-29 14:07:33 -0700
commitbc2f082dac475eff7fc0e40f90eb6c0552511170 (patch)
tree19cf9f4964eba3cce70bb6cd3e874add84b6e690 /src
parentee4513920446ace2bc2659e3315f5b648ec1e313 (diff)
downloadandroid_packages_apps_Trebuchet-bc2f082dac475eff7fc0e40f90eb6c0552511170.tar.gz
android_packages_apps_Trebuchet-bc2f082dac475eff7fc0e40f90eb6c0552511170.tar.bz2
android_packages_apps_Trebuchet-bc2f082dac475eff7fc0e40f90eb6c0552511170.zip
Stop animating All Apps during transition to Home
One of the sources of jank in launcher is during the All Apps -> Home transition. specifically, if the user has started a fling operation (where we are animating between pages in All Apps) and then hits the Home button, we continue the fling animation while also doing the transition to Home scale/fade animations. This causes a lot of work for launcher, particularly because the fling animation is causing the All Apps layer to get recreated on every frame. The fix is to simply pause the fling animation, then snap to its end state when the animation to Home is complete. We also need to pause/snap the scroll indicator animation, because it's fading animation causes the same layer-recreation jank that the fling itself causes. Issue #7387124 Home <-> All Apps transition animation is janky while flinging Change-Id: Icbcaf2d5b3b2f6ce8fd7419419d258248aa1475b
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Launcher.java3
-rw-r--r--src/com/android/launcher2/PagedView.java23
2 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 56fdbb60c..b2fbb3e60 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2682,6 +2682,7 @@ public final class Launcher extends Activity
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionPrepare(toView, animated, true);
+ mAppsCustomizeContent.pauseScrolling();
mStateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
@@ -2696,6 +2697,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 9b973847c..81ce6ea23 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -181,6 +181,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;
@@ -304,6 +305,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) {
@@ -1743,7 +1762,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);
@@ -1768,7 +1787,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 {