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

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

Issue 2081533002: Edit contacts UI for PaymentRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contactDetails
Patch Set: Addressed comments Created 4 years, 6 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 96689d96a9ba0f06b56ea1b8fa67ae866092776a..492fe5fc492cd890ed18c68155f36ecfc68e4082 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,20 +4,20 @@
package org.chromium.chrome.browser.payments.ui;
+import javax.annotation.Nullable;
+
/**
* An option that the user can select, e.g., a shipping option, a shipping address, or a payment
* method.
*/
public class PaymentOption {
- /**
- * The placeholder value that indicates the absence of an icon for this option.
- */
+ /** The placeholder value that indicates the absence of an icon for this option. */
public static final int NO_ICON = 0;
private final String mId;
- private final String mLabel;
- private final String mSublabel;
private final int mIcon;
+ @Nullable private String mLabel;
+ @Nullable private String mSublabel;
private boolean mIsValid = true;
/**
@@ -28,7 +28,7 @@ public class PaymentOption {
* @param sublabel The optional sublabel.
* @param icon The drawable icon identifier or NO_ICON.
*/
- public PaymentOption(String id, String label, String sublabel, int icon) {
+ public PaymentOption(String id, @Nullable String label, @Nullable String sublabel, int icon) {
mId = id;
mLabel = label;
mSublabel = sublabel;
@@ -46,18 +46,30 @@ public class PaymentOption {
/**
* The primary label of this option. For example, “Visa***1234” or "2-day shipping".
*/
- public String getLabel() {
+ @Nullable public String getLabel() {
return mLabel;
}
/**
* The optional sublabel of this option. For example, “Expiration date: 12/2025”.
*/
- public String getSublabel() {
+ @Nullable public String getSublabel() {
return mSublabel;
}
/**
+ * Updates the label and sublabel of this option. Called after the user has edited this option.
+ *
+ * @param label The new label to use. Should not be null.
+ * @param sublabel The new sublabel to use. Can be null.
+ */
+ protected void updateLabels(String label, @Nullable String sublabel) {
+ assert label != null;
+ mLabel = label;
+ mSublabel = sublabel;
+ }
+
+ /**
* The identifier for the drawable icon for this payment option. For example,
* R.drawable.visa_card_issuer_icon or NO_ICON.
*/
@@ -73,11 +85,7 @@ public class PaymentOption {
mIsValid = false;
}
- /**
- * Returns whether this option is valid.
- *
- * @return True if this option is valid.
- */
+ /** @return True if this option is valid. */
public boolean isValid() {
return mIsValid;
}

Powered by Google App Engine
This is Rietveld 408576698