Merge "Auto dismiss popups when touches happen outside the popup window" into ub-chips-cranbrook
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java
index 2e6b94b..ef0077e 100644
--- a/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/src/com/android/ex/chips/RecipientEditTextView.java
@@ -528,7 +528,8 @@
                 // Set the dropdown height to be the remaining height from the anchor to the bottom.
                 mDropdownAnchor.getLocationInWindow(mCoords);
                 getWindowVisibleDisplayFrame(mRect);
-                setDropDownHeight(mRect.bottom - mCoords[1] - mDropdownAnchor.getHeight());
+                setDropDownHeight(mRect.bottom - mCoords[1] - mDropdownAnchor.getHeight() -
+                    getDropDownVerticalOffset());
 
                 mCurrentSuggestionCount = entries == null ? 0 : entries.size();
             }
@@ -1636,7 +1637,11 @@
         return false;
     }
 
-    private void clearSelectedChip() {
+    /**
+     * Clears the selected chip if there is one (and dismissing any popups related to the selected
+     * chip in the process).
+     */
+    public void clearSelectedChip() {
         if (mSelectedChip != null) {
             unselectChip(mSelectedChip);
             mSelectedChip = null;