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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java

Issue 2801063002: [Payments] When no billing address is selected, focus on the first one. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
index ea457b1905c2e8a6065fc5987c95168025b8bc78..e7f30183cee3524972f139713ca301287d60bc16 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
@@ -102,11 +102,19 @@ class EditorDropdownField implements EditorFieldView {
@Override
public void onNothingSelected(AdapterView<?> parent) {}
});
+ final int count = adapter.getCount();
mDropdown.setOnTouchListener(new View.OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) requestFocusAndHideKeyboard();
+
+ // If the dropdown supports an hint and the hint is selected, select the first
+ // element instead.
+ if (mDropdown.getSelectedItemPosition() == count) {
+ mDropdown.setSelection(0);
+ }
+
return false;
}
});
« 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