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

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

Issue 2462473002: [Payments] Don't show select when clicking in billing address drop. (Closed)
Patch Set: Addressed comments Created 4 years, 1 month 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
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/HintArrayAdapter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/HintArrayAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/HintArrayAdapter.java
new file mode 100644
index 0000000000000000000000000000000000000000..02fcfc06ee82e86174ae621b964ff25b229a0e66
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/HintArrayAdapter.java
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments.ui;
+
+import android.content.Context;
+import android.widget.ArrayAdapter;
+
+import java.util.List;
+
+/**
+ * Subclass of ArrayAdapter used to display a dropdown hint that won't appear in the dropdown
+ * options. The last element is the hint.
+ *
+ * @param <T> The type of element to be inserted into the adapter.
+ */
+public class HintArrayAdapter<T> extends ArrayAdapter<T> {
+
+ /**
+ * Creates an array adapter for which the last element is not shown.
+ *
+ * @param context The current context.
+ * @param resource The resource ID for a layout file containing a layout to use when
+ * instantiating views.
+ * @param objects The objects to represent in the ListView, the last of which is not displayed
+ * in the dropdown, but is used as the hint.
+ */
+ public HintArrayAdapter(Context context, int resource, List<T> objects) {
+ super(context, resource, objects);
+ }
+
+ @Override
+ public int getCount() {
+ // Don't display last item, it is used as hint.
+ int count = super.getCount();
+ return count > 0 ? count - 1 : count;
+ }
+}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorFieldModel.java ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698