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/AllAppsTabbed.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/AllAppsTabbed.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsTabbed.java | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index 66191503c..aa828b049 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -41,7 +41,7 @@ import java.util.ArrayList; /** * Implements a tabbed version of AllApps2D. */ -public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherAnimatable { +public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTransitionable { private static final String TAG = "Launcher.AllAppsTabbed"; @@ -172,21 +172,36 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherAnima } @Override - public void onLauncherAnimationStart() { - // Turn on hardware layers for performance - setLayerType(LAYER_TYPE_HARDWARE, null); - // Re-enable the rendering of the dimmed background in All Apps for performance reasons - mLauncher.getWorkspace().disableBackground(); - mBackground.setVisibility(VISIBLE); + public void onLauncherTransitionStart(Animator animation) { + if (animation != null) { + // Turn on hardware layers for performance + setLayerType(LAYER_TYPE_HARDWARE, null); + // Re-enable the rendering of the dimmed background in All Apps for performance reasons + mLauncher.getWorkspace().disableBackground(); + mBackground.setVisibility(VISIBLE); + // 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); + // To improve the performance of the first time All Apps is run, we initially keep + // hardware layers in AllAppsPagedView disabled since AllAppsTabbed itself is drawn in a + // hardware layer, and creating additional hardware layers slows down the animation. We + // create them here, after the animation is over. + } // Move the rendering of the dimmed background to workspace after the all apps animation // is done, so that the background is not rendered *above* the mini workspace screens mLauncher.getWorkspace().enableBackground(); mBackground.setVisibility(GONE); + mAllApps.allowHardwareLayerCreation(); } @Override |