am bc85f483: am 2f1ac9eb: am 36095e86: Merge "Stop animating All Apps during transition to Home" into jb-mr1-dev

* commit 'bc85f483014bc24471b68867ecfed2a4aa5c0b15':
  Stop animating All Apps during transition to Home
This commit is contained in:
Chet Haase 2012-10-30 10:10:05 -07:00 committed by Android Git Automerger
commit a899936005
2 changed files with 24 additions and 2 deletions

View File

@ -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();
}
});

View File

@ -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;
@ -304,6 +305,24 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
mScroller.forceFinished(true);
}
/**
* 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.
*/
@ -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 {