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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ContactEditor.java

Issue 2952673002: [Payments] Format and validate phone number according to selected country in address editor (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import android.telephony.PhoneNumberUtils; 7 import android.telephony.PhoneNumberUtils;
8 import android.text.TextUtils; 8 import android.text.TextUtils;
9 import android.util.Patterns; 9 import android.util.Patterns;
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 final AutofillContact contact = toEdit == null 146 final AutofillContact contact = toEdit == null
147 ? new AutofillContact(mContext, new AutofillProfile(), null, nul l, null, 147 ? new AutofillContact(mContext, new AutofillProfile(), null, nul l, null,
148 INVALID_NAME | INVALID_PHONE_NUMBER | INVALID_EMAIL, m RequestPayerName, 148 INVALID_NAME | INVALID_PHONE_NUMBER | INVALID_EMAIL, m RequestPayerName,
149 mRequestPayerPhone, mRequestPayerEmail) 149 mRequestPayerPhone, mRequestPayerEmail)
150 : toEdit; 150 : toEdit;
151 151
152 final EditorFieldModel nameField = mRequestPayerName 152 final EditorFieldModel nameField = mRequestPayerName
153 ? EditorFieldModel.createTextInput(EditorFieldModel.INPUT_TYPE_H INT_PERSON_NAME, 153 ? EditorFieldModel.createTextInput(EditorFieldModel.INPUT_TYPE_H INT_PERSON_NAME,
154 mContext.getString(R.string.payments_name_field_in_con tact_details), 154 mContext.getString(R.string.payments_name_field_in_con tact_details),
155 mPayerNames, null, null, 155 mPayerNames, null, null, null,
please use gerrit instead 2017/06/20 18:48:29 Ditto
gogerald1 2017/06/20 19:12:39 Done.
156 mContext.getString(R.string.payments_field_required_va lidation_message), 156 mContext.getString(R.string.payments_field_required_va lidation_message),
157 null, contact.getPayerName()) 157 null, contact.getPayerName())
158 : null; 158 : null;
159 159
160 final EditorFieldModel phoneField = mRequestPayerPhone 160 final EditorFieldModel phoneField = mRequestPayerPhone
161 ? EditorFieldModel.createTextInput(EditorFieldModel.INPUT_TYPE_H INT_PHONE, 161 ? EditorFieldModel.createTextInput(EditorFieldModel.INPUT_TYPE_H INT_PHONE,
162 mContext.getString(R.string.autofill_profile_editor_ph one_number), 162 mContext.getString(R.string.autofill_profile_editor_ph one_number),
163 mPhoneNumbers, getPhoneValidator(), null, 163 mPhoneNumbers, null, getPhoneValidator(), null,
164 mContext.getString(R.string.payments_field_required_va lidation_message), 164 mContext.getString(R.string.payments_field_required_va lidation_message),
165 mContext.getString(R.string.payments_phone_invalid_val idation_message), 165 mContext.getString(R.string.payments_phone_invalid_val idation_message),
166 contact.getPayerPhone()) 166 contact.getPayerPhone())
167 : null; 167 : null;
168 168
169 final EditorFieldModel emailField = mRequestPayerEmail 169 final EditorFieldModel emailField = mRequestPayerEmail
170 ? EditorFieldModel.createTextInput(EditorFieldModel.INPUT_TYPE_H INT_EMAIL, 170 ? EditorFieldModel.createTextInput(EditorFieldModel.INPUT_TYPE_H INT_EMAIL,
171 mContext.getString(R.string.autofill_profile_editor_em ail_address), 171 mContext.getString(R.string.autofill_profile_editor_em ail_address),
172 mEmailAddresses, getEmailValidator(), null, 172 mEmailAddresses, null, getEmailValidator(), null,
173 mContext.getString(R.string.payments_field_required_va lidation_message), 173 mContext.getString(R.string.payments_field_required_va lidation_message),
174 mContext.getString(R.string.payments_email_invalid_val idation_message), 174 mContext.getString(R.string.payments_email_invalid_val idation_message),
175 contact.getPayerEmail()) 175 contact.getPayerEmail())
176 : null; 176 : null;
177 177
178 EditorModel editor = new EditorModel(toEdit == null 178 EditorModel editor = new EditorModel(toEdit == null
179 ? mContext.getString(R.string.payments_add_contact_details_label ) 179 ? mContext.getString(R.string.payments_add_contact_details_label )
180 : toEdit.getEditTitle()); 180 : toEdit.getEditTitle());
181 181
182 if (nameField != null) editor.addField(nameField); 182 if (nameField != null) editor.addField(nameField);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 @Override 255 @Override
256 public boolean isLengthMaximum(@Nullable CharSequence value) { 256 public boolean isLengthMaximum(@Nullable CharSequence value) {
257 return false; 257 return false;
258 } 258 }
259 }; 259 };
260 } 260 }
261 return mEmailValidator; 261 return mEmailValidator;
262 } 262 }
263 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698