Merge "Add grid icon for wallpaper picker" into main
diff --git a/src/com/android/customization/model/grid/GridOption.java b/src/com/android/customization/model/grid/GridOption.java
index b350351..1218a19 100644
--- a/src/com/android/customization/model/grid/GridOption.java
+++ b/src/com/android/customization/model/grid/GridOption.java
@@ -48,6 +48,7 @@
private final GridTileDrawable mTileDrawable;
public final String title;
public final String name;
+ public final int gridIconId;
public final int rows;
public final int cols;
public final Uri previewImageUri;
@@ -55,12 +56,13 @@
private boolean mIsCurrent;
public GridOption(String title, String name, boolean isCurrent, int rows, int cols,
- Uri previewImageUri, int previewPagesCount, String iconShapePath) {
+ Uri previewImageUri, int previewPagesCount, String iconShapePath, int gridIconId) {
this.title = title;
mIsCurrent = isCurrent;
mIconShapePath = iconShapePath;
mTileDrawable = new GridTileDrawable(rows, cols, mIconShapePath);
this.name = name;
+ this.gridIconId = gridIconId;
this.rows = rows;
this.cols = cols;
this.previewImageUri = previewImageUri;
@@ -76,6 +78,7 @@
mIsCurrent = in.readByte() != 0;
mIconShapePath = in.readString();
name = in.readString();
+ gridIconId = in.readInt();
rows = in.readInt();
cols = in.readInt();
previewImageUri = in.readParcelable(Uri.class.getClassLoader());
diff --git a/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java b/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java
index f08acc9..6c90e16 100644
--- a/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java
+++ b/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java
@@ -48,6 +48,7 @@
private static final String COL_NAME = "name";
private static final String COL_GRID_TITLE = "grid_title";
+ private static final String COL_GRID_ICON_ID = "grid_icon_id";
private static final String COL_ROWS = "rows";
private static final String COL_COLS = "cols";
private static final String COL_PREVIEW_COUNT = "preview_count";
@@ -93,7 +94,7 @@
while(c.moveToNext()) {
String name = c.getString(c.getColumnIndex(COL_NAME));
String title = c.getString(c.getColumnIndex(COL_GRID_TITLE));
-
+ int gridIconId = c.getInt(c.getColumnIndex(COL_GRID_ICON_ID));
int rows = c.getInt(c.getColumnIndex(COL_ROWS));
int cols = c.getInt(c.getColumnIndex(COL_COLS));
int previewCount = c.getInt(c.getColumnIndex(COL_PREVIEW_COUNT));
@@ -102,7 +103,7 @@
title = mContext.getString(R.string.grid_title_pattern, cols, rows);
}
mOptions.add(new GridOption(title, name, isSet, rows, cols,
- mPreviewUtils.getUri(PREVIEW), previewCount, iconPath));
+ mPreviewUtils.getUri(PREVIEW), previewCount, iconPath, gridIconId));
}
} catch (Exception e) {
mOptions = null;
diff --git a/tests/robotests/src/com/android/customization/model/grid/GridOptionsManagerTest.java b/tests/robotests/src/com/android/customization/model/grid/GridOptionsManagerTest.java
index 52c6489..34418fc 100644
--- a/tests/robotests/src/com/android/customization/model/grid/GridOptionsManagerTest.java
+++ b/tests/robotests/src/com/android/customization/model/grid/GridOptionsManagerTest.java
@@ -50,7 +50,7 @@
@Test
public void testApply() {
String gridName = "testName";
- GridOption grid = new GridOption("testTitle", gridName, false, 2, 2, null, 1, "");
+ GridOption grid = new GridOption("testTitle", gridName, false, 2, 2, null, 1, "", 0);
when(mProvider.applyGrid(gridName)).thenReturn(1);
mManager.apply(grid, new Callback() {