summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 10:09:10 +0000
committerprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 10:09:10 +0000
commit5803335489a869968273ed1ca8208bfeca2d1dd0 (patch)
tree75ec305fec3486810788ca727e455354709980b1
parent8cd3f3d465eeb69e92c1cd3ca4de0cad5515c75c (diff)
downloadchromium_src-5803335489a869968273ed1ca8208bfeca2d1dd0.zip
chromium_src-5803335489a869968273ed1ca8208bfeca2d1dd0.tar.gz
chromium_src-5803335489a869968273ed1ca8208bfeca2d1dd0.tar.bz2
Merge 221396 "[Android] SelectPopupDialog - resolve style for <s..."
> [Android] SelectPopupDialog - resolve style for <select> dialogs. > > Right now the <select> dialogs use directly > R.layout.select_dialog_(multi|single)choice defined in the Android > framework. Adding an extra level of indirection to them through attrs > since other builds need to override these two layouts. > > BUG=285270 > NOTRY=true > > Review URL: https://chromiumcodereview.appspot.com/23523025 TBR=primiano@chromium.org Review URL: https://codereview.chromium.org/23597031 git-svn-id: svn://svn.chromium.org/chrome/branches/1599/src@222490 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/public/android/java/res/values-v17/styles.xml4
-rw-r--r--content/public/android/java/res/values/attrs.xml2
-rw-r--r--content/public/android/java/resource_map/org/chromium/content/R.java3
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDialog.java21
4 files changed, 27 insertions, 3 deletions
diff --git a/content/public/android/java/res/values-v17/styles.xml b/content/public/android/java/res/values-v17/styles.xml
index 5e57a74..aaeb6d7 100644
--- a/content/public/android/java/res/values-v17/styles.xml
+++ b/content/public/android/java/res/values-v17/styles.xml
@@ -10,4 +10,8 @@
<item name="action_mode_share_drawable">@drawable/ic_menu_share_holo_light</item>
<item name="action_mode_web_search_drawable">@drawable/ic_menu_search_holo_light</item>
</style>
+ <style name="SelectPopupDialog">
+ <item name="select_dialog_singlechoice">@android:layout/select_dialog_singlechoice</item>
+ <item name="select_dialog_multichoice">@android:layout/select_dialog_multichoice</item>
+ </style>
</resources>
diff --git a/content/public/android/java/res/values/attrs.xml b/content/public/android/java/res/values/attrs.xml
index d4268bc..8014143 100644
--- a/content/public/android/java/res/values/attrs.xml
+++ b/content/public/android/java/res/values/attrs.xml
@@ -8,4 +8,6 @@
<resources>
<attr name="action_mode_share_drawable" format="reference" />
<attr name="action_mode_web_search_drawable" format="reference" />
+ <attr name="select_dialog_multichoice" format="reference" />
+ <attr name="select_dialog_singlechoice" format="reference" />
</resources>
diff --git a/content/public/android/java/resource_map/org/chromium/content/R.java b/content/public/android/java/resource_map/org/chromium/content/R.java
index 6c80745..6204c72 100644
--- a/content/public/android/java/resource_map/org/chromium/content/R.java
+++ b/content/public/android/java/resource_map/org/chromium/content/R.java
@@ -19,6 +19,8 @@ public final class R {
public static final class attr {
public static int action_mode_share_drawable;
public static int action_mode_web_search_drawable;
+ public static int select_dialog_multichoice;
+ public static int select_dialog_singlechoice;
}
public static final class dimen {
public static int link_preview_overlay_radius;
@@ -60,5 +62,6 @@ public final class R {
}
public static final class style {
public static int ContentActionBar;
+ public static int SelectPopupDialog;
}
}
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 d32266b..4db838e 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;