diff options
author | John Reck <jreck@google.com> | 2011-09-06 15:56:33 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-06 15:56:33 -0700 |
commit | 4b97ed9959dfffc95a035f28430426b15a5a8957 (patch) | |
tree | c5a01a8eec35c4aa33fba13cd0c9f4d0fb4c91bf /src | |
parent | de607bef300e9f9c0cbf20d917a058ef4572c95f (diff) | |
parent | 8d021aa02f8f9e7f167649dbe83832827b0454e3 (diff) | |
download | packages_apps_Browser-4b97ed9959dfffc95a035f28430426b15a5a8957.zip packages_apps_Browser-4b97ed9959dfffc95a035f28430426b15a5a8957.tar.gz packages_apps_Browser-4b97ed9959dfffc95a035f28430426b15a5a8957.tar.bz2 |
Merge "Grid align omnibox on tablet"
Diffstat (limited to 'src')
-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); } } |