handle View intents with the new ViewContactActivity
This commit is contained in:
parent
dd6771fd0c
commit
9cd4288862
|
@ -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
|
||||
|
|
|
@ -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")) {
|
||||
|
|
Loading…
Reference in New Issue