| Index: content/public/android/java/src/org/chromium/content/browser/input/SingleSelectPopupAdapter.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/SingleSelectPopupAdapter.java
|
| similarity index 52%
|
| copy from content/public/android/java/src/org/chromium/content/browser/input/SelectPopupAdapter.java
|
| copy to content/public/android/java/src/org/chromium/content/browser/input/SingleSelectPopupAdapter.java
|
| index ca8e5f0e52181de3433c592e777297a3d4cbfffa..03928aa80512e5e580a9252f2a3afc33aa584802 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupAdapter.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/SingleSelectPopupAdapter.java
|
| @@ -8,9 +8,10 @@ import android.content.Context;
|
| import android.view.View;
|
| import android.view.ViewGroup;
|
| import android.widget.ArrayAdapter;
|
| -import android.widget.CheckedTextView;
|
| import android.widget.TextView;
|
|
|
| +import org.chromium.content.R;
|
| +
|
| import java.util.ArrayList;
|
| import java.util.List;
|
|
|
| @@ -18,7 +19,7 @@ import java.util.List;
|
| * Select popup item adapter for SelectPopupDialog, used so we can disable
|
| * OPTION_GROUP items.
|
| */
|
| -public class SelectPopupAdapter extends ArrayAdapter<SelectPopupItem> {
|
| +public class SingleSelectPopupAdapter extends ArrayAdapter<SelectPopupItem> {
|
| // Holds the items of the select popup alert dialog list.
|
| private List<SelectPopupItem> mItems;
|
|
|
| @@ -28,12 +29,10 @@ public class SelectPopupAdapter extends ArrayAdapter<SelectPopupItem> {
|
| /**
|
| * Creates a new SelectPopupItem adapter for the select popup alert dialog list.
|
| * @param context Application context.
|
| - * @param layoutResource Layout resource used for the alert dialog list.
|
| * @param items SelectPopupItem array list.
|
| */
|
| - public SelectPopupAdapter(Context context, int layoutResource,
|
| - List<SelectPopupItem> items) {
|
| - super(context, layoutResource, items);
|
| + public SingleSelectPopupAdapter(Context context, List<SelectPopupItem> items) {
|
| + super(context, R.layout.select_popup_item, items);
|
| mItems = new ArrayList<SelectPopupItem>(items);
|
|
|
| mAreAllItemsEnabled = true;
|
| @@ -49,28 +48,11 @@ public class SelectPopupAdapter extends ArrayAdapter<SelectPopupItem> {
|
| public View getView(int position, View convertView, ViewGroup parent) {
|
| if (position < 0 || position >= getCount()) return null;
|
|
|
| - // Always pass in null so that we will get a new CheckedTextView. Otherwise, an item
|
| - // which was previously used as an <optgroup> element (i.e. has no check), could get
|
| - // used as an <option> element, which needs a checkbox/radio, but it would not have
|
| - // one.
|
| - convertView = super.getView(position, null, parent);
|
| - ((TextView) convertView).setText(mItems.get(position).getLabel());
|
| -
|
| - if (mItems.get(position).getType() != PopupItemType.ENABLED) {
|
| - if (mItems.get(position).getType() == PopupItemType.GROUP) {
|
| - // Currently select_dialog_multichoice uses CheckedTextViews.
|
| - // If that changes, the class cast will no longer be valid.
|
| - // The WebView build cannot rely on this being the case, so
|
| - // we must check.
|
| - if (convertView instanceof CheckedTextView) {
|
| - ((CheckedTextView) convertView).setCheckMarkDrawable(null);
|
| - }
|
| - } else {
|
| - // Draw the disabled element in a disabled state.
|
| - convertView.setEnabled(false);
|
| - }
|
| - }
|
| - return convertView;
|
| + TextView textView = (TextView) super.getView(position, convertView, parent);
|
| + textView.setText(mItems.get(position).getLabel());
|
| + textView.setEnabled(mItems.get(position).getType() == PopupItemType.ENABLED ||
|
| + mItems.get(position).getType() == PopupItemType.GROUP);
|
| + return textView;
|
| }
|
|
|
| @Override
|
|
|