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

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

Issue 2819623002: Revert of A drop-down should take a line to be always aligned with text-fields. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 mFieldViews.clear(); 314 mFieldViews.clear();
315 mEditableTextFields.clear(); 315 mEditableTextFields.clear();
316 mDropdownFields.clear(); 316 mDropdownFields.clear();
317 317
318 // Add Views for each of the {@link EditorFields}. 318 // Add Views for each of the {@link EditorFields}.
319 for (int i = 0; i < mEditorModel.getFields().size(); i++) { 319 for (int i = 0; i < mEditorModel.getFields().size(); i++) {
320 EditorFieldModel fieldModel = mEditorModel.getFields().get(i); 320 EditorFieldModel fieldModel = mEditorModel.getFields().get(i);
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 // Dropdown fields will take a full line 324 boolean useFullLine = fieldModel.isFullLine();
325 boolean useFullLine = fieldModel.isFullLine() || isLastField 325 if (!isLastField && !useFullLine) {
326 || (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_ TYPE_HINT_DROPDOWN);
327
328 if (!useFullLine) {
329 // If the next field isn't full, stretch it out. 326 // If the next field isn't full, stretch it out.
330 nextFieldModel = mEditorModel.getFields().get(i + 1); 327 nextFieldModel = mEditorModel.getFields().get(i + 1);
331 useFullLine = useFullLine || nextFieldModel.isFullLine() 328 if (nextFieldModel.isFullLine()) useFullLine = true;
332 || (nextFieldModel.getInputTypeHint()
333 == EditorFieldModel.INPUT_TYPE_HINT_DROPDOWN) ;
334 } 329 }
335 330
336 if (useFullLine) { 331 if (useFullLine || isLastField) {
337 addFieldViewToEditor(mDataView, fieldModel); 332 addFieldViewToEditor(mDataView, fieldModel);
338 } else { 333 } else {
339 // 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.
340 LinearLayout rowLayout = new LinearLayout(mContext); 335 LinearLayout rowLayout = new LinearLayout(mContext);
341 mDataView.addView(rowLayout); 336 mDataView.addView(rowLayout);
342 337
343 View firstView = addFieldViewToEditor(rowLayout, fieldModel); 338 View firstView = addFieldViewToEditor(rowLayout, fieldModel);
344 View lastView = addFieldViewToEditor(rowLayout, nextFieldModel); 339 View lastView = addFieldViewToEditor(rowLayout, nextFieldModel);
345 340
346 LinearLayout.LayoutParams firstParams = 341 LinearLayout.LayoutParams firstParams =
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 public List<EditText> getEditableTextFieldsForTest() { 538 public List<EditText> getEditableTextFieldsForTest() {
544 return mEditableTextFields; 539 return mEditableTextFields;
545 } 540 }
546 541
547 /** @return All dropdown fields in the editor. Used only for tests. */ 542 /** @return All dropdown fields in the editor. Used only for tests. */
548 @VisibleForTesting 543 @VisibleForTesting
549 public List<Spinner> getDropdownFieldsForTest() { 544 public List<Spinner> getDropdownFieldsForTest() {
550 return mDropdownFields; 545 return mDropdownFields;
551 } 546 }
552 } 547 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698