move contact init at ViewContactActivity to resume
This commit is contained in:
parent
dd678cc7d2
commit
dd6771fd0c
|
@ -32,7 +32,6 @@ import java.text.SimpleDateFormat
|
|||
import java.util.*
|
||||
|
||||
abstract class ContactActivity : SimpleActivity() {
|
||||
var isEditActivity = false
|
||||
var contact: Contact? = null
|
||||
var currentContactPhotoPath = ""
|
||||
|
||||
|
|
|
@ -24,16 +24,11 @@ class ViewContactActivity : ContactActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_view_contact)
|
||||
isEditActivity = false
|
||||
}
|
||||
|
||||
handlePermission(PERMISSION_READ_CONTACTS) {
|
||||
if (it) {
|
||||
initContact()
|
||||
} else {
|
||||
toast(R.string.no_contacts_permission)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
tryInitContact()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -51,6 +46,17 @@ class ViewContactActivity : ContactActivity() {
|
|||
return true
|
||||
}
|
||||
|
||||
private fun tryInitContact() {
|
||||
handlePermission(PERMISSION_READ_CONTACTS) {
|
||||
if (it) {
|
||||
initContact()
|
||||
} else {
|
||||
toast(R.string.no_contacts_permission)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initContact() {
|
||||
var contactId = intent.getIntExtra(CONTACT_ID, 0)
|
||||
val action = intent.action
|
||||
|
|
Loading…
Reference in New Issue