handle View intents with the new ViewContactActivity

This commit is contained in:
tibbi 2018-02-10 23:48:50 +01:00
parent dd6771fd0c
commit 9cd4288862
2 changed files with 31 additions and 33 deletions

View File

@ -77,7 +77,36 @@
<activity
android:name=".activities.ViewContactActivity"
android:label="@string/details"
android:parentActivityName=".activities.MainActivity"/>
android:parentActivityName=".activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.dir/person"/>
<data android:mimeType="vnd.android.cursor.dir/contact"/>
<data android:mimeType="vnd.android.cursor.item/group"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.item/person"/>
<data android:mimeType="vnd.android.cursor.item/contact"/>
<data android:mimeType="vnd.android.cursor.item/raw_contact"/>
</intent-filter>
<intent-filter>
<action android:name="com.android.contacts.action.QUICK_CONTACT"/>
<action android:name="android.provider.action.QUICK_CONTACT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.item/contact"/>
<data android:mimeType="vnd.android.cursor.item/person"/>
</intent-filter>
</activity>
<activity
android:name=".activities.EditContactActivity"
@ -116,24 +145,6 @@
<data android:mimeType="vnd.android.cursor.dir/raw_contact"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.dir/person"/>
<data android:mimeType="vnd.android.cursor.dir/contact"/>
<data android:mimeType="vnd.android.cursor.item/group"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.item/person"/>
<data android:mimeType="vnd.android.cursor.item/contact"/>
<data android:mimeType="vnd.android.cursor.item/raw_contact"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.EDIT"/>
<category android:name="android.intent.category.DEFAULT"/>
@ -144,16 +155,6 @@
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.dir/group"/>
</intent-filter>
<intent-filter android:label="@string/edit_contact">
<action android:name="com.android.contacts.action.QUICK_CONTACT"/>
<action android:name="android.provider.action.QUICK_CONTACT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.item/contact"/>
<data android:mimeType="vnd.android.cursor.item/person"/>
</intent-filter>
</activity>
<activity

View File

@ -6,7 +6,6 @@ import android.content.Intent
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.os.Bundle
import android.provider.ContactsContract
import android.provider.ContactsContract.CommonDataKinds
import android.provider.MediaStore
import android.view.Menu
@ -104,9 +103,7 @@ class EditContactActivity : ContactActivity() {
private fun initContact() {
var contactId = intent.getIntExtra(CONTACT_ID, 0)
val action = intent.action
if (contactId == 0 && (action == ContactsContract.QuickContact.ACTION_QUICK_CONTACT ||
action == Intent.ACTION_VIEW ||
action == Intent.ACTION_EDIT)) {
if (contactId == 0 && action == Intent.ACTION_EDIT) {
val data = intent.data
if (data != null) {
val rawId = if (data.path.contains("lookup")) {