| Index: ui/android/java/src/org/chromium/ui/DropdownAdapter.java
|
| diff --git a/ui/android/java/src/org/chromium/ui/DropdownAdapter.java b/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
|
| index 2b561d19bd51378f6a5dea6ba6b8e747a3178cb5..5fa072774ed58338f4d09135e1c78b451f891c93 100644
|
| --- a/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
|
| +++ b/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
|
| @@ -5,6 +5,7 @@
|
| package org.chromium.ui;
|
|
|
| import android.content.Context;
|
| +import android.graphics.Bitmap;
|
| import android.graphics.Color;
|
| import android.graphics.Typeface;
|
| import android.text.TextUtils;
|
| @@ -13,6 +14,7 @@ import android.view.View;
|
| import android.view.ViewGroup;
|
| import android.widget.AbsListView.LayoutParams;
|
| import android.widget.ArrayAdapter;
|
| +import android.widget.ImageView;
|
| import android.widget.TextView;
|
|
|
| import org.chromium.base.ApiCompatibilityUtils;
|
| @@ -62,18 +64,6 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
|
| ApiCompatibilityUtils.setBackgroundForView(layout, new DropdownDividerDrawable());
|
| }
|
|
|
| - DropdownItem item = getItem(position);
|
| -
|
| - TextView labelView = (TextView) layout.findViewById(R.id.dropdown_label);
|
| - labelView.setText(item.getLabel());
|
| -
|
| - labelView.setEnabled(item.isEnabled());
|
| - if (item.isGroupHeader()) {
|
| - labelView.setTypeface(null, Typeface.BOLD);
|
| - } else {
|
| - labelView.setTypeface(null, Typeface.NORMAL);
|
| - }
|
| -
|
| DropdownDividerDrawable divider = (DropdownDividerDrawable) layout.getBackground();
|
| int height = mContext.getResources().getDimensionPixelSize(R.dimen.dropdown_item_height);
|
| if (position == 0) {
|
| @@ -93,7 +83,19 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
|
| }
|
| layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, height));
|
|
|
| - TextView sublabelView = (TextView) layout.findViewById(R.id.dropdown_sublabel);
|
| + View labelLayout = layout.findViewById(R.id.dropdown_menu_text);
|
| + DropdownItem item = getItem(position);
|
| + TextView labelView = (TextView) labelLayout.findViewById(R.id.dropdown_label);
|
| + labelView.setText(item.getLabel());
|
| +
|
| + labelView.setEnabled(item.isEnabled());
|
| + if (item.isGroupHeader()) {
|
| + labelView.setTypeface(null, Typeface.BOLD);
|
| + } else {
|
| + labelView.setTypeface(null, Typeface.NORMAL);
|
| + }
|
| +
|
| + TextView sublabelView = (TextView) labelLayout.findViewById(R.id.dropdown_sublabel);
|
| CharSequence sublabel = item.getSublabel();
|
| if (TextUtils.isEmpty(sublabel)) {
|
| sublabelView.setVisibility(View.GONE);
|
| @@ -102,6 +104,15 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
|
| sublabelView.setVisibility(View.VISIBLE);
|
| }
|
|
|
| + ImageView iconView = (ImageView) layout.findViewById(R.id.dropdown_icon);
|
| + Bitmap icon = item.getIcon();
|
| + if (icon == null) {
|
| + iconView.setVisibility(View.GONE);
|
| + } else {
|
| + iconView.setImageBitmap(icon);
|
| + iconView.setVisibility(View.VISIBLE);
|
| + }
|
| +
|
| return layout;
|
| }
|
|
|
|
|