|
|
@@ -1,19 +1,15 @@
|
|
|
package com.usai.apex;
|
|
|
|
|
|
import android.app.AlertDialog;
|
|
|
-import android.content.ContentResolver;
|
|
|
-import android.content.ContentValues;
|
|
|
import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.content.pm.PackageInfo;
|
|
|
import android.content.pm.PackageManager.NameNotFoundException;
|
|
|
-import android.database.Cursor;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.graphics.BitmapFactory;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Bundle;
|
|
|
-import android.provider.ContactsContract;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
import android.support.v4.app.FragmentManager;
|
|
|
import android.support.v4.app.FragmentTransaction;
|
|
|
@@ -30,8 +26,6 @@ import com.baidu.mapapi.map.SupportMapFragment;
|
|
|
import com.usai.Contacts.Contact;
|
|
|
import com.usai.Contacts.ContactsManager;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-
|
|
|
//import com.baidu.mapapi.MKGeneralListener;
|
|
|
//import com.baidu.mapapi.map.MKEvent;
|
|
|
|
|
|
@@ -268,22 +262,31 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
|
|
|
new AlertDialog.Builder(this)
|
|
|
.setTitle("Warning")
|
|
|
- .setTitle(contact.getName() + " has exist in contacts,do you want to update it?")
|
|
|
+ .setMessage(contact.getName() + " has exist in contacts,do you want to update it?")
|
|
|
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
- // 需要用户手动保存
|
|
|
- cm.insertContact(contact,mContext);
|
|
|
+ // 不更新则直接查看
|
|
|
+// cm.insertContact(contact,mContext);
|
|
|
+ Contact existContact = cm.searchContact(contact.getName());
|
|
|
+ String contactId = cm.getContactID(existContact.getName());
|
|
|
+ Intent editIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://com.android.contacts/contacts/"+contactId));
|
|
|
+ startActivity(editIntent);
|
|
|
}
|
|
|
})
|
|
|
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
+
|
|
|
+ //Intent.ACTION_INSERT_OR_EDIT
|
|
|
+ //参考 https://blog.csdn.net/mls1454001840/article/details/60764351 之二
|
|
|
Contact existContact = cm.searchContact(contact.getName());
|
|
|
cm.updateContact(existContact,contact);
|
|
|
// 显示编辑界面
|
|
|
String contactId = cm.getContactID(existContact.getName());
|
|
|
cm.editContact(contactId,mContext);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
.show();
|