Make HolographicOutlineHelper a singleton.
It's a pretty heavy object, including three Paints at 74
bytes apiece, and we allocate one for every workspace and
every icon. We really only need one.
Change-Id: Ic9e12d478c3be27b13133718875c91540f7ccf4c
diff --git a/src/com/android/launcher3/HolographicOutlineHelper.java b/src/com/android/launcher3/HolographicOutlineHelper.java
index 0344cd5..47c40b6 100644
--- a/src/com/android/launcher3/HolographicOutlineHelper.java
+++ b/src/com/android/launcher3/HolographicOutlineHelper.java
@@ -43,6 +43,8 @@
private static final int MEDIUM = 1;
private static final int EXTRA_THICK = 2;
+ static HolographicOutlineHelper INSTANCE;
+
static {
final float scale = LauncherAppState.getScreenDensity();
@@ -56,9 +58,11 @@
sExtraThickInnerBlurMaskFilter = new BlurMaskFilter(scale * 6.0f, BlurMaskFilter.Blur.NORMAL);
sThickInnerBlurMaskFilter = new BlurMaskFilter(scale * 4.0f, BlurMaskFilter.Blur.NORMAL);
sMediumInnerBlurMaskFilter = new BlurMaskFilter(scale * 2.0f, BlurMaskFilter.Blur.NORMAL);
+
+ INSTANCE = new HolographicOutlineHelper();
}
- HolographicOutlineHelper() {
+ private HolographicOutlineHelper() {
mHolographicPaint.setFilterBitmap(true);
mHolographicPaint.setAntiAlias(true);
mBlurPaint.setFilterBitmap(true);
@@ -68,6 +72,10 @@
mErasePaint.setAntiAlias(true);
}
+ public static HolographicOutlineHelper obtain() {
+ return INSTANCE;
+ }
+
/**
* Returns the interpolated holographic highlight alpha for the effect we want when scrolling
* pages.