mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
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)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user