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..9dffaad497e1d8a0b46492cf03368d88b9e9071f 100644 |
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java |
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java |
@@ -6,8 +6,10 @@ |
package org.chromium.ui.autofill; |
import android.content.Context; |
+import android.graphics.Color; |
+import android.graphics.drawable.GradientDrawable; |
newt (away)
2013/09/09 20:20:42
unused
keishi
2013/09/19 11:53:05
Done.
|
+import android.graphics.drawable.LayerDrawable; |
import android.text.TextUtils; |
- |
import android.view.LayoutInflater; |
import android.view.View; |
import android.view.ViewGroup; |
@@ -17,15 +19,20 @@ import android.widget.TextView; |
import org.chromium.ui.R; |
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 +43,30 @@ public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> { |
LayoutInflater inflater = |
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
layout = inflater.inflate(R.layout.autofill_text, null); |
+ layout.setBackground(new AutofillDividerDrawable()); |
} |
TextView labelView = (TextView) layout.findViewById(R.id.autofill_label); |
labelView.setText(getItem(position).mLabel); |
+ int dividerColor; |
+ int dividerWidth; |
+ if (position == 0) { |
+ dividerWidth = 0; |
+ dividerColor = Color.TRANSPARENT; |
+ } else { |
+ dividerWidth = 1; |
+ if (mSeparators.contains(position)) { |
+ dividerColor = mContext.getResources().getColor( |
+ R.color.autofill_dark_divider_color); |
+ } else { |
+ dividerColor = mContext.getResources().getColor(R.color.autofill_divider_color); |
+ } |
+ } |
+ layout.setPaddingRelative(layout.getPaddingStart(), dividerWidth, |
newt (away)
2013/09/09 20:20:42
getPaddingX() returns user-specific padding plus i
keishi
2013/09/10 09:19:56
The default ListView seems to have a default divid
newt (away)
2013/09/10 17:45:10
divider_horizontal_dark_opaque.9.png is just a sin
keishi
2013/09/19 11:53:05
I'm not sure what you are getting at. We don't use
|
+ layout.getPaddingEnd(), layout.getPaddingBottom()); |
+ AutofillDividerDrawable divider = (AutofillDividerDrawable) layout.getBackground(); |
+ divider.setColor(dividerColor); |
newt (away)
2013/09/09 20:20:42
and add divider.setHeight() here
|
+ |
TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel); |
CharSequence sublabel = getItem(position).mSublabel; |
if (TextUtils.isEmpty(sublabel)) { |