diff options
author | John Reck <jreck@google.com> | 2011-09-06 15:30:11 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-09-06 15:30:11 -0700 |
commit | 8d021aa02f8f9e7f167649dbe83832827b0454e3 (patch) | |
tree | 52a24cea954f6c9a4f02c88ad527a0a16cc9bda6 /src/com/android/browser/UrlInputView.java | |
parent | 6d3975f136ea15fa4390edccaa78b95adf1b85d9 (diff) | |
download | packages_apps_Browser-8d021aa02f8f9e7f167649dbe83832827b0454e3.zip packages_apps_Browser-8d021aa02f8f9e7f167649dbe83832827b0454e3.tar.gz packages_apps_Browser-8d021aa02f8f9e7f167649dbe83832827b0454e3.tar.bz2 |
Grid align omnibox on tablet
Bug: 5155161
Offset for popup window padding
Change-Id: I586bdfdffdd0c21466001492ecae8d74f3581617
Diffstat (limited to 'src/com/android/browser/UrlInputView.java')
-rw-r--r-- | src/com/android/browser/UrlInputView.java | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java index fbdf400..96ab864 100644 --- a/src/com/android/browser/UrlInputView.java +++ b/src/com/android/browser/UrlInputView.java @@ -18,8 +18,10 @@ package com.android.browser; import android.content.Context; import android.content.res.Configuration; +import android.content.res.TypedArray; import android.database.DataSetObserver; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Patterns; @@ -41,6 +43,7 @@ import com.android.browser.autocomplete.SuggestiveAutoCompleteTextView; import com.android.browser.search.SearchEngine; import com.android.browser.search.SearchEngineInfo; import com.android.browser.search.SearchEngines; +import com.android.internal.R; import java.util.List; @@ -77,20 +80,27 @@ public class UrlInputView extends SuggestiveAutoCompleteTextView private int mState; private StateListener mStateListener; + private Rect mPopupPadding; public UrlInputView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); + TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.PopupWindow, + R.attr.autoCompleteTextViewStyle, 0); + + Drawable popupbg = a.getDrawable(R.styleable.PopupWindow_popupBackground); + a.recycle(); + mPopupPadding = new Rect(); + popupbg.getPadding(mPopupPadding); init(context); } public UrlInputView(Context context, AttributeSet attrs) { - super(context, attrs); - init(context); + this(context, attrs, R.attr.autoCompleteTextViewStyle); } public UrlInputView(Context context) { - super(context); - init(context); + this(context, null); } private void init(Context ctx) { @@ -233,11 +243,14 @@ public class UrlInputView extends SuggestiveAutoCompleteTextView private void setupDropDown() { int width = mContainer != null ? mContainer.getWidth() : getWidth(); + width += mPopupPadding.left + mPopupPadding.right; if (width != getDropDownWidth()) { setDropDownWidth(width); } - if (getLeft() != -getDropDownHorizontalOffset()) { - setDropDownHorizontalOffset(-getLeft()); + int left = getLeft(); + left += mPopupPadding.left; + if (left != -getDropDownHorizontalOffset()) { + setDropDownHorizontalOffset(-left); } } |