mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
fix #647, always fetch contacts the same way, no matter the sorting
This commit is contained in:
@ -134,8 +134,9 @@ class ContactsHelper(val context: Context) {
|
|||||||
val uri = Data.CONTENT_URI
|
val uri = Data.CONTENT_URI
|
||||||
val projection = getContactProjection()
|
val projection = getContactProjection()
|
||||||
|
|
||||||
val selection = "${Data.MIMETYPE} = ? OR ${Data.MIMETYPE} = ?"
|
arrayOf(CommonDataKinds.Organization.CONTENT_ITEM_TYPE, StructuredName.CONTENT_ITEM_TYPE).forEach { mimetype ->
|
||||||
val selectionArgs = arrayOf(StructuredName.CONTENT_ITEM_TYPE, CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
|
val selection = "${Data.MIMETYPE} = ?"
|
||||||
|
val selectionArgs = arrayOf(mimetype)
|
||||||
val sortOrder = getSortString()
|
val sortOrder = getSortString()
|
||||||
|
|
||||||
context.queryCursor(uri, projection, selection, selectionArgs, sortOrder, true) { cursor ->
|
context.queryCursor(uri, projection, selection, selectionArgs, sortOrder, true) { cursor ->
|
||||||
@ -151,7 +152,6 @@ class ContactsHelper(val context: Context) {
|
|||||||
var middleName = ""
|
var middleName = ""
|
||||||
var surname = ""
|
var surname = ""
|
||||||
var suffix = ""
|
var suffix = ""
|
||||||
val mimetype = cursor.getStringValue(Data.MIMETYPE)
|
|
||||||
|
|
||||||
// ignore names at Organization type contacts
|
// ignore names at Organization type contacts
|
||||||
if (mimetype == StructuredName.CONTENT_ITEM_TYPE) {
|
if (mimetype == StructuredName.CONTENT_ITEM_TYPE) {
|
||||||
@ -181,6 +181,7 @@ class ContactsHelper(val context: Context) {
|
|||||||
|
|
||||||
contacts.put(id, contact)
|
contacts.put(id, contact)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val phoneNumbers = getPhoneNumbers(null)
|
val phoneNumbers = getPhoneNumbers(null)
|
||||||
var size = phoneNumbers.size()
|
var size = phoneNumbers.size()
|
||||||
|
Reference in New Issue
Block a user