mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-03 01:07:37 +01:00
add thumbnailUri to the contact model
This commit is contained in:
parent
052e17bed6
commit
135240564f
@ -303,7 +303,7 @@ class ContactActivity : SimpleActivity() {
|
||||
private fun setupNewContact() {
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
|
||||
supportActionBar?.title = resources.getString(R.string.new_contact)
|
||||
contact = Contact(0, "", "", "", "", ArrayList(), ArrayList(), ArrayList(), "", 0, 0)
|
||||
contact = Contact(0, "", "", "", "", ArrayList(), ArrayList(), ArrayList(), "", 0, 0, "")
|
||||
contact_source.text = config.lastUsedContactSource
|
||||
contact_source.setOnClickListener {
|
||||
showContactSourcePicker(contact_source.value) {
|
||||
|
@ -55,7 +55,8 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
||||
val accountName = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME)
|
||||
val starred = cursor.getIntValue(CommonDataKinds.StructuredName.STARRED)
|
||||
val contactId = cursor.getIntValue(ContactsContract.Data.CONTACT_ID)
|
||||
val contact = Contact(id, firstName, middleName, surname, photoUri, number, emails, events, accountName, starred, contactId)
|
||||
val thumbnailUri = cursor.getStringValue(CommonDataKinds.StructuredName.PHOTO_THUMBNAIL_URI) ?: ""
|
||||
val contact = Contact(id, firstName, middleName, surname, photoUri, number, emails, events, accountName, starred, contactId, thumbnailUri)
|
||||
contacts.put(id, contact)
|
||||
} while (cursor.moveToNext())
|
||||
}
|
||||
@ -212,7 +213,8 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
||||
val accountName = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME)
|
||||
val starred = cursor.getIntValue(CommonDataKinds.StructuredName.STARRED)
|
||||
val contactId = cursor.getIntValue(ContactsContract.Data.CONTACT_ID)
|
||||
return Contact(id, firstName, middleName, surname, photoUri, number, emails, events, accountName, starred, contactId)
|
||||
val thumbnailUri = cursor.getStringValue(CommonDataKinds.StructuredName.PHOTO_THUMBNAIL_URI) ?: ""
|
||||
return Contact(id, firstName, middleName, surname, photoUri, number, emails, events, accountName, starred, contactId, thumbnailUri)
|
||||
}
|
||||
} finally {
|
||||
cursor?.close()
|
||||
@ -269,6 +271,7 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
||||
CommonDataKinds.StructuredName.MIDDLE_NAME,
|
||||
CommonDataKinds.StructuredName.FAMILY_NAME,
|
||||
CommonDataKinds.StructuredName.PHOTO_URI,
|
||||
CommonDataKinds.StructuredName.PHOTO_THUMBNAIL_URI,
|
||||
CommonDataKinds.StructuredName.STARRED,
|
||||
ContactsContract.RawContacts.ACCOUNT_NAME
|
||||
)
|
||||
|
@ -178,7 +178,7 @@ class VcfImporter(val activity: SimpleActivity) {
|
||||
}
|
||||
|
||||
private fun saveContact(source: String) {
|
||||
val contact = Contact(0, curFirstName, curMiddleName, curSurname, curPhotoUri, curPhoneNumbers, curEmails, curEvents, source, 0, 0)
|
||||
val contact = Contact(0, curFirstName, curMiddleName, curSurname, curPhotoUri, curPhoneNumbers, curEmails, curEvents, source, 0, 0, "")
|
||||
if (ContactsHelper(activity).insertContact(contact)) {
|
||||
contactsImported++
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.simplemobiletools.commons.helpers.SORT_DESCENDING
|
||||
|
||||
data class Contact(val id: Int, var firstName: String, var middleName: String, var surname: String, var photoUri: String,
|
||||
var phoneNumbers: ArrayList<PhoneNumber>, var emails: ArrayList<Email>, var events: ArrayList<Event>, var source: String,
|
||||
var starred: Int, val contactId: Int) : Comparable<Contact> {
|
||||
var starred: Int, val contactId: Int, val thumbnailUri: String) : Comparable<Contact> {
|
||||
companion object {
|
||||
var sorting: Int = 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user