OLD | NEW |
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.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.DialogInterface; | 9 import android.content.DialogInterface; |
10 import android.graphics.Color; | 10 import android.graphics.Color; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 public void show(final EditorModel editorModel) { | 327 public void show(final EditorModel editorModel) { |
328 setOnDismissListener(this); | 328 setOnDismissListener(this); |
329 mEditorModel = editorModel; | 329 mEditorModel = editorModel; |
330 | 330 |
331 mLayout = (LinearLayout) LayoutInflater.from(mContext).inflate( | 331 mLayout = (LinearLayout) LayoutInflater.from(mContext).inflate( |
332 R.layout.payment_request_editor, null); | 332 R.layout.payment_request_editor, null); |
333 setContentView(mLayout); | 333 setContentView(mLayout); |
334 prepareToolbar(); | 334 prepareToolbar(); |
335 prepareButtons(); | 335 prepareButtons(); |
336 prepareEditor(); | 336 prepareEditor(); |
337 getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, | |
338 ViewGroup.LayoutParams.MATCH_PARENT); | |
339 show(); | 337 show(); |
340 | 338 |
341 // Immediately focus the first invalid field to make it faster to edit. | 339 // Immediately focus the first invalid field to make it faster to edit. |
342 final List<EditorFieldView> invalidViews = getViewsWithInvalidInformatio
n(); | 340 final List<EditorFieldView> invalidViews = getViewsWithInvalidInformatio
n(); |
343 if (!invalidViews.isEmpty()) { | 341 if (!invalidViews.isEmpty()) { |
344 mHandler.post(new Runnable() { | 342 mHandler.post(new Runnable() { |
345 @Override | 343 @Override |
346 public void run() { | 344 public void run() { |
347 focusInputField(invalidViews.get(0)); | 345 focusInputField(invalidViews.get(0)); |
348 } | 346 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 378 } |
381 return invalidViews; | 379 return invalidViews; |
382 } | 380 } |
383 | 381 |
384 private void focusInputField(View view) { | 382 private void focusInputField(View view) { |
385 view.requestFocus(); | 383 view.requestFocus(); |
386 view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); | 384 view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); |
387 if (mObserverForTest != null) mObserverForTest.onPaymentRequestReadyToEd
it(); | 385 if (mObserverForTest != null) mObserverForTest.onPaymentRequestReadyToEd
it(); |
388 } | 386 } |
389 } | 387 } |
OLD | NEW |