Storing BitmapInfo instead of icon and color directly in itemInfo
This will allow subclassing BitmapInfo to support custom icon/dynamic
icons which can be loaded on the background thread instead of going
through IconFactory which runs on UiThread
Change-Id: Ieced6e91330bdff1b505826d097a8df711dfe967
diff --git a/src/com/android/launcher3/ItemInfoWithIcon.java b/src/com/android/launcher3/ItemInfoWithIcon.java
index 1550bb0..1941455 100644
--- a/src/com/android/launcher3/ItemInfoWithIcon.java
+++ b/src/com/android/launcher3/ItemInfoWithIcon.java
@@ -16,10 +16,6 @@
package com.android.launcher3;
-import static com.android.launcher3.icons.BitmapInfo.LOW_RES_ICON;
-
-import android.graphics.Bitmap;
-
import com.android.launcher3.icons.BitmapInfo;
/**
@@ -30,14 +26,9 @@
public static final String TAG = "ItemInfoDebug";
/**
- * A bitmap version of the application icon.
+ * The bitmap for the application icon
*/
- public Bitmap iconBitmap;
-
- /**
- * Dominant color in the {@link #iconBitmap}.
- */
- public int iconColor;
+ public BitmapInfo bitmap = BitmapInfo.LOW_RES_INFO;
/**
* Indicates that the icon is disabled due to safe mode restrictions.
@@ -106,8 +97,7 @@
protected ItemInfoWithIcon(ItemInfoWithIcon info) {
super(info);
- iconBitmap = info.iconBitmap;
- iconColor = info.iconColor;
+ bitmap = info.bitmap;
runtimeStatusFlags = info.runtimeStatusFlags;
}
@@ -120,12 +110,7 @@
* Indicates whether we're using a low res icon
*/
public boolean usingLowResIcon() {
- return iconBitmap == LOW_RES_ICON;
- }
-
- public void applyFrom(BitmapInfo info) {
- iconBitmap = info.icon;
- iconColor = info.color;
+ return bitmap.isLowRes();
}
/**