From a35e35ae0ac2391b8928eb15bf91274aea96b115 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Thu, 26 Apr 2012 15:04:28 -0700 Subject: Solve blip the first time All Apps is launched --- .../android/launcher2/AppsCustomizePagedView.java | 10 +++++--- .../android/launcher2/AppsCustomizeTabHost.java | 7 ++++-- src/com/android/launcher2/Launcher.java | 27 ++++++++++++++++++---- src/com/android/launcher2/Workspace.java | 6 ++++- 4 files changed, 39 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 7b71ff47e..40bc2ca10 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -762,7 +762,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } @Override - public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { + public View getContent() { + return null; + } + + @Override + public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) { mInTransition = true; if (toWorkspace) { cancelAllTasks(); @@ -770,8 +775,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } @Override - public View getContent() { - return null; + public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { } @Override diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index 34b7c0923..01c08c916 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -376,8 +376,8 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona /* LauncherTransitionable overrides */ @Override - public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { - mAppsCustomizePane.onLauncherTransitionStart(l, animated, toWorkspace); + public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) { + mAppsCustomizePane.onLauncherTransitionPrepare(l, animated, toWorkspace); mInTransition = true; mTransitioningToWorkspace = toWorkspace; @@ -404,7 +404,10 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona mAppsCustomizePane.reset(); mResetAfterTransition = false; } + } + @Override + public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { if (animated) { enableAndBuildHardwareLayer(); } diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 7b9b36e87..648791d3c 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2166,6 +2166,12 @@ public final class Launcher extends Activity } } + private void dispatchOnLauncherTransitionPrepare(View v, boolean animated, boolean toWorkspace) { + if (v instanceof LauncherTransitionable) { + ((LauncherTransitionable) v).onLauncherTransitionPrepare(this, animated, toWorkspace); + } + } + private void dispatchOnLauncherTransitionStart(View v, boolean animated, boolean toWorkspace) { if (v instanceof LauncherTransitionable) { ((LauncherTransitionable) v).onLauncherTransitionStart(this, animated, toWorkspace); @@ -2246,7 +2252,7 @@ public final class Launcher extends Activity final int fadeDuration = res.getInteger(R.integer.config_appsCustomizeFadeInTime); final float scale = (float) res.getInteger(R.integer.config_appsCustomizeZoomScaleFactor); final View fromView = mWorkspace; - final View toView = mAppsCustomizeTabHost; + final AppsCustomizeTabHost toView = mAppsCustomizeTabHost; final int startDelay = res.getInteger(R.integer.config_workspaceAppsCustomizeAnimationStagger); @@ -2326,8 +2332,8 @@ public final class Launcher extends Activity boolean delayAnim = false; final ViewTreeObserver observer; - dispatchOnLauncherTransitionStart(fromView, animated, false); - dispatchOnLauncherTransitionStart(toView, animated, false); + dispatchOnLauncherTransitionPrepare(fromView, animated, false); + dispatchOnLauncherTransitionPrepare(toView, animated, false); // If any of the objects being animated haven't been measured/laid out // yet, delay the animation until we get a layout pass @@ -2351,6 +2357,8 @@ public final class Launcher extends Activity if (mStateAnimation == stateAnimation) { // Need to update pivots for zoom if layout changed setPivotsForZoom(toView, scale); + dispatchOnLauncherTransitionStart(fromView, animated, false); + dispatchOnLauncherTransitionStart(toView, animated, false); mStateAnimation.start(); } } @@ -2361,6 +2369,8 @@ public final class Launcher extends Activity observer.addOnGlobalLayoutListener(delayedStart); } else { setPivotsForZoom(toView, scale); + dispatchOnLauncherTransitionStart(fromView, animated, false); + dispatchOnLauncherTransitionStart(toView, animated, false); mStateAnimation.start(); } } else { @@ -2376,8 +2386,10 @@ public final class Launcher extends Activity mWorkspace.hideScrollingIndicator(true); hideDockDivider(); } + dispatchOnLauncherTransitionPrepare(fromView, animated, false); dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionEnd(fromView, animated, false); + dispatchOnLauncherTransitionPrepare(toView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); updateWallpaperVisibility(false); @@ -2442,8 +2454,8 @@ public final class Launcher extends Activity mStateAnimation = new AnimatorSet(); - dispatchOnLauncherTransitionStart(fromView, animated, true); - dispatchOnLauncherTransitionStart(toView, animated, true); + dispatchOnLauncherTransitionPrepare(fromView, animated, true); + dispatchOnLauncherTransitionPrepare(toView, animated, true); mStateAnimation.addListener(new AnimatorListenerAdapter() { @Override @@ -2465,11 +2477,15 @@ public final class Launcher extends Activity if (workspaceAnim != null) { mStateAnimation.play(workspaceAnim); } + dispatchOnLauncherTransitionStart(fromView, animated, true); + dispatchOnLauncherTransitionStart(toView, animated, true); mStateAnimation.start(); } else { fromView.setVisibility(View.GONE); + dispatchOnLauncherTransitionPrepare(fromView, animated, true); dispatchOnLauncherTransitionStart(fromView, animated, true); dispatchOnLauncherTransitionEnd(fromView, animated, true); + dispatchOnLauncherTransitionPrepare(toView, animated, true); dispatchOnLauncherTransitionStart(toView, animated, true); dispatchOnLauncherTransitionEnd(toView, animated, true); mWorkspace.hideScrollingIndicator(false); @@ -3457,6 +3473,7 @@ public final class Launcher extends Activity interface LauncherTransitionable { View getContent(); + void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace); void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace); void onLauncherTransitionStep(Launcher l, float t); void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 8be002c97..29aea6f4b 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1745,11 +1745,15 @@ public class Workspace extends SmoothPagedView } @Override - public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { + public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) { mIsSwitchingState = true; cancelScrollingIndicatorAnimations(); } + @Override + public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { + } + @Override public void onLauncherTransitionStep(Launcher l, float t) { mTransitionProgress = t; -- cgit v1.2.3