Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2568)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java

Issue 2738503007: POC: Use a tint list to change colors (Closed)
Patch Set: Stop calling notifyDataSetChanged() when tapping on item Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
index 8bc1b337d3c5ab94c9bcf63c915de9eedba9ea8c..de66ec66cdf23e9b92b828f648299dc4e972c86e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
@@ -68,12 +68,10 @@ public class ItemChooserDialog {
*/
public static class ItemChooserRowIcon {
private final Drawable mIcon;
- private final Drawable mSelected;
private final String mDescription;
- public ItemChooserRowIcon(Drawable icon, Drawable selectedIcon, String iconDescription) {
+ public ItemChooserRowIcon(Drawable icon, String iconDescription) {
mIcon = icon;
- mSelected = selectedIcon;
mDescription = iconDescription;
}
@@ -85,7 +83,6 @@ public class ItemChooserDialog {
ItemChooserRowIcon otherIcon = (ItemChooserRowIcon) other;
if (!mIcon.equals(otherIcon.mIcon)) return false;
- if (!mSelected.equals(otherIcon.mSelected)) return false;
if (!TextUtils.equals(mDescription, otherIcon.mDescription)) return false;
return true;
@@ -368,8 +365,9 @@ public class ItemChooserDialog {
ItemChooserRowIcon icon = getItem(position).mIcon;
if (icon != null) {
row.mImageView.setContentDescription(icon.mDescription);
- row.mImageView.setImageDrawable(
- (mSelectedItem == position) ? icon.mSelected : icon.mIcon);
+ // Need to set the drawable to null first otherwise the drawable's
+ // state doesn't get updated for some reason.
+ row.mImageView.setImageDrawable(icon.mIcon);
row.mImageView.setVisibility(View.VISIBLE);
} else {
row.mImageView.setVisibility(View.INVISIBLE);
@@ -393,7 +391,6 @@ public class ItemChooserDialog {
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
mSelectedItem = position;
mConfirmButton.setEnabled(true);
- notifyDataSetChanged();
}
private void addToDescriptionsMap(String description) {

Powered by Google App Engine
This is Rietveld 408576698