improving performance of first AllApps/Customize animation

Change-Id: I71e5cc634f7e1346617d101efd6945c00484cab3
This commit is contained in:
Michael Jurka committed 2011-03-07 15:20:51 -08:00
1 parent 320b2fb5ef
commit abded66084
8 files changed
+123 -39

No files matched your search

@@ -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 onLauncherAnimationEnd() {
setLayerType(LAYER_TYPE_NONE, null);
public void onLauncherTransitionEnd(Animator animation) {
if (animation != null) {
setLayerType(LAYER_TYPE_NONE, null);
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
mFirstLayout = false;
super.onLayout(changed, l, t, r, b);
}
}