Commit f4abb38e authored by John Reck's avatar John Reck Committed by Gerrit Code Review
Browse files

Merge "Fix the problem that the layout of the suggestion drop down list does...

Merge "Fix the problem that the layout of the suggestion drop down list does not fit to the screen width when an orientation changes."
parents 17f5c2ec 36b87b1a
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment