Fix the problem: suggestions arrow clipping
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>
Conflicts:
src/com/android/browser/UrlInputView.java
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
old mode 100644
new mode 100755
index 0ba05ef..738aec8
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -81,21 +81,9 @@
private int mState;
private StateListener mStateListener;
- private Rect mPopupPadding;
public UrlInputView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- // SWE_TODO : HARDCODED a random background - clean up
- /*
- TypedArray a = context.obtainStyledAttributes(
- attrs, R.styleable.PopupWindow,
- R.attr.autoCompleteTextViewStyle, 0);
-
- Drawable popupbg = a.getDrawable(R.styleable.PopupWindow_popupBackground);
- a.recycle(); */
- Drawable popupbg = context.getResources().getDrawable(android.R.drawable.editbox_background);
- mPopupPadding = new Rect();
- popupbg.getPadding(mPopupPadding);
init(context);
}
@@ -120,7 +108,7 @@
setOnItemClickListener(this);
mNeedsUpdate = false;
addTextChangedListener(this);
-
+ setDropDownAnchor(R.id.taburlbar);
mState = StateListener.STATE_NORMAL;
mContext = ctx;
@@ -216,36 +204,18 @@
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);