Various cleanups in the drag viz code.
Most importantly:
- Don't allocate a new Paint object in CellLayout.onDraw
- Scale holographic outlines based on the screen density
diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java
index ca08378..8a18317 100644
--- a/src/com/android/launcher2/LauncherApplication.java
+++ b/src/com/android/launcher2/LauncherApplication.java
@@ -29,6 +29,7 @@
public LauncherModel mModel;
public IconCache mIconCache;
private static boolean sIsScreenXLarge;
+ private static float sScreenDensity;
private static final boolean ENABLE_ROTATION = false;
@Override
@@ -40,6 +41,7 @@
mIconCache = new IconCache(this);
mModel = new LauncherModel(this, mIconCache);
sIsScreenXLarge = (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
+ sScreenDensity = getResources().getDisplayMetrics().density;
// Register intent receivers
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
@@ -101,4 +103,8 @@
public static boolean isScreenXLarge() {
return sIsScreenXLarge;
}
+
+ public static float getScreenDensity() {
+ return sScreenDensity;
+ }
}