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/PagedViewCellLayout.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/PagedViewCellLayout.java')
-rw-r--r-- | src/com/android/launcher2/PagedViewCellLayout.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java index 57d41faff..28bb78b9a 100644 --- a/src/com/android/launcher2/PagedViewCellLayout.java +++ b/src/com/android/launcher2/PagedViewCellLayout.java @@ -40,7 +40,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page { private static int sDefaultCellDimensions = 96; protected PagedViewCellLayoutChildren mChildren; private PagedViewCellLayoutChildren mHolographicChildren; - private boolean mUseHardwareLayers = false; + private boolean mAllowHardwareLayerCreation = false; + private boolean mCreateHardwareLayersIfAllowed = false; public PagedViewCellLayout(Context context) { this(context, null); @@ -74,8 +75,17 @@ public class PagedViewCellLayout extends ViewGroup implements Page { addView(mHolographicChildren); } - public void enableHardwareLayers() { - mUseHardwareLayers = true; + public void allowHardwareLayerCreation() { + // This is called after the first time we launch into All Apps. Before that point, + // there's no need for hardware layers here since there's a hardware layer set on the + // parent, AllAppsTabbed, during the AllApps transition -- creating hardware layers here + // before the animation is done slows down the animation + if (!mAllowHardwareLayerCreation) { + mAllowHardwareLayerCreation = true; + if (mCreateHardwareLayersIfAllowed) { + createHardwareLayers(); + } + } } @Override @@ -85,13 +95,18 @@ public class PagedViewCellLayout extends ViewGroup implements Page { } void destroyHardwareLayers() { - if (mUseHardwareLayers) { + // called when a page is no longer visible (triggered by loadAssociatedPages -> + // removeAllViewsOnPage) + mCreateHardwareLayersIfAllowed = false; + if (mAllowHardwareLayerCreation) { mChildren.destroyHardwareLayer(); mHolographicChildren.destroyHardwareLayer(); } } void createHardwareLayers() { - if (mUseHardwareLayers) { + // called when a page is visible (triggered by loadAssociatedPages -> syncPageItems) + mCreateHardwareLayersIfAllowed = true; + if (mAllowHardwareLayerCreation) { mChildren.createHardwareLayer(); mHolographicChildren.createHardwareLayer(); } @@ -127,7 +142,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page { if (child instanceof PagedViewIcon) { PagedViewIcon pagedViewIcon = (PagedViewIcon) child; - if (mUseHardwareLayers) { + if (mAllowHardwareLayerCreation) { pagedViewIcon.disableCache(); } mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(), index, lp); |