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
This commit is contained in:
@@ -2,13 +2,13 @@ package com.android.launcher3.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.android.launcher3.AppInfo;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.WorkspaceItemInfo;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -43,7 +43,7 @@ public class CacheDataUpdatedTaskTest extends BaseModelUpdateTaskTestCase {
|
||||
public void testCacheUpdate_update_apps() throws Exception {
|
||||
// Clear all icons from apps list so that its easy to check what was updated
|
||||
for (AppInfo info : allAppsList.data) {
|
||||
info.iconBitmap = null;
|
||||
info.bitmap = BitmapInfo.LOW_RES_INFO;
|
||||
}
|
||||
|
||||
executeTaskForTest(newTask(CacheDataUpdatedTask.OP_CACHE_UPDATE, "app1"));
|
||||
@@ -56,9 +56,9 @@ public class CacheDataUpdatedTaskTest extends BaseModelUpdateTaskTestCase {
|
||||
assertFalse(allAppsList.data.isEmpty());
|
||||
for (AppInfo info : allAppsList.data) {
|
||||
if (info.componentName.getPackageName().equals("app1")) {
|
||||
assertNotNull(info.iconBitmap);
|
||||
assertFalse(info.bitmap.isNullOrLowRes());
|
||||
} else {
|
||||
assertNull(info.iconBitmap);
|
||||
assertTrue(info.bitmap.isNullOrLowRes());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,10 +85,10 @@ public class CacheDataUpdatedTaskTest extends BaseModelUpdateTaskTestCase {
|
||||
for (ItemInfo info : bgDataModel.itemsIdMap) {
|
||||
if (updates.contains(info.id)) {
|
||||
assertEquals(NEW_LABEL_PREFIX + info.id, info.title);
|
||||
assertNotNull(((WorkspaceItemInfo) info).iconBitmap);
|
||||
assertFalse(((WorkspaceItemInfo) info).bitmap.isNullOrLowRes());
|
||||
} else {
|
||||
assertNotSame(NEW_LABEL_PREFIX + info.id, info.title);
|
||||
assertNull(((WorkspaceItemInfo) info).iconBitmap);
|
||||
assertTrue(((WorkspaceItemInfo) info).bitmap.isNullOrLowRes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user