Don't try to show invalid mail addresses in recipient selector
(fixes #1607)
This commit is contained in:
parent
82f5fc6b30
commit
ca2e96eb45
2 changed files with 15 additions and 5 deletions
|
@ -15,7 +15,9 @@ import android.provider.ContactsContract;
|
||||||
import android.provider.ContactsContract.CommonDataKinds.Email;
|
import android.provider.ContactsContract.CommonDataKinds.Email;
|
||||||
import android.provider.ContactsContract.Contacts;
|
import android.provider.ContactsContract.Contacts;
|
||||||
import android.provider.ContactsContract.Contacts.Data;
|
import android.provider.ContactsContract.Contacts.Data;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.fsck.k9.K9;
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
import com.fsck.k9.view.RecipientSelectView.Recipient;
|
import com.fsck.k9.view.RecipientSelectView.Recipient;
|
||||||
|
@ -238,12 +240,16 @@ public class RecipientLoader extends AsyncTaskLoader<List<Recipient>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri photoUri = cursor.isNull(INDEX_PHOTO_URI) ? null : Uri.parse(cursor.getString(INDEX_PHOTO_URI));
|
|
||||||
Recipient recipient = new Recipient(name, email, addressLabel, contactId, lookupKey);
|
Recipient recipient = new Recipient(name, email, addressLabel, contactId, lookupKey);
|
||||||
recipient.photoThumbnailUri = photoUri;
|
if(recipient.getAddress() != null) { // skip email addresses that could not be parsed
|
||||||
|
Uri photoUri = cursor.isNull(INDEX_PHOTO_URI) ? null : Uri.parse(cursor.getString(INDEX_PHOTO_URI));
|
||||||
|
|
||||||
|
recipient.photoThumbnailUri = photoUri;
|
||||||
recipientMap.put(email, recipient);
|
recipientMap.put(email, recipient);
|
||||||
recipients.add(recipient);
|
recipients.add(recipient);
|
||||||
|
} else {
|
||||||
|
Log.w(K9.LOG_TAG, "Skipping invalid email address \"" + email + "\" of contact " + name + ".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
|
@ -550,6 +550,10 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
|
||||||
return address.getAddress();
|
return address.getAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address.getAddress();
|
||||||
|
}
|
||||||
|
|
||||||
public String getDisplayNameOrUnknown(Context context) {
|
public String getDisplayNameOrUnknown(Context context) {
|
||||||
String displayName = getDisplayName();
|
String displayName = getDisplayName();
|
||||||
if (displayName != null) {
|
if (displayName != null) {
|
||||||
|
|
Loading…
Reference in a new issue