diff options
author | Mindy Pereira <mindyp@google.com> | 2012-05-23 16:11:47 -0700 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2012-05-23 16:11:47 -0700 |
commit | 9c5e04038d482571b9373a118c9dfc50e4e18505 (patch) | |
tree | d91f6839150bac52ff51dca1cca5f0914422323c /chips/src/com/android | |
parent | 291e619b2b2ced9abe53fc97613f5707319325bb (diff) | |
download | android_frameworks_ex-9c5e04038d482571b9373a118c9dfc50e4e18505.tar.gz android_frameworks_ex-9c5e04038d482571b9373a118c9dfc50e4e18505.tar.bz2 android_frameworks_ex-9c5e04038d482571b9373a118c9dfc50e4e18505.zip |
Fix offset of alternates list dropdown.
Fixes b/6546711 Chips suggestion is below selected chip
Change-Id: I14821855b510b30e8eb4798eb4cc4a9c69f4dca9
Diffstat (limited to 'chips/src/com/android')
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index 9ce792a..ac3caa8 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -132,6 +132,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private float mChipFontSize; + private float mLineSpacingExtra; + private int mChipPadding; private Tokenizer mTokenizer; @@ -675,6 +677,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements if (mInvalidChipBackground == null) { mInvalidChipBackground = r.getDrawable(R.drawable.chip_background_invalid); } + mLineSpacingExtra = context.getResources().getDimension(R.dimen.line_spacing_extra); a.recycle(); } @@ -1342,7 +1345,13 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private void showAlternates(RecipientChip currentChip, ListPopupWindow alternatesPopup, int width, Context context) { int line = getLayout().getLineForOffset(getChipStart(currentChip)); - int bottom = calculateOffsetFromBottom(line); + int bottom; + if (line == getLineCount() -1) { + bottom = 0; + } else { + bottom = -(int) ((mChipHeight + (2 * mLineSpacingExtra)) * (Math.abs(getLineCount() - 1 + - line))); + } // Align the alternates popup with the left side of the View, // regardless of the position of the chip tapped. alternatesPopup.setWidth(width); |