// 在视图中,长按用户信息条目弹出的对话框 public static void handleContactItemLongClick(final UserEntity contact, final Context ctx) { if (contact == null || ctx == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(ctx, android.R.style.Theme_Holo_Light_Dialog)); builder.setTitle(contact.getMainName()); String[] items = new String[] {ctx.getString(R.string.check_profile), ctx.getString(R.string.start_session)}; final int userId = contact.getPeerId(); builder.setItems( items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: IMUIHelper.openUserProfileActivity(ctx, userId); break; case 1: IMUIHelper.openChatActivity(ctx, contact.getSessionKey()); break; } } }); AlertDialog alertDialog = builder.create(); alertDialog.setCanceledOnTouchOutside(true); alertDialog.show(); }
public static boolean handleContactSearch(String key, UserEntity contact) { if (TextUtils.isEmpty(key) || contact == null) { return false; } contact.getSearchElement().reset(); return handleTokenFirstCharsSearch(key, contact.getPinyinElement(), contact.getSearchElement()) || handleTokenPinyinFullSearch(key, contact.getPinyinElement(), contact.getSearchElement()) || handleNameSearch(contact.getMainName(), key, contact.getSearchElement()); // 原先是 contact.name 代表花名的意思嘛?? }