mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
create a new activity for handling ACTION_INSERT_OR_EDIT intent
This commit is contained in:
@ -58,7 +58,7 @@ class EditContactActivity : ContactActivity() {
|
||||
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_cross)
|
||||
|
||||
val action = intent.action
|
||||
isThirdPartyIntent = action == Intent.ACTION_EDIT || action == Intent.ACTION_INSERT_OR_EDIT || action == Intent.ACTION_INSERT
|
||||
isThirdPartyIntent = action == Intent.ACTION_EDIT || action == Intent.ACTION_INSERT
|
||||
val isFromSimpleContacts = intent.getBooleanExtra(IS_FROM_SIMPLE_CONTACTS, false)
|
||||
if (isThirdPartyIntent && !isFromSimpleContacts) {
|
||||
handlePermission(PERMISSION_READ_CONTACTS) {
|
||||
@ -149,7 +149,7 @@ class EditContactActivity : ContactActivity() {
|
||||
setupEditContact()
|
||||
}
|
||||
|
||||
if (contact!!.id == 0 && intent.extras?.containsKey(KEY_PHONE) == true && (action == Intent.ACTION_INSERT_OR_EDIT || action == Intent.ACTION_INSERT)) {
|
||||
if (contact!!.id == 0 && intent.extras?.containsKey(KEY_PHONE) == true && action == Intent.ACTION_INSERT) {
|
||||
val phoneNumber = intent.extras.get(KEY_PHONE)?.toString() ?: ""
|
||||
contact!!.phoneNumbers.add(PhoneNumber(phoneNumber, DEFAULT_PHONE_NUMBER_TYPE, ""))
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.simplemobiletools.contacts.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
|
||||
import com.simplemobiletools.contacts.R
|
||||
|
||||
class InsertOrEditContactActivity : ContactActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_insert_edit_contact)
|
||||
|
||||
handlePermission(PERMISSION_READ_CONTACTS) {
|
||||
// we do not really care about the permission request result. Even if it was denied, load private contacts
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user