| Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| index c1b5d9a965a75ac31c72084c30c9ec12cdb556e9..082c3ca19b39fc7c3895314e70d51299525d4387 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| @@ -45,8 +45,8 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
| private float mAnchorHeight;
|
| private float mAnchorX;
|
| private float mAnchorY;
|
| - private Paint mNameViewPaint;
|
| private Paint mLabelViewPaint;
|
| + private Paint mSublabelViewPaint;
|
| private OnLayoutChangeListener mLayoutChangeListener;
|
|
|
| /**
|
| @@ -159,34 +159,32 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
| * @return The popup window width in DIP.
|
| */
|
| private float getDesiredWidth(AutofillSuggestion[] data) {
|
| - if (mNameViewPaint == null || mLabelViewPaint == null) {
|
| + if (mLabelViewPaint == null || mSublabelViewPaint == null) {
|
| LayoutInflater inflater =
|
| (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
| View layout = inflater.inflate(R.layout.autofill_text, null);
|
| - TextView nameView = (TextView) layout.findViewById(R.id.autofill_name);
|
| - mNameViewPaint = nameView.getPaint();
|
| TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
|
| mLabelViewPaint = labelView.getPaint();
|
| + TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
|
| + mSublabelViewPaint = sublabelView.getPaint();
|
| }
|
|
|
| float maxTextWidth = 0;
|
| Rect bounds = new Rect();
|
| for (int i = 0; i < data.length; ++i) {
|
| bounds.setEmpty();
|
| - String name = data[i].mName;
|
| - float width = 0;
|
| - if (name.length() > 0) {
|
| - mNameViewPaint.getTextBounds(name, 0, name.length(), bounds);
|
| - }
|
| - width += bounds.width();
|
| -
|
| - bounds.setEmpty();
|
| String label = data[i].mLabel;
|
| if (label.length() > 0) {
|
| mLabelViewPaint.getTextBounds(label, 0, label.length(), bounds);
|
| }
|
| - width += bounds.width();
|
| - maxTextWidth = Math.max(width, maxTextWidth);
|
| + float width = bounds.width();
|
| + bounds.setEmpty();
|
| + String sublabel = data[i].mSublabel;
|
| + if (sublabel.length() > 0) {
|
| + mSublabelViewPaint.getTextBounds(sublabel, 0, sublabel.length(), bounds);
|
| + }
|
| + width = Math.max(width, bounds.width());
|
| + maxTextWidth = Math.max(maxTextWidth, width);
|
| }
|
| // Scale it down to make it unscaled by screen density.
|
| maxTextWidth = maxTextWidth / mContext.getResources().getDisplayMetrics().density;
|
|
|