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() { |