diff options
author | linus_lee <llee@cyngn.com> | 2015-01-26 15:44:21 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-08-29 10:37:24 -0700 |
commit | abef0389df9cf85a9532dda519ddd0bf37f5e63c (patch) | |
tree | cac6c854196af31425f3f823c129c18770c8217e | |
parent | f948bd184fb45a8cfecdf43266dd8dfebe2d803b (diff) | |
download | android_frameworks_opt_chips-abef0389df9cf85a9532dda519ddd0bf37f5e63c.tar.gz android_frameworks_opt_chips-abef0389df9cf85a9532dda519ddd0bf37f5e63c.tar.bz2 android_frameworks_opt_chips-abef0389df9cf85a9532dda519ddd0bf37f5e63c.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.java | 1 | ||||
-rw-r--r-- | src/com/android/ex/chips/RecipientEditTextView.java | 23 |
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 6ca3d0e..7af7579 100644 --- a/src/com/android/ex/chips/DropdownChipLayouter.java +++ b/src/com/android/ex/chips/DropdownChipLayouter.java @@ -269,6 +269,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 72d5779..b925be4 100644 --- a/src/com/android/ex/chips/RecipientEditTextView.java +++ b/src/com/android/ex/chips/RecipientEditTextView.java @@ -3039,16 +3039,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); + } + }); + } } } } |