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

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

Issue 2924513002: use user chosen country code to format and validate phone number for addresses. (Closed)
Patch Set: add comments Created 3 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/EditorDialog.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDialog.java
index 0c9eca7a81ed39182d5a5919253b7e69c8c465b5..7658949d6803c7ce7641aeff076f47bac32df243 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDialog.java
@@ -85,7 +85,7 @@ public class EditorDialog
private final TextWatcher mCardNumberFormatter;
@Nullable
- private TextWatcher mPhoneFormatter;
+ private PhoneNumberUtil.CountryAwareFormatTextWatcher mPhoneFormatter;
private View mLayout;
private EditorModel mEditorModel;
private Button mDoneButton;
@@ -155,7 +155,7 @@ public class EditorDialog
};
mCardNumberFormatter = new CreditCardNumberFormattingTextWatcher();
- mPhoneFormatter = new PhoneNumberUtil.FormatTextWatcher();
+ mPhoneFormatter = new PhoneNumberUtil.CountryAwareFormatTextWatcher();
}
/** Prevents screenshots of this editor. */
@@ -559,6 +559,14 @@ public class EditorDialog
return invalidViews;
}
+ /**
+ * Update the country code used by the phone formatter. This is called when either user
+ * changes country or when editor is initialized with default country.
+ */
+ public void updateCountryOfPhoneFormatter(String country) {
+ mPhoneFormatter.setCountryCode(country);
+ }
+
/** @return All editable text fields in the editor. Used only for tests. */
@VisibleForTesting
public List<EditText> getEditableTextFieldsForTest() {

Powered by Google App Engine
This is Rietveld 408576698