De-select on tap. Also give min width to a chip.

If the user clicks a selected chip, unselect it.
Make sure all chips have a minimum width (right now
2X the width of the delete icon) so that there is
always a tappable area regardless of how short the name is.
Also make sure the bounds of the chip do not change in selected
vs unselected mode.
Change-Id: I8bc2302cc7602c62eac727cf77306aac37c27ed4
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java
index 97e031a..32b2a23 100644
--- a/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/src/com/android/ex/chips/RecipientEditTextView.java
@@ -149,14 +149,11 @@
                 calculateAvailableWidth(pressed), TextUtils.TruncateAt.END);
 
         int height = getLineHeight();
-        int width = (int) Math.floor(paint.measureText(ellipsizedText, 0, ellipsizedText.length()))
-                + (mChipPadding * 2);
-        if (pressed) {
-            // Allow the delete icon to overtake the visible recipient name.
-            // This works since when the user has entered selected mode, they
-            // will also see a popup with the recipient name.
-            width += mChipDeleteWidth/2;
-        }
+        // Make sure there is a minimum chip width so the user can ALWAYS
+        // tap a chip without difficulty.
+        int width = Math.max(mChipDeleteWidth * 2, (int) Math.floor(paint.measureText(
+                ellipsizedText, 0, ellipsizedText.length()))
+                + (mChipPadding * 2));
 
         // Create the background of the chip.
         Bitmap tmpBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
@@ -695,7 +692,8 @@
             if (mSelected) {
                 if (isInDelete(offset, x, y)) {
                     removeChip();
-                    return;
+                } else {
+                    clearSelectedChip();
                 }
             }
         }