Chromium Code Reviews| 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..0d4355c813b785b9096948251e9bd4b0d525ca8b 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_singlechoice, |
| + R.attr.select_dialog_multichoice |
| + }; |
| + |
| // 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,12 @@ public class SelectPopupDialog { |
| } |
| } |
| + private int GetSelectDialogLayout(boolean multiple) { |
|
benm (inactive)
2013/09/04 16:43:02
nit, get (lower case 'g')
Primiano Tucci (use gerrit)
2013/09/04 17:03:47
Done.
|
| + TypedArray styledAttributes = mContentViewCore.getContext().obtainStyledAttributes( |
| + R.style.SelectPopupDialog, SELECT_DIALOG_ATTRS); |
| + return styledAttributes.getResourceId(multiple ? 1 : 0, 0); |
|
benm (inactive)
2013/09/04 16:43:02
According to the docs for TypedArray, you must cal
Primiano Tucci (use gerrit)
2013/09/04 17:03:47
Done.
|
| + } |
| + |
| private SelectPopupDialog(ContentViewCore contentViewCore, String[] labels, int[] enabled, |
| boolean multiple, int[] selected) { |
| mContentViewCore = contentViewCore; |