diff options
author | Michael Jurka <mikejurka@google.com> | 2011-03-04 12:06:57 -0800 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-03-07 15:20:51 -0800 |
commit | abded66084680bb31cc7ea403c88f44f79a3c884 (patch) | |
tree | e1a64c9a31caf280e011ed12b9b8ade54a080c47 /src/com/android/launcher2/CustomizeTrayTabHost.java | |
parent | 320b2fb5eff8750d07dc9b4874c2ec0b92a601b8 (diff) | |
download | android_packages_apps_Trebuchet-abded66084680bb31cc7ea403c88f44f79a3c884.tar.gz android_packages_apps_Trebuchet-abded66084680bb31cc7ea403c88f44f79a3c884.tar.bz2 android_packages_apps_Trebuchet-abded66084680bb31cc7ea403c88f44f79a3c884.zip |
improving performance of first AllApps/Customize animation
Change-Id: I71e5cc634f7e1346617d101efd6945c00484cab3
Diffstat (limited to 'src/com/android/launcher2/CustomizeTrayTabHost.java')
-rw-r--r-- | src/com/android/launcher2/CustomizeTrayTabHost.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/com/android/launcher2/CustomizeTrayTabHost.java b/src/com/android/launcher2/CustomizeTrayTabHost.java index 502917211..76cfc84e8 100644 --- a/src/com/android/launcher2/CustomizeTrayTabHost.java +++ b/src/com/android/launcher2/CustomizeTrayTabHost.java @@ -16,11 +16,14 @@ package com.android.launcher2; +import android.animation.Animator; import android.content.Context; import android.util.AttributeSet; import android.widget.TabHost; -public class CustomizeTrayTabHost extends TabHost implements LauncherAnimatable { +public class CustomizeTrayTabHost extends TabHost implements LauncherTransitionable { + private boolean mFirstLayout = true; + public CustomizeTrayTabHost(Context context) { super(context); } @@ -30,12 +33,28 @@ public class CustomizeTrayTabHost extends TabHost implements LauncherAnimatable } @Override - public void onLauncherAnimationStart() { - setLayerType(LAYER_TYPE_HARDWARE, null); + public void onLauncherTransitionStart(Animator animation) { + if (animation != null) { + setLayerType(LAYER_TYPE_HARDWARE, null); + // just a sanity check that we don't build a layer before a call to onLayout + if (!mFirstLayout) { + // force building the layer at the beginning of the animation, so you don't get a + // blip early in the animation + buildLayer(); + } + } + } + + @Override + public void onLauncherTransitionEnd(Animator animation) { + if (animation != null) { + setLayerType(LAYER_TYPE_NONE, null); + } } @Override - public void onLauncherAnimationEnd() { - setLayerType(LAYER_TYPE_NONE, null); + protected void onLayout(boolean changed, int l, int t, int r, int b) { + mFirstLayout = false; + super.onLayout(changed, l, t, r, b); } } |