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 c73f27249fda9b676fc92f2ba3bf8db9181b1b26..69e6f6428bba94a2741a7f510b34e8dbfb6935a8 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. */ |
@@ -567,6 +567,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() { |