修改联系人编辑界面未弹出问题。
This commit is contained in:
		| @@ -1,8 +1,8 @@ | |||||||
| #Created by .winboll/winboll_app_build.gradle | #Created by .winboll/winboll_app_build.gradle | ||||||
| #Sat Oct 18 05:13:11 GMT 2025 | #Sat Oct 18 05:39:08 GMT 2025 | ||||||
| stageCount=19 | stageCount=19 | ||||||
| libraryProject= | libraryProject= | ||||||
| baseVersion=15.3 | baseVersion=15.3 | ||||||
| publishVersion=15.3.18 | publishVersion=15.3.18 | ||||||
| buildCount=3 | buildCount=15 | ||||||
| baseBetaVersion=15.3.19 | baseBetaVersion=15.3.19 | ||||||
|   | |||||||
| @@ -73,6 +73,7 @@ public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactV | |||||||
| 								} else if (nItemId == R.id.item_calllog_phonenumber_edit_contact) { | 								} else if (nItemId == R.id.item_calllog_phonenumber_edit_contact) { | ||||||
| 									//ToastUtils.show("Test"); | 									//ToastUtils.show("Test"); | ||||||
| 									Long nContactId = ContactUtils.getContactIdByPhone(mContext, contact.getNumber()); | 									Long nContactId = ContactUtils.getContactIdByPhone(mContext, contact.getNumber()); | ||||||
|  | 									//ToastUtils.show(String.format("%d", nContactId)); | ||||||
| 									ContactUtils.jumpToEditContact(mContext, contact.getNumber(), nContactId); | 									ContactUtils.jumpToEditContact(mContext, contact.getNumber(), nContactId); | ||||||
| 								} | 								} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -95,7 +95,7 @@ public class ContactsFragment extends Fragment { | |||||||
|         recyclerView = (RecyclerView) view.findViewById(R.id.contacts_recycler_view); |         recyclerView = (RecyclerView) view.findViewById(R.id.contacts_recycler_view); | ||||||
|         recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); |         recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); | ||||||
|         contactList = new ArrayList<ContactModel>(); |         contactList = new ArrayList<ContactModel>(); | ||||||
|         contactAdapter = new ContactAdapter(getContext(), contactList); |         contactAdapter = new ContactAdapter(getActivity(), contactList); | ||||||
|         recyclerView.setAdapter(contactAdapter); |         recyclerView.setAdapter(contactAdapter); | ||||||
|         // 初始隐藏列表,数据加载后显示 |         // 初始隐藏列表,数据加载后显示 | ||||||
|         recyclerView.setVisibility(View.GONE); |         recyclerView.setVisibility(View.GONE); | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ import android.database.Cursor; | |||||||
| import android.net.Uri; | import android.net.Uri; | ||||||
| import android.provider.ContactsContract; | import android.provider.ContactsContract; | ||||||
| import cc.winboll.studio.libappbase.LogUtils; | import cc.winboll.studio.libappbase.LogUtils; | ||||||
|  | import cc.winboll.studio.libappbase.utils.ToastUtils; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
|  |  | ||||||
| @@ -136,7 +137,7 @@ public class ContactUtils { | |||||||
| 		intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, phoneNumber); | 		intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, phoneNumber); | ||||||
| 		mContext.startActivity(intent); | 		mContext.startActivity(intent); | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	/** | 	/** | ||||||
| 	 * 跳转至系统编辑联系人界面(适配小米等定制机型) | 	 * 跳转至系统编辑联系人界面(适配小米等定制机型) | ||||||
| 	 * @param context 上下文(Activity/Service/Fragment) | 	 * @param context 上下文(Activity/Service/Fragment) | ||||||
| @@ -153,9 +154,8 @@ public class ContactUtils { | |||||||
| 			// 构建联系人的Uri(格式:content://contacts/people/[contactId],系统标准格式) | 			// 构建联系人的Uri(格式:content://contacts/people/[contactId],系统标准格式) | ||||||
| 			Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId); | 			Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId); | ||||||
| 			intent.setData(contactUri); | 			intent.setData(contactUri); | ||||||
| 		}  | 			//ToastUtils.show("1"); | ||||||
| 		// 场景B:未知ID,通过电话号码匹配(需系统支持号码匹配,小米机型兼容) | 		} else if (phoneNumber != null && !phoneNumber.isEmpty()) { | ||||||
| 		else if (phoneNumber != null && !phoneNumber.isEmpty()) { |  | ||||||
| 			// 方式1:小米等机型兼容的“通过号码定位联系人”参数(部分系统认此参数) | 			// 方式1:小米等机型兼容的“通过号码定位联系人”参数(部分系统认此参数) | ||||||
| 			//intent.putExtra(ContactsContract.Intents.Insert.PHONE_NUMBER, phoneNumber); | 			//intent.putExtra(ContactsContract.Intents.Insert.PHONE_NUMBER, phoneNumber); | ||||||
| 			// 方式2:补充系统标准的“数据Uri”,强化匹配(避免参数被定制系统忽略) | 			// 方式2:补充系统标准的“数据Uri”,强化匹配(避免参数被定制系统忽略) | ||||||
| @@ -173,15 +173,11 @@ public class ContactUtils { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// 启动活动(加防护,避免无联系人应用崩溃) | 		// 启动活动(加防护,避免无联系人应用崩溃) | ||||||
| 		if (intent.resolveActivity(context.getPackageManager()) != null) { | 		// 小米机型在Service/非Activity中调用,需加NEW_TASK标志,否则可能无法启动 | ||||||
| 			// 小米机型在Service/非Activity中调用,需加NEW_TASK标志,否则可能无法启动 | 		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||||
| 			intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 		context.startActivity(intent); | ||||||
| 			context.startActivity(intent); |  | ||||||
| 		} else { |  | ||||||
| 			LogUtils.d(TAG, "编辑联系人失败:设备未安装联系人应用"); |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	/** | 	/** | ||||||
| 	 * 通过电话号码查询联系人ID(适配小米机型,解决编辑时匹配不稳定问题) | 	 * 通过电话号码查询联系人ID(适配小米机型,解决编辑时匹配不稳定问题) | ||||||
| 	 * @param context 上下文 | 	 * @param context 上下文 | ||||||
| @@ -215,5 +211,5 @@ public class ContactUtils { | |||||||
| 		} | 		} | ||||||
| 		return -1L; // 无匹配联系人 | 		return -1L; // 无匹配联系人 | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen