From f9fb62366b902e88d90b82d4057600e73aba3616 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 21 Mar 2018 18:21:16 +0100 Subject: [PATCH] properly refresh View Contact screen on resume --- .../contacts/activities/ViewContactActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/ViewContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/ViewContactActivity.kt index 1bffbd05..d9c17a46 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/ViewContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/ViewContactActivity.kt @@ -60,6 +60,7 @@ class ViewContactActivity : ContactActivity() { } private fun initContact() { + var wasLookupKeyUsed = false var contactId = intent.getIntExtra(CONTACT_ID, 0) val action = intent.action if (contactId == 0 && (action == ContactsContract.QuickContact.ACTION_QUICK_CONTACT || action == Intent.ACTION_VIEW)) { @@ -69,6 +70,7 @@ class ViewContactActivity : ContactActivity() { val lookupKey = getLookupKeyFromUri(data) if (lookupKey != null) { contact = ContactsHelper(this).getContactWithLookupKey(lookupKey) + wasLookupKeyUsed = true } getLookupUriRawId(data) @@ -82,7 +84,7 @@ class ViewContactActivity : ContactActivity() { } } - if (contactId != 0 && contact == null) { + if (contactId != 0 && !wasLookupKeyUsed) { contact = ContactsHelper(this).getContactWithId(contactId, intent.getBooleanExtra(IS_PRIVATE, false)) if (contact == null) { toast(R.string.unknown_error_occurred)