diff options
author | Michael Jurka <mikejurka@google.com> | 2011-02-03 16:47:14 -0800 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-02-03 16:56:22 -0800 |
commit | c0759f5090d9539d82ddc944b9f2da767c36b251 (patch) | |
tree | 5c11a5b291c2e85a558e4aa33a425a1d3a94412a /src/com/android/launcher2/PagedViewCellLayout.java | |
parent | 7924f2592fefbb9bee279bcb7c2bf46b0009023d (diff) | |
download | android_packages_apps_Trebuchet-c0759f5090d9539d82ddc944b9f2da767c36b251.tar.gz android_packages_apps_Trebuchet-c0759f5090d9539d82ddc944b9f2da767c36b251.tar.bz2 android_packages_apps_Trebuchet-c0759f5090d9539d82ddc944b9f2da767c36b251.zip |
Reducing memory impact of hardware layers in Launcher
- Disabling hardware layers in customize tray
- Destroying hardware layers for pages in All Apps that are not visible
- Re-adding CachedTextView for icons in customize tray (to regain some of the lost performance there)
Diffstat (limited to 'src/com/android/launcher2/PagedViewCellLayout.java')
-rw-r--r-- | src/com/android/launcher2/PagedViewCellLayout.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java index 6d1fb55dc..d64f3c901 100644 --- a/src/com/android/launcher2/PagedViewCellLayout.java +++ b/src/com/android/launcher2/PagedViewCellLayout.java @@ -40,6 +40,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page { private static int sDefaultCellDimensions = 96; protected PagedViewCellLayoutChildren mChildren; private PagedViewCellLayoutChildren mHolographicChildren; + private boolean mUseHardwareLayers = false; public PagedViewCellLayout(Context context) { this(context, null); @@ -73,12 +74,29 @@ public class PagedViewCellLayout extends ViewGroup implements Page { addView(mHolographicChildren); } + public void enableHardwareLayers() { + mUseHardwareLayers = true; + } + @Override public void setAlpha(float alpha) { mChildren.setAlpha(alpha); mHolographicChildren.setAlpha(1.0f - alpha); } + void destroyHardwareLayers() { + if (mUseHardwareLayers) { + mChildren.destroyHardwareLayer(); + mHolographicChildren.destroyHardwareLayer(); + } + } + void createHardwareLayers() { + if (mUseHardwareLayers) { + mChildren.createHardwareLayer(); + mHolographicChildren.createHardwareLayer(); + } + } + @Override public void cancelLongPress() { super.cancelLongPress(); @@ -109,6 +127,9 @@ public class PagedViewCellLayout extends ViewGroup implements Page { if (child instanceof PagedViewIcon) { PagedViewIcon pagedViewIcon = (PagedViewIcon) child; + if (mUseHardwareLayers) { + pagedViewIcon.disableCache(); + } mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(), index, lp); } return true; |