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

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

Issue 2813703004: chooser: Don't call mutate on new drawable (Closed)
Patch Set: Address tedchoc's comments Created 3 years, 8 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 96a9e8cff6cdcd17770810545cd668a6cdef6e59..5318960d85db9ea3ce46fba5c58895868eea2bd8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
@@ -90,8 +90,13 @@ public class ItemChooserDialog {
@Nullable String iconDescription) {
if (!TextUtils.equals(mKey, key)) return false;
if (!TextUtils.equals(mDescription, description)) return false;
- if (!ApiCompatibilityUtils.objectEquals(mIcon, icon)) return false;
if (!TextUtils.equals(mIconDescription, iconDescription)) return false;
+
+ if (icon == null ^ mIcon == null) return false;
+ if (mIcon != null && !mIcon.getConstantState().equals(icon.getConstantState())) {
+ return false;
+ }
+
return true;
}
}
@@ -575,7 +580,8 @@ public class ItemChooserDialog {
*
* @param key Unique identifier for that item.
* @param description Text in the row.
- * @param icon Drawable to show left of the description.
+ * @param icon Drawable to show left of the description. The drawable provided should
+ * be stateful and handle the selected state to be rendered correctly.
* @param iconDescription Description of the icon.
*/
public void addOrUpdateItem(String key, String description, @Nullable Drawable icon,

Powered by Google App Engine
This is Rietveld 408576698