Merge "Use enabled flashlight icon for color QS preview" into ub-launcher3-qt-r1-dev
diff --git a/res/layout/preview_card_color_content.xml b/res/layout/preview_card_color_content.xml
index 8587652..1de2cd4 100644
--- a/res/layout/preview_card_color_content.xml
+++ b/res/layout/preview_card_color_content.xml
@@ -75,14 +75,13 @@
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
android:layout_gravity="center"
- android:id="@+id/preview_color_qs_2_bg"
- android:tint="@color/tile_disabled_background_color"/>
+ android:id="@+id/preview_color_qs_2_bg"/>
<ImageView
android:layout_width="@dimen/preview_theme_tile_size"
android:layout_height="@dimen/preview_theme_tile_size"
android:layout_gravity="center"
android:id="@+id/preview_color_qs_2_icon"
- android:color="@color/tile_disabled_icon_color"/>
+ android:color="@color/tile_enabled_icon_color"/>
</FrameLayout>
</LinearLayout>
<Space
diff --git a/res/layout/preview_card_cover_content.xml b/res/layout/preview_card_cover_content.xml
index d052642..055a126 100644
--- a/res/layout/preview_card_cover_content.xml
+++ b/res/layout/preview_card_cover_content.xml
@@ -67,13 +67,12 @@
<ImageView
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
- android:id="@+id/preview_color_qs_2_bg"
- android:tint="@color/tile_disabled_background_color"/>
+ android:id="@+id/preview_color_qs_2_bg"/>
<ImageView
android:layout_width="@dimen/preview_theme_tile_size"
android:layout_height="@dimen/preview_theme_tile_size"
android:id="@+id/preview_color_qs_2_icon"
- android:color="@color/tile_disabled_icon_color"
+ android:tint="@color/tile_enabled_icon_color"
android:layout_gravity="center"/>
</FrameLayout>
diff --git a/src/com/android/customization/model/theme/custom/ColorOptionsProvider.java b/src/com/android/customization/model/theme/custom/ColorOptionsProvider.java
index 020e3ef..a37f250 100644
--- a/src/com/android/customization/model/theme/custom/ColorOptionsProvider.java
+++ b/src/com/android/customization/model/theme/custom/ColorOptionsProvider.java
@@ -81,9 +81,6 @@
}
for (String iconName : ICONS_FOR_PREVIEW) {
try {
- if (previewIcons.size() == COLOR_TILES_ICON_IDS.length) {
- break;
- }
previewIcons.add(loadIconPreviewDrawable(iconName, iconPackage));
} catch (NameNotFoundException | NotFoundException e) {
Log.w(TAG, String.format("Couldn't load icon in %s for color preview, will skip it",
diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
index 6946807..8966dc5 100644
--- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
+++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
@@ -265,9 +265,15 @@
private static int[] COLOR_TILE_IDS = {
R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg
};
- static int[] COLOR_TILES_ICON_IDS = {
- R.id.preview_color_qs_0_icon, R.id.preview_color_qs_1_icon,
- R.id.preview_color_qs_2_icon
+
+ /**
+ * Ids of the views for the foreground of the icon, mapping to the corresponding index of
+ * the actual icon drawable.
+ */
+ static int[][] COLOR_TILES_ICON_IDS = {
+ new int[]{ R.id.preview_color_qs_0_icon, 0},
+ new int[]{ R.id.preview_color_qs_1_icon, 1},
+ new int[] { R.id.preview_color_qs_2_icon, 3}
};
/**
@@ -371,14 +377,15 @@
seekbar.setOnTouchListener((view, motionEvent) -> true);
if (!mIcons.isEmpty() && mShapeDrawable != null) {
for (int i = 0; i < COLOR_TILE_IDS.length; i++) {
- Drawable icon = mIcons.get(i).getConstantState().newDrawable();
+ Drawable icon = mIcons.get(COLOR_TILES_ICON_IDS[i][1]).getConstantState()
+ .newDrawable();
//TODO: load and set the shape.
Drawable bgShape = mShapeDrawable.getConstantState().newDrawable();
bgShape.setTint(accentColor);
ImageView bg = container.findViewById(COLOR_TILE_IDS[i]);
bg.setImageDrawable(bgShape);
- ImageView fg = container.findViewById(COLOR_TILES_ICON_IDS[i]);
+ ImageView fg = container.findViewById(COLOR_TILES_ICON_IDS[i][0]);
fg.setImageDrawable(icon);
}
}
diff --git a/src/com/android/customization/picker/theme/CustomThemeNameFragment.java b/src/com/android/customization/picker/theme/CustomThemeNameFragment.java
index 04aac7d..f29c976 100644
--- a/src/com/android/customization/picker/theme/CustomThemeNameFragment.java
+++ b/src/com/android/customization/picker/theme/CustomThemeNameFragment.java
@@ -63,8 +63,10 @@
private int[] mColorTileIds = {
R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg
};
- private int[] mColorTileIconIds = {
- R.id.preview_color_qs_0_icon, R.id.preview_color_qs_1_icon, R.id.preview_color_qs_2_icon
+ private int[][] mColorTileIconIds = {
+ new int[]{ R.id.preview_color_qs_0_icon, 0},
+ new int[]{ R.id.preview_color_qs_1_icon, 1},
+ new int[] { R.id.preview_color_qs_2_icon, 3}
};
private int[] mShapeIconIds = {
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index e7ea5d1..f0e0cd3 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -307,8 +307,10 @@
private int[] mColorTileIds = {
R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg
};
- private int[] mColorTileIconIds = {
- R.id.preview_color_qs_0_icon, R.id.preview_color_qs_1_icon, R.id.preview_color_qs_2_icon
+ private int[][] mColorTileIconIds = {
+ new int[]{ R.id.preview_color_qs_0_icon, 0},
+ new int[]{ R.id.preview_color_qs_1_icon, 1},
+ new int[] { R.id.preview_color_qs_2_icon, 3}
};
private int[] mShapeIconIds = {
@@ -397,7 +399,7 @@
for (int i = 0; i < mColorTileIds.length && i < previewInfo.icons.size();
i++) {
- Drawable icon = previewInfo.icons.get(i)
+ Drawable icon = previewInfo.icons.get(mColorTileIconIds[i][1])
.getConstantState().newDrawable().mutate();
Drawable bgShape =
previewInfo.shapeDrawable.getConstantState().newDrawable();
@@ -405,7 +407,7 @@
ImageView bg = card.findViewById(mColorTileIds[i]);
bg.setImageDrawable(bgShape);
- ImageView fg = card.findViewById(mColorTileIconIds[i]);
+ ImageView fg = card.findViewById(mColorTileIconIds[i][0]);
fg.setImageDrawable(icon);
}
}
diff --git a/src/com/android/customization/picker/theme/ThemePreviewPage.java b/src/com/android/customization/picker/theme/ThemePreviewPage.java
index bcfffd9..4d01f9d 100644
--- a/src/com/android/customization/picker/theme/ThemePreviewPage.java
+++ b/src/com/android/customization/picker/theme/ThemePreviewPage.java
@@ -85,7 +85,7 @@
private Drawable mShapeDrawable;
private final int[] mColorButtonIds;
private final int[] mColorTileIds;
- private final int[] mColorTileIconIds;
+ private final int[][] mColorTileIconIds;
private final int[] mShapeIconIds;
private final Resources mRes;
private String mTitle;
@@ -99,7 +99,7 @@
Drawable shapeDrawable,
List<Drawable> shapeAppIcons,
OnClickListener editClickListener,
- int[] colorButtonIds, int[] colorTileIds, int[] colorTileIconIds,
+ int[] colorButtonIds, int[] colorTileIds, int[][] colorTileIconIds,
int[] shapeIconIds, OnLayoutChangeListener wallpaperListener) {
super(context, 0, 0, R.layout.preview_card_cover_content, accentColor);
mRes = context.getResources();
@@ -149,14 +149,14 @@
}
}
for (int i = 0; i < 3 && i < mIcons.size(); i++) {
- Drawable icon =
- mIcons.get(i).getConstantState().newDrawable().mutate();
+ Drawable icon = mIcons.get(mColorTileIconIds[i][1]).getConstantState()
+ .newDrawable().mutate();
Drawable bgShape = mShapeDrawable.getConstantState().newDrawable();
bgShape.setTint(accentColor);
ImageView bg = card.findViewById(mColorTileIds[i]);
bg.setImageDrawable(bgShape);
- ImageView fg = card.findViewById(mColorTileIconIds[i]);
+ ImageView fg = card.findViewById(mColorTileIconIds[i][0]);
fg.setImageDrawable(icon);
}