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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentOption.java

Issue 2436883002: Make PaymentOption store a Drawable instead of id (Closed)
Patch Set: Fix presubmit warning Created 4 years, 2 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/payments/ui/PaymentOption.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentOption.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentOption.java
index 162ef5a60c294a37c50b6795c4d6c37cb2798d28..f232018d18f930f52943935ac9a1d86d76099bf0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentOption.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentOption.java
@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.payments.ui;
+import android.graphics.drawable.Drawable;
+
import javax.annotation.Nullable;
/**
@@ -11,17 +13,15 @@ import javax.annotation.Nullable;
* method.
*/
public class PaymentOption implements Completable {
- /** The placeholder value that indicates the absence of an icon for this option. */
- public static final int NO_ICON = 0;
-
protected boolean mIsComplete;
private String mId;
- private int mIcon;
+ private Drawable mIcon;
private String[] mLabels = {null, null, null};
private boolean mIsValid = true;
/** See {@link #PaymentOption(String, String, String, String, int)}. */
- public PaymentOption(String id, @Nullable String label, @Nullable String sublabel, int icon) {
+ public PaymentOption(String id, @Nullable String label, @Nullable String sublabel,
+ @Nullable Drawable icon) {
this(id, label, sublabel, null, icon);
}
@@ -32,10 +32,10 @@ public class PaymentOption implements Completable {
* @param label The label.
* @param sublabel The optional sublabel.
* @param tertiarylabel The optional tertiary label.
- * @param icon The drawable icon identifier or NO_ICON.
+ * @param icon The drawable icon identifier or null.
*/
public PaymentOption(String id, @Nullable String label, @Nullable String sublabel,
- @Nullable String tertiarylabel, int icon) {
+ @Nullable String tertiarylabel, @Nullable Drawable icon) {
updateIdentifierLabelsAndIcon(id, label, sublabel, tertiarylabel, icon);
}
@@ -95,20 +95,17 @@ public class PaymentOption implements Completable {
* @param label The new label to use. Should not be null.
* @param sublabel The new sublabel to use. Can be null.
* @param tertiarylabel The new tertiary label to use. Can be null.
- * @param icon The drawable icon identifier or NO_ICON.
+ * @param icon The drawable icon identifier or null.
*/
protected void updateIdentifierLabelsAndIcon(
String id, String label, @Nullable String sublabel, @Nullable String tertiarylabel,
- int icon) {
+ @Nullable Drawable icon) {
updateIdentifierAndLabels(id, label, sublabel, tertiarylabel);
mIcon = icon;
}
- /**
- * The identifier for the drawable icon for this payment option. For example, R.drawable.pr_visa
- * or NO_ICON.
- */
- public int getDrawableIconId() {
+ /** * The drawable icon for this payment option. */
+ public Drawable getDrawableIcon() {
return mIcon;
}

Powered by Google App Engine
This is Rietveld 408576698