From 3895570eddcb161919c1f0f9684ed1cb2ae6ec45 Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 8 Jul 2011 00:54:12 +0800 Subject: [PATCH] Fixed Issue 140: Contact.displayName is not being set correctly --- framework/src/com/phonegap/ContactAccessorSdk5.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/framework/src/com/phonegap/ContactAccessorSdk5.java b/framework/src/com/phonegap/ContactAccessorSdk5.java index e8b34ae8..6da82bc3 100644 --- a/framework/src/com/phonegap/ContactAccessorSdk5.java +++ b/framework/src/com/phonegap/ContactAccessorSdk5.java @@ -264,16 +264,18 @@ public class ContactAccessorSdk5 extends ContactAccessor { newContact = false; contact.put("id", contactId); contact.put("rawId", rawId); - contact.put("displayName", c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME))); } // Grab the mimetype of the current row as it will be used in a lot of comparisons mimetype = c.getString(c.getColumnIndex(ContactsContract.Data.MIMETYPE)); - if (mimetype.equals(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) - && isRequired("name",populate)) { - contact.put("name", nameQuery(c)); - } + if (mimetype.equals(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)) { + contact.put("displayName", c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME))); + } + if (mimetype.equals(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) + && isRequired("name",populate)) { + contact.put("name", nameQuery(c)); + } else if (mimetype.equals(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE) && isRequired("phoneNumbers",populate)) { phones.put(phoneQuery(c));