fix prefilled name in RecipientLoader

This commit is contained in:
Vincent Breitmoser 2017-03-30 15:28:03 +02:00
parent 62df90d13b
commit 60f378b58f

View file

@ -240,7 +240,8 @@ public class RecipientLoader extends AsyncTaskLoader<List<Recipient>> {
Cursor cursor = contentResolver
.query(queryUri, PROJECTION, selection, new String[] { id }, SORT_ORDER);
fillContactDataFromCursor(cursor, recipients, recipientMap, nicknameCursor.getString(INDEX_NICKNAME));
String contactNickname = nicknameCursor.getString(INDEX_NICKNAME);
fillContactDataFromCursor(cursor, recipients, recipientMap, contactNickname);
hasContact = true;
}
@ -281,12 +282,11 @@ public class RecipientLoader extends AsyncTaskLoader<List<Recipient>> {
}
private void fillContactDataFromCursor(Cursor cursor, List<Recipient> recipients,
Map<String, Recipient> recipientMap, @Nullable String name) {
Map<String, Recipient> recipientMap, @Nullable String prefilledName) {
while (cursor.moveToNext()) {
if (name == null) {
name = cursor.getString(INDEX_NAME);
}
String name = prefilledName != null ? prefilledName : cursor.getString(INDEX_NAME);
String email = cursor.getString(INDEX_EMAIL);
long contactId = cursor.getLong(INDEX_CONTACT_ID);
String lookupKey = cursor.getString(INDEX_LOOKUP_KEY);