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

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

Issue 2093363002: Autofill address editor in PaymentRequest UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contact-editor
Patch Set: Fix try-bot Created 4 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/EditorView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorView.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorView.java
index 0bf3badca64a5af9b8f73c18116ee7253d70ab4b..4e871f2a52d3cd024d5b1328eb9e2a47158e0295 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorView.java
@@ -207,21 +207,48 @@ public class EditorView extends AlwaysDismissedDialog
buttonBar.setAlignment(DualControlLayout.ALIGN_END);
}
- /** Create the visual representation of the EditorModel. */
+ /**
+ * Create the visual representation of the EditorModel.
+ *
+ * Fields are added to the layout at position |getChildCount() - 1| to account for the
+ * additional TextView that says "* indicates required field" at the bottom of the layout.
+ *
+ * TODO(rouslan): Put views side by side if !fieldModel.isFullLine();
+ */
private void prepareEditor() {
- ViewGroup dataView = (ViewGroup) mLayout.findViewById(R.id.contents);
+ final ViewGroup dataView = (ViewGroup) mLayout.findViewById(R.id.contents);
for (int i = 0; i < mEditorModel.getFields().size(); i++) {
final EditorFieldModel fieldModel = mEditorModel.getFields().get(i);
- EditorTextField inputLayout = new EditorTextField(mLayout.getContext(), fieldModel,
- mEditorActionListener, getPhoneFormatter(), mObserverForTest);
- final AutoCompleteTextView input = inputLayout.getEditText();
- if (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_HINT_PHONE) {
- assert mPhoneInput == null;
- mPhoneInput = input;
- }
+ if (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_HINT_DROPDOWN) {
+ EditorDropdownField dropdownView = new EditorDropdownField(mContext, fieldModel,
+ new Runnable() {
+ @Override
+ public void run() {
+ // Do not remove the "* indicates required field" label at the
+ // bottom.
+ dataView.removeViews(0, dataView.getChildCount() - 1);
+ prepareEditor();
+ if (mObserverForTest != null) {
+ mObserverForTest.onPaymentRequestReadyToEdit();
+ }
+ }
+ });
+
+ dataView.addView(dropdownView.getLabel(), dataView.getChildCount() - 1);
+ dataView.addView(dropdownView.getDropdown(), dataView.getChildCount() - 1);
+ } else {
+ EditorTextField inputLayout = new EditorTextField(mLayout.getContext(), fieldModel,
+ mEditorActionListener, getPhoneFormatter(), mObserverForTest);
+
+ final AutoCompleteTextView input = inputLayout.getEditText();
+ if (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_HINT_PHONE) {
+ assert mPhoneInput == null;
+ mPhoneInput = input;
+ }
- dataView.addView(inputLayout, dataView.getChildCount() - 1);
+ dataView.addView(inputLayout, dataView.getChildCount() - 1);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698