summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-10-07 19:44:42 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-07 19:44:42 +0000
commit0c0d9e12a71450ec04be14c1692ec0d049599211 (patch)
tree948b6d41e284324feb697603abd7176c4c372507
parent62cb4dc5b1d6f09f413b6601df825b12e2d97ec4 (diff)
parent93d69f407e258e42705c4cc706d6705f45d48761 (diff)
downloadandroid_frameworks_opt_chips-0c0d9e12a71450ec04be14c1692ec0d049599211.tar.gz
android_frameworks_opt_chips-0c0d9e12a71450ec04be14c1692ec0d049599211.tar.bz2
android_frameworks_opt_chips-0c0d9e12a71450ec04be14c1692ec0d049599211.zip
am 93d69f40: Use dropdown anchor to compute dropdown height
* commit '93d69f407e258e42705c4cc706d6705f45d48761': Use dropdown anchor to compute dropdown height
-rw-r--r--src/com/android/ex/chips/RecipientEditTextView.java13
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 3bf9461..4504a89 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;
@@ -345,6 +346,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
@@ -528,12 +534,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();
}