diff options
Diffstat (limited to 'chips')
-rw-r--r-- | chips/res/values/dimen.xml | 1 | ||||
-rw-r--r-- | chips/res/values/styles.xml | 2 | ||||
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 11 |
3 files changed, 12 insertions, 2 deletions
diff --git a/chips/res/values/dimen.xml b/chips/res/values/dimen.xml index dc3aadf..b93555f 100644 --- a/chips/res/values/dimen.xml +++ b/chips/res/values/dimen.xml @@ -18,4 +18,5 @@ <dimen name="chip_padding">8dip</dimen> <dimen name="chip_height">32dip</dimen> <dimen name="chip_text_size">14sp</dimen> + <dimen name="line_spacing_extra">4dip</dimen> </resources>
\ No newline at end of file diff --git a/chips/res/values/styles.xml b/chips/res/values/styles.xml index 2b04b4f..8e2abf9 100644 --- a/chips/res/values/styles.xml +++ b/chips/res/values/styles.xml @@ -24,6 +24,6 @@ <item name="android:dropDownVerticalOffset">-6dip</item> <item name="android:dropDownHorizontalOffset">-16dip</item> <item name="android:minHeight">48dip</item> - <item name="android:lineSpacingExtra">4dip</item> + <item name="android:lineSpacingExtra">@dimen/line_spacing_extra</item> </style> </resources> 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); |