summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSungmann Cho <sungmann.cho@navercorp.com>2014-02-27 20:45:20 +0900
committerSungmann Cho <sungmann.cho@navercorp.com>2014-02-27 20:45:20 +0900
commit36b87b1acb4212147a9d5a2b159a174413050863 (patch)
tree5dee9fe73a352d399e03224e39ff39380a6a657a /src
parentc34de1799596e1659c5edea61f89e807c8119705 (diff)
downloadpackages_apps_Browser-36b87b1acb4212147a9d5a2b159a174413050863.zip
packages_apps_Browser-36b87b1acb4212147a9d5a2b159a174413050863.tar.gz
packages_apps_Browser-36b87b1acb4212147a9d5a2b159a174413050863.tar.bz2
Fix the problem that the layout of the suggestion drop down list does not fit to the screen width when an orientation changes.
Steps to reproduce: 1. Set the orientation of the Browser to landscape mode. 2. Type some keys in the url input view to show some suggestions. 3. Set the orientation to portrait mode again. What heppended: The width of the suggestion layout exceeds the screen width. The arrow icon on the right side couldn't be seen. Additional comments: On some devices, setupDropDown() doesn't work correctly. On the Samsung Galaxy S3, for instance, setupDropDown() produces left-hand margins. The simplest way to fix these problems is to call setDropDownAnchor() when the url input view is created. Change-Id: Icfe979033da235a960b8b306f291802cb7c46646 Signed-off-by: Sungmann Cho <sungmann.cho@navercorp.com>
Diffstat (limited to 'src')
-rwxr-xr-x[-rw-r--r--]src/com/android/browser/UrlInputView.java33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index 02bba3c..b310ba1 100644..100755
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -76,18 +76,9 @@ public class UrlInputView extends AutoCompleteTextView
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);
}
@@ -110,7 +101,7 @@ public class UrlInputView extends AutoCompleteTextView
setOnItemClickListener(this);
mNeedsUpdate = false;
addTextChangedListener(this);
-
+ setDropDownAnchor(com.android.browser.R.id.taburlbar);
mState = StateListener.STATE_NORMAL;
}
@@ -201,36 +192,18 @@ public class UrlInputView extends AutoCompleteTextView
Configuration.ORIENTATION_LANDSCAPE) != 0;
mAdapter.setLandscapeMode(mLandscape);
if (isPopupShowing() && (getVisibility() == View.VISIBLE)) {
- setupDropDown();
+ dismissDropDown();
+ showDropDown();
performFiltering(getText(), 0);
}
}
@Override
- public void showDropDown() {
- setupDropDown();
- super.showDropDown();
- }
-
- @Override
public void dismissDropDown() {
super.dismissDropDown();
mAdapter.clearCache();
}
- private void setupDropDown() {
- int width = mContainer != null ? mContainer.getWidth() : getWidth();
- width += mPopupPadding.left + mPopupPadding.right;
- if (width != getDropDownWidth()) {
- setDropDownWidth(width);
- }
- int left = getLeft();
- left += mPopupPadding.left;
- if (left != -getDropDownHorizontalOffset()) {
- setDropDownHorizontalOffset(-left);
- }
- }
-
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
finishInput(getText().toString(), null, TYPED);