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

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

Issue 2135573004: [Payments] Add ability to bold parts of addresses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@payments_continuing
Patch Set: Phone number fix Created 4 years, 5 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 6b0356a9ad0cbeb33873c1fb3ad4a689d55bbe7e..162ef5a60c294a37c50b6795c4d6c37cb2798d28 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
@@ -16,24 +16,27 @@ public class PaymentOption implements Completable {
protected boolean mIsComplete;
private String mId;
- @Nullable private String mLabel;
- @Nullable private String mSublabel;
private int 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) {
+ this(id, label, sublabel, null, icon);
+ }
+
/**
* Constructs a payment option.
*
- * @param id The identifier.
- * @param label The label.
- * @param sublabel The optional sublabel.
- * @param icon The drawable icon identifier or NO_ICON.
+ * @param id The identifier.
+ * @param label The label.
+ * @param sublabel The optional sublabel.
+ * @param tertiarylabel The optional tertiary label.
+ * @param icon The drawable icon identifier or NO_ICON.
*/
- public PaymentOption(String id, @Nullable String label, @Nullable String sublabel, int icon) {
- mId = id;
- mLabel = label;
- mSublabel = sublabel;
- mIcon = icon;
+ public PaymentOption(String id, @Nullable String label, @Nullable String sublabel,
+ @Nullable String tertiarylabel, int icon) {
+ updateIdentifierLabelsAndIcon(id, label, sublabel, tertiarylabel, icon);
}
@Override
@@ -53,42 +56,51 @@ public class PaymentOption implements Completable {
* The primary label of this option. For example, “Visa***1234” or "2-day shipping".
*/
@Nullable public String getLabel() {
- return mLabel;
+ return mLabels[0];
}
/**
* The optional sublabel of this option. For example, “Expiration date: 12/2025”.
*/
@Nullable public String getSublabel() {
- return mSublabel;
+ return mLabels[1];
}
/**
- * Updates the identifier, label, and sublabel of this option. Called after the user has edited
- * this option.
- *
- * @param id The new id to use. Should not be null.
- * @param label The new label to use. Should not be null.
- * @param sublabel The new sublabel to use. Can be null.
+ * The optional tertiary label of this option. For example, "(555) 867-5309".
*/
+ @Nullable public String getTertiaryLabel() {
+ return mLabels[2];
+ }
+
+ /** See {@link #updateIdentifierAndLabels(String, String, String, String)}. */
protected void updateIdentifierAndLabels(String id, String label, @Nullable String sublabel) {
- updateIdentifierLabelsAndIcon(id, label, sublabel, mIcon);
+ updateIdentifierAndLabels(id, label, sublabel, null);
+ }
+
+ /** See {@link #updateIdentifierLabelsAndIcon(String, String, String, String, int)}. */
+ protected void updateIdentifierAndLabels(
+ String id, String label, @Nullable String sublabel, @Nullable String tertiarylabel) {
+ mId = id;
+ mLabels[0] = label;
+ mLabels[1] = sublabel;
+ mLabels[2] = tertiarylabel;
}
/**
- * Updates the identifier, label, sublabel, and icon of this option. Called after the user has
+ * Updates the identifier, labels, and icon of this option. Called after the user has
* edited this option.
*
- * @param id The new id to use. Should not be null.
- * @param label The new label to use. Should not be null.
- * @param sublabel The new sublabel to use. Can be null.
- * @param icon The drawable icon identifier or NO_ICON.
+ * @param id The new id to use. Should not be null.
+ * @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.
*/
protected void updateIdentifierLabelsAndIcon(
- String id, String label, @Nullable String sublabel, int icon) {
- mId = id;
- mLabel = label;
- mSublabel = sublabel;
+ String id, String label, @Nullable String sublabel, @Nullable String tertiarylabel,
+ int icon) {
+ updateIdentifierAndLabels(id, label, sublabel, tertiarylabel);
mIcon = icon;
}

Powered by Google App Engine
This is Rietveld 408576698