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

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

Issue 2680143002: Use dropdown list for admin areas in pr form. (Closed)
Patch Set: The one with Rouslan's comments. (this was a wrong patch) Created 3 years, 8 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.ui; 5 package org.chromium.chrome.browser.payments.ui;
6 6
7 import android.animation.Animator; 7 import android.animation.Animator;
8 import android.animation.AnimatorListenerAdapter; 8 import android.animation.AnimatorListenerAdapter;
9 import android.animation.AnimatorSet; 9 import android.animation.AnimatorSet;
10 import android.animation.ObjectAnimator; 10 import android.animation.ObjectAnimator;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 EditorFieldModel nextFieldModel = null; 321 EditorFieldModel nextFieldModel = null;
322 322
323 boolean isLastField = i == mEditorModel.getFields().size() - 1; 323 boolean isLastField = i == mEditorModel.getFields().size() - 1;
324 boolean useFullLine = fieldModel.isFullLine(); 324 boolean useFullLine = fieldModel.isFullLine();
325 if (!isLastField && !useFullLine) { 325 if (!isLastField && !useFullLine) {
326 // If the next field isn't full, stretch it out. 326 // If the next field isn't full, stretch it out.
327 nextFieldModel = mEditorModel.getFields().get(i + 1); 327 nextFieldModel = mEditorModel.getFields().get(i + 1);
328 if (nextFieldModel.isFullLine()) useFullLine = true; 328 if (nextFieldModel.isFullLine()) useFullLine = true;
329 } 329 }
330 330
331 if (useFullLine) { 331 if (useFullLine || isLastField) {
332 addFieldViewToEditor(mDataView, fieldModel); 332 addFieldViewToEditor(mDataView, fieldModel);
333 } else { 333 } else {
334 // Create a LinearLayout to put it and the next view side by sid e. 334 // Create a LinearLayout to put it and the next view side by sid e.
335 LinearLayout rowLayout = new LinearLayout(mContext); 335 LinearLayout rowLayout = new LinearLayout(mContext);
336 mDataView.addView(rowLayout); 336 mDataView.addView(rowLayout);
337 337
338 View firstView = addFieldViewToEditor(rowLayout, fieldModel); 338 View firstView = addFieldViewToEditor(rowLayout, fieldModel);
339 View lastView = addFieldViewToEditor(rowLayout, nextFieldModel); 339 View lastView = addFieldViewToEditor(rowLayout, nextFieldModel);
340 340
341 LinearLayout.LayoutParams firstParams = 341 LinearLayout.LayoutParams firstParams =
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 childView = new EditorLabelField(mContext, parent, fieldModel).getLa yout(); 378 childView = new EditorLabelField(mContext, parent, fieldModel).getLa yout();
379 } else if (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_ HINT_DROPDOWN) { 379 } else if (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_ HINT_DROPDOWN) {
380 Runnable prepareEditorRunnable = new Runnable() { 380 Runnable prepareEditorRunnable = new Runnable() {
381 @Override 381 @Override
382 public void run() { 382 public void run() {
383 // The fields may have changed. 383 // The fields may have changed.
384 prepareEditor(); 384 prepareEditor();
385 if (mObserverForTest != null) mObserverForTest.onPaymentRequ estReadyToEdit(); 385 if (mObserverForTest != null) mObserverForTest.onPaymentRequ estReadyToEdit();
386 } 386 }
387 }; 387 };
388 EditorDropdownField dropdownView = 388 EditorDropdownField dropdownView = new EditorDropdownField(
389 new EditorDropdownField(mContext, parent, fieldModel, prepar eEditorRunnable); 389 mContext, parent, fieldModel, prepareEditorRunnable, mObserv erForTest);
390 mFieldViews.add(dropdownView); 390 mFieldViews.add(dropdownView);
391 mDropdownFields.add(dropdownView.getDropdown()); 391 mDropdownFields.add(dropdownView.getDropdown());
392 392
393 childView = dropdownView.getLayout(); 393 childView = dropdownView.getLayout();
394 } else if (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_ HINT_CHECKBOX) { 394 } else if (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_ HINT_CHECKBOX) {
395 final CheckBox checkbox = new CheckBox(mLayout.getContext()); 395 final CheckBox checkbox = new CheckBox(mLayout.getContext());
396 checkbox.setId(R.id.payments_edit_checkbox); 396 checkbox.setId(R.id.payments_edit_checkbox);
397 checkbox.setText(fieldModel.getLabel()); 397 checkbox.setText(fieldModel.getLabel());
398 checkbox.setChecked(fieldModel.isChecked()); 398 checkbox.setChecked(fieldModel.isChecked());
399 checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChan geListener() { 399 checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChan geListener() {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 public List<EditText> getEditableTextFieldsForTest() { 538 public List<EditText> getEditableTextFieldsForTest() {
539 return mEditableTextFields; 539 return mEditableTextFields;
540 } 540 }
541 541
542 /** @return All dropdown fields in the editor. Used only for tests. */ 542 /** @return All dropdown fields in the editor. Used only for tests. */
543 @VisibleForTesting 543 @VisibleForTesting
544 public List<Spinner> getDropdownFieldsForTest() { 544 public List<Spinner> getDropdownFieldsForTest() {
545 return mDropdownFields; 545 return mDropdownFields;
546 } 546 }
547 } 547 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698