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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDialog.java

Issue 23523025: [Android] SelectPopupDialog - resolve style for <select> dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits (isMultiChoice) Created 7 years, 3 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 | « content/public/android/java/resource_map/org/chromium/content/R.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDialog.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDialog.java b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDialog.java
index d32266b0f442f74552f81f4e95586c34a1867b18..4db838ec968d7ccd49599cfbaed863493e6c0467 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDialog.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDialog.java
@@ -8,6 +8,7 @@ import org.chromium.content.browser.ContentViewCore;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.content.res.TypedArray;
import android.util.SparseBooleanArray;
import android.view.View;
import android.view.ViewGroup;
@@ -17,6 +18,8 @@ import android.widget.ArrayAdapter;
import android.widget.CheckedTextView;
import android.widget.ListView;
+import org.chromium.content.R;
+
/**
* Handles the popup dialog for the <select> HTML tag support.
*/
@@ -24,6 +27,11 @@ public class SelectPopupDialog {
// The currently showing popup dialog, null if none is showing.
private static SelectPopupDialog sShownDialog;
+ private static final int[] SELECT_DIALOG_ATTRS = {
+ R.attr.select_dialog_multichoice,
+ R.attr.select_dialog_singlechoice
+ };
+
// The dialog hosting the popup list view.
private AlertDialog mListBoxPopup = null;
@@ -48,9 +56,7 @@ public class SelectPopupDialog {
private boolean mAreAllItemsEnabled;
public SelectPopupArrayAdapter(String[] labels, int[] enabled, boolean multiple) {
- super(mContentViewCore.getContext(), multiple ?
- android.R.layout.select_dialog_multichoice :
- android.R.layout.select_dialog_singlechoice, labels);
+ super(mContentViewCore.getContext(), getSelectDialogLayout(multiple), labels);
mItemEnabled = enabled;
mAreAllItemsEnabled = true;
for (int item : mItemEnabled) {
@@ -99,6 +105,15 @@ public class SelectPopupDialog {
}
}
+ private int getSelectDialogLayout(boolean isMultiChoice) {
+ int resource_id;
+ TypedArray styledAttributes = mContentViewCore.getContext().obtainStyledAttributes(
+ R.style.SelectPopupDialog, SELECT_DIALOG_ATTRS);
+ resource_id = styledAttributes.getResourceId(isMultiChoice ? 0 : 1, 0);
+ styledAttributes.recycle();
+ return resource_id;
+ }
+
private SelectPopupDialog(ContentViewCore contentViewCore, String[] labels, int[] enabled,
boolean multiple, int[] selected) {
mContentViewCore = contentViewCore;
« no previous file with comments | « content/public/android/java/resource_map/org/chromium/content/R.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698