diff options
author | Chuck Liao <chuckliao@google.com> | 2021-05-26 11:29:07 +0800 |
---|---|---|
committer | Chuck Liao <chuckliao@google.com> | 2021-06-15 14:59:43 +0800 |
commit | 59b8db47a5039018a6c13617296b52cc23992aec (patch) | |
tree | 308286b9d677fce3863656d589a36e745f2f272e /src | |
parent | 1187d676d02d03bfa47ce6cd4cee4cb91f443bb1 (diff) | |
download | ThemePicker-59b8db47a5039018a6c13617296b52cc23992aec.tar.gz |
Fix grid option does not show selected state
Video:
https://drive.google.com/file/d/13v6P_Np7ijAhQhYDjMXUWkjs3MWqUMIX/view?usp=sharing&resourcekey=0-sI2jmTp0u1KuTalHNumuzg
Bug: 189060136
Test: manual
Change-Id: I98a5f2dfde187402a7ea83f40f9bff663e5f1cf6
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/customization/model/grid/GridOption.java | 2 | ||||
-rw-r--r-- | src/com/android/customization/widget/OptionSelectorController.java | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/customization/model/grid/GridOption.java b/src/com/android/customization/model/grid/GridOption.java index 6a61274a..16a5eb01 100644 --- a/src/com/android/customization/model/grid/GridOption.java +++ b/src/com/android/customization/model/grid/GridOption.java @@ -93,7 +93,7 @@ public class GridOption implements CustomizationOption<GridOption>, Parcelable { Context context = view.getContext(); int colorFilter = ResourceUtils.getColorAttr(context, - mIsCurrent ? android.R.attr.textColorPrimary : + view.isActivated() ? android.R.attr.textColorPrimary : android.R.attr.textColorTertiary); mTileDrawable.setColorFilter(colorFilter, Mode.SRC_ATOP); ((ImageView) view.findViewById(R.id.grid_option_thumbnail)) diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java index 1c5c2a14..8e85c013 100644 --- a/src/com/android/customization/widget/OptionSelectorController.java +++ b/src/com/android/customization/widget/OptionSelectorController.java @@ -116,7 +116,12 @@ public class OptionSelectorController<T extends CustomizationOption<T>> { } updateActivatedStatus(mSelectedOption, false); updateActivatedStatus(option, true); + T lastSelectedOption = mSelectedOption; mSelectedOption = option; + mAdapter.notifyItemChanged(mOptions.indexOf(option)); + if (lastSelectedOption != null) { + mAdapter.notifyItemChanged(mOptions.indexOf(lastSelectedOption)); + } notifyListeners(); } |