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

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

Issue 2791363002: 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 boolean useFullLine = fieldModel.isFullLine(); 324 // Dropdown fields will take a full line
325 if (!isLastField && !useFullLine) { 325 boolean useFullLine = fieldModel.isFullLine() || isLastField
326 || (fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_ TYPE_HINT_DROPDOWN);
327
328 if (!useFullLine) {
326 // If the next field isn't full, stretch it out. 329 // If the next field isn't full, stretch it out.
327 nextFieldModel = mEditorModel.getFields().get(i + 1); 330 nextFieldModel = mEditorModel.getFields().get(i + 1);
328 if (nextFieldModel.isFullLine()) useFullLine = true; 331 useFullLine = nextFieldModel.isFullLine()
sebsg 2017/04/03 19:13:36 There is small change in behavior in your function
Parastoo 2017/04/03 19:41:29 My mistake :P On 2017/04/03 19:13:36, sebsg wrote
332 || (nextFieldModel.getInputTypeHint()
333 == EditorFieldModel.INPUT_TYPE_HINT_DROPDOWN) ;
329 } 334 }
330 335
331 if (useFullLine || isLastField) { 336 if (useFullLine) {
332 addFieldViewToEditor(mDataView, fieldModel); 337 addFieldViewToEditor(mDataView, fieldModel);
333 } else { 338 } else {
334 // Create a LinearLayout to put it and the next view side by sid e. 339 // Create a LinearLayout to put it and the next view side by sid e.
335 LinearLayout rowLayout = new LinearLayout(mContext); 340 LinearLayout rowLayout = new LinearLayout(mContext);
336 mDataView.addView(rowLayout); 341 mDataView.addView(rowLayout);
337 342
338 View firstView = addFieldViewToEditor(rowLayout, fieldModel); 343 View firstView = addFieldViewToEditor(rowLayout, fieldModel);
339 View lastView = addFieldViewToEditor(rowLayout, nextFieldModel); 344 View lastView = addFieldViewToEditor(rowLayout, nextFieldModel);
340 345
341 LinearLayout.LayoutParams firstParams = 346 LinearLayout.LayoutParams firstParams =
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 public List<EditText> getEditableTextFieldsForTest() { 543 public List<EditText> getEditableTextFieldsForTest() {
539 return mEditableTextFields; 544 return mEditableTextFields;
540 } 545 }
541 546
542 /** @return All dropdown fields in the editor. Used only for tests. */ 547 /** @return All dropdown fields in the editor. Used only for tests. */
543 @VisibleForTesting 548 @VisibleForTesting
544 public List<Spinner> getDropdownFieldsForTest() { 549 public List<Spinner> getDropdownFieldsForTest() {
545 return mDropdownFields; 550 return mDropdownFields;
546 } 551 }
547 } 552 }
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