am 02840dc1: am 9c5e0403: Fix offset of alternates list dropdown.

* commit '02840dc19cf49bb4fa1e7234bcdb0f573c3c37e1':
  Fix offset of alternates list dropdown.
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 @@
 
     private float mChipFontSize;
 
+    private float mLineSpacingExtra;
+
     private int mChipPadding;
 
     private Tokenizer mTokenizer;
@@ -675,6 +677,7 @@
         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 @@
     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);