summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuanQY <yuanqingyun@gmail.com>2012-11-10 10:03:31 +0800
committerYuanQY <yuanqingyun@gmail.com>2012-11-10 10:03:37 +0800
commite4f5e046d8daa5d1482f8d5a7dc792ace7a9187c (patch)
tree5a0ccb126cd08ca95716653bdc24daaa6f050134
parentd70fbfdbe1a7f73b7660081cfa356b9f83c49336 (diff)
downloadpackages_apps_Contacts-e4f5e046d8daa5d1482f8d5a7dc792ace7a9187c.tar.gz
packages_apps_Contacts-e4f5e046d8daa5d1482f8d5a7dc792ace7a9187c.tar.bz2
packages_apps_Contacts-e4f5e046d8daa5d1482f8d5a7dc792ace7a9187c.zip
Contacts: Fix T9 crash in Chinese.
The crash is due to the convert name to number, the number will long than the real name length. When highlight the name the position is out of array of the real name. Change-Id: I3d956f4a40939bb54914f54efb102e730e20339f
-rw-r--r--src/com/android/contacts/dialpad/T9SearchCache.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/com/android/contacts/dialpad/T9SearchCache.java b/src/com/android/contacts/dialpad/T9SearchCache.java
index 31ec53e22..db6b6b307 100644
--- a/src/com/android/contacts/dialpad/T9SearchCache.java
+++ b/src/com/android/contacts/dialpad/T9SearchCache.java
@@ -573,9 +573,12 @@ public class T9SearchCache implements ComponentCallbacks2 {
}
if (entry.matchId != -1) {
- nameBuilder.setSpan(new ForegroundColorSpan(mHighlightColor),
- start, start + mPrevInput.length(),
- Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+ if (start <= entry.value.length()
+ && start + mPrevInput.length() <= entry.value.length()) {
+ nameBuilder.setSpan(new ForegroundColorSpan(mHighlightColor),
+ start, start + mPrevInput.length(),
+ Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+ }
}
}