open the Edit screen at pressing an unknown Recents item

This commit is contained in:
tibbi 2018-08-04 22:29:45 +02:00
parent 57b64e63a1
commit 82e6738cd7
3 changed files with 13 additions and 3 deletions

View File

@ -45,9 +45,6 @@ class EditContactActivity : ContactActivity() {
private val CHOOSE_PHOTO = 2
private val REMOVE_PHOTO = 3
private val KEY_PHONE = "phone"
private val KEY_NAME = "name"
private var wasActivityInitialized = false
private var lastPhotoIntentUri: Uri? = null
private var isSaving = false

View File

@ -1,11 +1,14 @@
package com.simplemobiletools.contacts.fragments
import android.content.Context
import android.content.Intent
import android.util.AttributeSet
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.isActivityDestroyed
import com.simplemobiletools.contacts.activities.EditContactActivity
import com.simplemobiletools.contacts.adapters.RecentCallsAdapter
import com.simplemobiletools.contacts.extensions.contactClicked
import com.simplemobiletools.contacts.helpers.KEY_PHONE
import com.simplemobiletools.contacts.helpers.PHONE_NUMBER_PATTERN
import com.simplemobiletools.contacts.models.Contact
import com.simplemobiletools.contacts.models.RecentCall
@ -38,6 +41,12 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
if (selectedContact != null) {
activity?.contactClicked(selectedContact)
} else {
Intent(context, EditContactActivity::class.java).apply {
action = Intent.ACTION_INSERT
putExtra(KEY_PHONE, recentCall)
context.startActivity(this)
}
}
}.apply {
addVerticalDividers(true)

View File

@ -23,6 +23,10 @@ const val GROUP = "group"
const val FIRST_GROUP_ID = 10000
const val PHONE_NUMBER_PATTERN = "\\D+"
// extras used at third party intents
const val KEY_PHONE = "phone"
const val KEY_NAME = "name"
const val LOCATION_CONTACTS_TAB = 0
const val LOCATION_FAVORITES_TAB = 1
const val LOCATION_RECENTS_TAB = 2