diff options
author | Mindy Pereira <mindyp@google.com> | 2011-10-03 13:46:43 -0700 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2011-10-03 14:18:01 -0700 |
commit | b3e42aaf97e476719cede047394718fd001fd79b (patch) | |
tree | 4bbcc5bff4b09fd0dc33cf019da1b6ea273fd684 /chips/src/com/android/ex/chips/RecipientChip.java | |
parent | 878b7cea14b1f8583611a7df58a4406b3eca34b6 (diff) | |
download | android_frameworks_ex-b3e42aaf97e476719cede047394718fd001fd79b.tar.gz android_frameworks_ex-b3e42aaf97e476719cede047394718fd001fd79b.tar.bz2 android_frameworks_ex-b3e42aaf97e476719cede047394718fd001fd79b.zip |
Revert "Make the space part of the replacement image span."
This reverts commit a1d52e9203ea3cdfc0d1c69a8a4f99445fdd5ca1
Also reverts later change:
https://android-git.corp.google.com/g/#/c/138160/3
That was made to remove code that took into account having a space not
covered by the span character.
Fixes tests cases to respect the space character again.
Change-Id: I96d52a5df4d01e757f72949cbcf3b1f582679a46
Diffstat (limited to 'chips/src/com/android/ex/chips/RecipientChip.java')
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientChip.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientChip.java b/chips/src/com/android/ex/chips/RecipientChip.java index 29ee4d0..41d950f 100644 --- a/chips/src/com/android/ex/chips/RecipientChip.java +++ b/chips/src/com/android/ex/chips/RecipientChip.java @@ -16,7 +16,6 @@ package com.android.ex.chips; -import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.text.style.DynamicDrawableSpan; @@ -42,7 +41,7 @@ import android.text.style.ImageSpan; private CharSequence mOriginalText; public RecipientChip(Drawable drawable, RecipientEntry entry, int offset) { - super(drawable, DynamicDrawableSpan.ALIGN_BOTTOM); + super(drawable, DynamicDrawableSpan.ALIGN_BASELINE); mDisplay = entry.getDisplayName(); mValue = entry.getDestination().trim(); mContactId = entry.getContactId(); @@ -101,16 +100,13 @@ import android.text.style.ImageSpan; } public void setOriginalText(String text) { + if (!TextUtils.isEmpty(text)) { + text = text.trim(); + } mOriginalText = text; } public CharSequence getOriginalText() { return !TextUtils.isEmpty(mOriginalText) ? mOriginalText : mEntry.getDestination(); } - - @Override - public int getSize(Paint paint, CharSequence text, int start, int end, - Paint.FontMetricsInt fm) { - return super.getSize(paint, text, start, end, fm) + (int) paint.measureText(" "); - } } |