More contact related fixes
This commit is contained in:
@@ -112,7 +112,7 @@ class ChatsActivity: AppCompatActivity() {
|
|||||||
with (builder) {
|
with (builder) {
|
||||||
setTitle(R.string.confirmation)
|
setTitle(R.string.confirmation)
|
||||||
setMessage(String.format(getString(R.string.long_chat_question),
|
setMessage(String.format(getString(R.string.long_chat_question),
|
||||||
Utils.friendlyUri(this@ChatsActivity, peer, account)))
|
peer))
|
||||||
setNeutralButton(getText(R.string.cancel), dialogClickListener)
|
setNeutralButton(getText(R.string.cancel), dialogClickListener)
|
||||||
setNegativeButton(getText(R.string.delete), dialogClickListener)
|
setNegativeButton(getText(R.string.delete), dialogClickListener)
|
||||||
setPositiveButton(getText(R.string.add_contact), dialogClickListener)
|
setPositiveButton(getText(R.string.add_contact), dialogClickListener)
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ sealed class Contact {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun loadAndroidContacts(ctx: Context) {
|
fun loadAndroidContacts(ctx: Context) {
|
||||||
|
// If phone type is needed, add DATA2 to projection. Then phone type can be get from
|
||||||
|
// cursor using getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE
|
||||||
val projection = arrayOf(ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME,
|
val projection = arrayOf(ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME,
|
||||||
ContactsContract.Data.MIMETYPE, ContactsContract.Data.DATA1,
|
ContactsContract.Data.MIMETYPE, ContactsContract.Data.DATA1,
|
||||||
ContactsContract.Data.PHOTO_THUMBNAIL_URI)
|
ContactsContract.Data.PHOTO_THUMBNAIL_URI)
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class ContactActivity : AppCompatActivity() {
|
|||||||
R.id.checkIcon -> {
|
R.id.checkIcon -> {
|
||||||
|
|
||||||
var newName = nameView.text.toString().trim()
|
var newName = nameView.text.toString().trim()
|
||||||
var newUri = uriView.text.toString().filterNot{setOf('-', ' ').contains(it)}
|
var newUri = uriView.text.toString().filterNot{setOf('-', ' ', '(', ')').contains(it)}
|
||||||
|
|
||||||
if (newName == "") newName = newUri
|
if (newName == "") newName = newUri
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user