summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlinus_lee <llee@cyngn.com>2015-01-26 15:44:21 -0800
committerSteve Kondik <steve@cyngn.com>2015-10-18 14:16:07 -0700
commitffe00d22a60cc512080b0ea4f242f1ed5216bcb4 (patch)
tree4a2f604c168c8adc3a50f33f92b93f3a9fa9a936
parent001309fceea6e1b84c59479dbba5df9dd42587a8 (diff)
downloadandroid_frameworks_opt_chips-ffe00d22a60cc512080b0ea4f242f1ed5216bcb4.tar.gz
android_frameworks_opt_chips-ffe00d22a60cc512080b0ea4f242f1ed5216bcb4.tar.bz2
android_frameworks_opt_chips-ffe00d22a60cc512080b0ea4f242f1ed5216bcb4.zip
Chips: Fix some crashes and missing default icon scenario
Handle a NPE when directoryId is null Handle a NPE when the contact has no address Set the default icon for SINGLE_RECIPIENT or else there is a blank space Change-Id: Ic1231ed5d25cb4a567898f7b72abeb8880b3256c
-rw-r--r--src/com/android/ex/chips/DropdownChipLayouter.java1
-rw-r--r--src/com/android/ex/chips/RecipientEditTextView.java23
2 files changed, 14 insertions, 10 deletions
diff --git a/src/com/android/ex/chips/DropdownChipLayouter.java b/src/com/android/ex/chips/DropdownChipLayouter.java
index 170008f..3c6d988 100644
--- a/src/com/android/ex/chips/DropdownChipLayouter.java
+++ b/src/com/android/ex/chips/DropdownChipLayouter.java
@@ -231,6 +231,7 @@ public class DropdownChipLayouter {
break;
case SINGLE_RECIPIENT:
default:
+ view.setImageResource(getDefaultPhotoResId());
break;
}
view.setVisibility(View.VISIBLE);
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java
index 2308da0..92bd65c 100644
--- a/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/src/com/android/ex/chips/RecipientEditTextView.java
@@ -2884,16 +2884,19 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
.getContactId())
&& getSpannable().getSpanStart(temp) != -1) {
// Replace this.
- final RecipientEntry entry = createValidatedEntry(entries
- .get(tokenizeAddress(temp.getEntry().getDestination())
- .toLowerCase()));
- if (entry != null) {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- replaceChip(temp, entry);
- }
- });
+ final String address = tokenizeAddress(
+ temp.getEntry().getDestination());
+ if (!TextUtils.isEmpty(address)) {
+ final RecipientEntry entry = createValidatedEntry(entries
+ .get(address.toLowerCase()));
+ if (entry != null) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ replaceChip(temp, entry);
+ }
+ });
+ }
}
}
}