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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogContentView.java

Issue 14786021: [rAc Android dialog] Don't show CVC editboxes in drop-down menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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.autofill; 5 package org.chromium.chrome.browser.autofill;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.res.Resources; 8 import android.content.res.Resources;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.graphics.drawable.BitmapDrawable; 10 import android.graphics.drawable.BitmapDrawable;
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 public View getView(int position, View convertView, ViewGroup parent) { 442 public View getView(int position, View convertView, ViewGroup parent) {
443 return initView(position, convertView, parent, false); 443 return initView(position, convertView, parent, false);
444 } 444 }
445 445
446 @Override 446 @Override
447 public View getDropDownView(int position, View convertView, ViewGroup pa rent) { 447 public View getDropDownView(int position, View convertView, ViewGroup pa rent) {
448 return initView(position, convertView, parent, true); 448 return initView(position, convertView, parent, true);
449 } 449 }
450 450
451 private View initView( 451 private View initView(
452 final int position, View convertView, final ViewGroup parent, bo olean showButton) { 452 final int position, View convertView, final ViewGroup parent, bo olean isDropDown) {
453 if (convertView == null) { 453 if (convertView == null) {
454 convertView = View.inflate(getContext(), R.layout.autofill_menu_ item, null); 454 convertView = View.inflate(getContext(), R.layout.autofill_menu_ item, null);
455 } 455 }
456 456
457 AutofillDialogMenuItem item = getItem(position); 457 AutofillDialogMenuItem item = getItem(position);
458 ImageView icon = (ImageView) convertView.findViewById(R.id.cc_icon); 458 ImageView icon = (ImageView) convertView.findViewById(R.id.cc_icon);
459 TextView line1 = (TextView) convertView.findViewById(R.id.adapter_it em_line_1); 459 TextView line1 = (TextView) convertView.findViewById(R.id.adapter_it em_line_1);
460 TextView line2 = (TextView) convertView.findViewById(R.id.adapter_it em_line_2); 460 TextView line2 = (TextView) convertView.findViewById(R.id.adapter_it em_line_2);
461 Button button = (Button) convertView.findViewById(R.id.adapter_item_ edit_button); 461 Button button = (Button) convertView.findViewById(R.id.adapter_item_ edit_button);
462 EditText extraEdit = (EditText) convertView.findViewById(R.id.cvc_ch allenge); 462 EditText extraEdit = (EditText) convertView.findViewById(R.id.cvc_ch allenge);
(...skipping 11 matching lines...) Expand all
474 if (line2 != null) { 474 if (line2 != null) {
475 if (!TextUtils.isEmpty(item.mLine2)) { 475 if (!TextUtils.isEmpty(item.mLine2)) {
476 line2.setVisibility(VISIBLE); 476 line2.setVisibility(VISIBLE);
477 line2.setText(item.mLine2); 477 line2.setText(item.mLine2);
478 } else { 478 } else {
479 line2.setVisibility(GONE); 479 line2.setVisibility(GONE);
480 } 480 }
481 } 481 }
482 482
483 if (extraEdit != null) { 483 if (extraEdit != null) {
484 if (!TextUtils.isEmpty(mSuggestionTextExtra)) { 484 if (!isDropDown && !TextUtils.isEmpty(mSuggestionTextExtra)) {
485 extraEdit.setVisibility(VISIBLE); 485 extraEdit.setVisibility(VISIBLE);
486 extraEdit.setHint(mSuggestionTextExtra); 486 extraEdit.setHint(mSuggestionTextExtra);
487 extraEdit.setCompoundDrawables( 487 extraEdit.setCompoundDrawables(
488 null, null, mSuggestionIconExtraDrawable, null); 488 null, null, mSuggestionIconExtraDrawable, null);
489 } else { 489 } else {
490 extraEdit.setVisibility(GONE); 490 extraEdit.setVisibility(GONE);
491 } 491 }
492 } 492 }
493 493
494 if (button != null) { 494 if (button != null) {
495 if (showButton && item.mShowButton) { 495 if (isDropDown && item.mShowButton) {
496 button.setText(item.mButtonLabelResourceId); 496 button.setText(item.mButtonLabelResourceId);
497 button.setOnClickListener(new OnClickListener() { 497 button.setOnClickListener(new OnClickListener() {
498 // TODO(aruslan): http://crbug.com/236101. 498 // TODO(aruslan): http://crbug.com/236101.
499 @Override 499 @Override
500 public void onClick(View view) { 500 public void onClick(View view) {
501 View root = parent.getRootView(); 501 View root = parent.getRootView();
502 root.dispatchKeyEvent( 502 root.dispatchKeyEvent(
503 new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent. KEYCODE_BACK)); 503 new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent. KEYCODE_BACK));
504 root.dispatchKeyEvent( 504 root.dispatchKeyEvent(
505 new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KE YCODE_BACK)); 505 new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KE YCODE_BACK));
506 assert mOnItemEditButtonClickedListener != null; 506 assert mOnItemEditButtonClickedListener != null;
507 if (mOnItemEditButtonClickedListener != null) { 507 if (mOnItemEditButtonClickedListener != null) {
508 mOnItemEditButtonClickedListener.onItemEditButto nClicked( 508 mOnItemEditButtonClickedListener.onItemEditButto nClicked(
509 mSection, position); 509 mSection, position);
510 } 510 }
511 } 511 }
512 }); 512 });
513 button.setVisibility(VISIBLE); 513 button.setVisibility(VISIBLE);
514 } else { 514 } else {
515 button.setOnClickListener(null); 515 button.setOnClickListener(null);
516 button.setVisibility(GONE); 516 button.setVisibility(GONE);
517 } 517 }
518 } 518 }
519 return convertView; 519 return convertView;
520 } 520 }
521 } 521 }
522 } 522 }
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