| Index: ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
|
| diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
|
| index 62203dc70a802f4c7268cb3cbbd920f77e4f1956..f15b91b13db5ba6841e71c621252e276b98e4a99 100644
|
| --- a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
|
| +++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
|
| @@ -6,26 +6,36 @@
|
| package org.chromium.ui.autofill;
|
|
|
| import android.content.Context;
|
| +import android.content.res.Resources;
|
| +import android.graphics.Color;
|
| +import android.graphics.drawable.LayerDrawable;
|
| import android.text.TextUtils;
|
| -
|
| import android.view.LayoutInflater;
|
| import android.view.View;
|
| import android.view.ViewGroup;
|
| +import android.widget.AbsListView.LayoutParams;
|
| import android.widget.ArrayAdapter;
|
| import android.widget.TextView;
|
|
|
| import org.chromium.ui.R;
|
|
|
| +import org.chromium.base.ApiCompatibilityUtils;
|
| +
|
| import java.util.ArrayList;
|
| +import java.util.Set;
|
|
|
| /**
|
| * Autofill suggestion adapter for AutofillWindow.
|
| */
|
| public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> {
|
| private Context mContext;
|
| + private Set<Integer> mSeparators;
|
|
|
| - AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects) {
|
| + AutofillListAdapter(Context context,
|
| + ArrayList<AutofillSuggestion> objects,
|
| + Set<Integer> separators) {
|
| super(context, R.layout.autofill_text, objects);
|
| + mSeparators = separators;
|
| mContext = context;
|
| }
|
|
|
| @@ -36,10 +46,30 @@ public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> {
|
| LayoutInflater inflater =
|
| (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
| layout = inflater.inflate(R.layout.autofill_text, null);
|
| + ApiCompatibilityUtils.setBackgroundForView(layout, new AutofillDividerDrawable());
|
| }
|
| TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
|
| labelView.setText(getItem(position).mLabel);
|
|
|
| + AutofillDividerDrawable divider = (AutofillDividerDrawable) layout.getBackground();
|
| + int height = mContext.getResources().getDimensionPixelSize(R.dimen.autofill_text_height);
|
| + if (position == 0) {
|
| + divider.setColor(Color.TRANSPARENT);
|
| + } else {
|
| + int dividerHeight = mContext.getResources().getDimensionPixelSize(
|
| + R.dimen.autofill_text_divider_height);
|
| + height += dividerHeight;
|
| + divider.setHeight(dividerHeight);
|
| + if (mSeparators.contains(position)) {
|
| + divider.setColor(mContext.getResources().getColor(
|
| + R.color.autofill_dark_divider_color));
|
| + } else {
|
| + divider.setColor(mContext.getResources().getColor(
|
| + R.color.autofill_divider_color));
|
| + }
|
| + }
|
| + layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, height));
|
| +
|
| TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
|
| CharSequence sublabel = getItem(position).mSublabel;
|
| if (TextUtils.isEmpty(sublabel)) {
|
|
|