summaryrefslogtreecommitdiff
path: root/src/com/android/customization/widget/OptionSelectorController.java
diff options
context:
space:
mode:
authorJohn Pan <johnpan@google.com>2021-10-15 11:05:00 +0800
committerJohn Pan <johnpan@google.com>2021-10-16 00:21:55 +0800
commit0734211fb38b652cec3b3d83bc5a1b6873ae420b (patch)
tree7b2945f6ccd6c36e6b66c2dcc2a098ac3dacc312 /src/com/android/customization/widget/OptionSelectorController.java
parent79c8841c0f489783bed3f3cde36f629016c427d1 (diff)
Update grid preview selection
Vedios: -Before: https://drive.google.com/file/d/1HO5LWSmpFpdDk5BjaChEHYRKRbOTKovh/view?usp=sharing&resourcekey=0-lJ7hGNn783U9sVKhOCJ3vg -After: https://drive.google.com/file/d/1I5HTG6wrbB3KU-_7Cpf5zyD485TknUmJ/view?usp=sharing&resourcekey=0-KVF8KQtYg-JNahGsaszUWQ Bug: 201572713 Test: Manual Change-Id: I664db7941b9fe36c300040e95ccb4f0300a37c59
Diffstat (limited to 'src/com/android/customization/widget/OptionSelectorController.java')
-rw-r--r--src/com/android/customization/widget/OptionSelectorController.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index 8e85c013..aa54f4f4 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -68,11 +68,13 @@ public class OptionSelectorController<T extends CustomizationOption<T>> {
void onOptionSelected(CustomizationOption selected);
}
- @IntDef({CheckmarkStyle.NONE, CheckmarkStyle.CORNER, CheckmarkStyle.CENTER})
+ @IntDef({CheckmarkStyle.NONE, CheckmarkStyle.CORNER, CheckmarkStyle.CENTER,
+ CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED})
public @interface CheckmarkStyle {
int NONE = 0;
int CORNER = 1;
int CENTER = 2;
+ int CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED = 3;
}
private static final float LINEAR_LAYOUT_HORIZONTAL_DISPLAY_OPTIONS_MAX = 4.35f;
@@ -243,6 +245,16 @@ public class OptionSelectorController<T extends CustomizationOption<T>> {
mContainer.getContext().getTheme()),
Gravity.CENTER, res.getDimensionPixelSize(R.dimen.center_check_size),
0);
+ } else if (mCheckmarkStyle == CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED
+ && option.equals(mAppliedOption)) {
+ int drawableRes = option.equals(mSelectedOption)
+ ? R.drawable.check_circle_grey_large
+ : R.drawable.check_circle_grey_large_not_select;
+ drawCheckmark(option, holder,
+ res.getDrawable(drawableRes,
+ mContainer.getContext().getTheme()),
+ Gravity.CENTER, res.getDimensionPixelSize(R.dimen.center_check_size),
+ 0);
} else if (option.equals(mAppliedOption)) {
// Initialize with "previewed" description if we don't show checkmark
holder.setContentDescription(mContainer.getContext(), option,