diff options
| author | Jin Cao <jinyan@google.com> | 2014-10-07 12:27:49 -0700 |
|---|---|---|
| committer | Jin Cao <jinyan@google.com> | 2014-10-07 12:32:37 -0700 |
| commit | 93d69f407e258e42705c4cc706d6705f45d48761 (patch) | |
| tree | 789400d393d9d097b24e5d0c6a25e7f377a5d025 | |
| parent | 26f4cfbe018c482f8b332912f6cac7e629cc88e0 (diff) | |
| download | android_frameworks_opt_chips-93d69f407e258e42705c4cc706d6705f45d48761.tar.gz android_frameworks_opt_chips-93d69f407e258e42705c4cc706d6705f45d48761.tar.bz2 android_frameworks_opt_chips-93d69f407e258e42705c4cc706d6705f45d48761.zip | |
Use dropdown anchor to compute dropdown height
In case the dropdown anchor is not set to itself, use
the anchor to properly compute the remaining height
from the bottom of the view to bottom of the screen.
b/17824127
Change-Id: Ic588f4ad6cede7ed22074ff7ed91843dca00a689
| -rw-r--r-- | src/com/android/ex/chips/RecipientEditTextView.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java index 6b25b8f..9310639 100644 --- a/src/com/android/ex/chips/RecipientEditTextView.java +++ b/src/com/android/ex/chips/RecipientEditTextView.java @@ -175,6 +175,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private TextWatcher mTextWatcher; private DropdownChipLayouter mDropdownChipLayouter; + private View mDropdownAnchor = this; private ListPopupWindow mAlternatesPopup; private ListPopupWindow mAddressPopup; private View mAlternatePopupAnchor; @@ -346,6 +347,11 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements protected void onAttachedToWindow() { super.onAttachedToWindow(); mAttachedToWindow = true; + + final int anchorId = getDropDownAnchor(); + if (anchorId != View.NO_ID) { + mDropdownAnchor = getRootView().findViewById(anchorId); + } } @Override @@ -529,12 +535,13 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements R.string.accessbility_suggestion_dropdown_opened)); } } - // Set the dropdown height to be the remaining height + + // Set the dropdown height to be the remaining height from the anchor to the bottom. final int[] coords = new int[2]; - getLocationInWindow(coords); + mDropdownAnchor.getLocationInWindow(coords); final Rect displayFrame = new Rect(); getWindowVisibleDisplayFrame(displayFrame); - setDropDownHeight(displayFrame.bottom - coords[1] - getHeight()); + setDropDownHeight(displayFrame.bottom - coords[1] - mDropdownAnchor.getHeight()); mCurrentSuggestionCount = entries == null ? 0 : entries.size(); } |
