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

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

Issue 2149433002: [Payments] Add ability to bold parts of addresses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 638df3af6b830eaec5863b4b8fd173961a82a9d2..87f577485d3a764192562234d354d47cf594bd75 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,22 +16,27 @@ public class PaymentOption {
private final String mId;
private final int mIcon;
- @Nullable private String mLabel;
- @Nullable private String mSublabel;
+ 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) {
+ public PaymentOption(String id, @Nullable String label, @Nullable String sublabel,
+ @Nullable String tertiarylabel, int icon) {
mId = id;
- mLabel = label;
- mSublabel = sublabel;
+ updateLabels(label, sublabel, tertiarylabel);
mIcon = icon;
}
@@ -47,25 +52,40 @@ public class PaymentOption {
* 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 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.
+ * The optional tertiary label of this option. For example, "(555) 867-5309".
*/
+ @Nullable public String getTertiaryLabel() {
+ return mLabels[2];
+ }
+
+ /** See {@link #updateLabels(String, String, String)}). */
protected void updateLabels(String label, @Nullable String sublabel) {
- mLabel = label;
- mSublabel = sublabel;
+ updateLabels(label, sublabel, null);
+ }
+
+ /**
+ * Updates the labels 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.
+ * @param tertiarylabel The new tertiary label to use. Can be null.
+ */
+ protected void updateLabels(
+ String label, @Nullable String sublabel, @Nullable String tertiarylabel) {
+ mLabels[0] = label;
+ mLabels[1] = sublabel;
+ mLabels[2] = tertiarylabel;
}
/**

Powered by Google App Engine
This is Rietveld 408576698