/** * 查看所选联系人是否有号码存在 * * @param contact 所选联系人 * @return 所选联系人有号码存在,返回true;否之,返回false */ private boolean isHaveNumber(PersonalContact contact) { List<PhoneNumber> contacts = ContactTools.getCallNumbersByPerson(contact); return null != contacts && !contacts.isEmpty(); }
/** * 显示号码选择的对话框 * * @param object 所选中的联系人 * @param index 选中联系人在与会者列表的下标位置 * @param number 选中联系人在与会者列表中的与会号码 */ private void showSelectNumberDialog(Object object, final int index, String number) { int max = ConferenceFunc.getIns().getConfMaxMember(); int count = max - 1; if (MAX_MEMBERS == addMemberCount) { count = max; // 之前是max-2,实测应该是max } else if (isFirstVisible) { count = max; } if (selectMembers.size() + newMembers.size() >= count) { showNumerOverCount(); return; } // eSpace好友的添加处理 if (object instanceof PersonalContact) { final List<Object> dataList = new ArrayList<Object>(); final PersonalContact personalContact = (PersonalContact) object; dataList.addAll(ContactTools.getCallNumbersByPerson(personalContact)); if (dataList.isEmpty()) { return; } final NumberSelectDialog dialog1 = new NumberSelectDialog( getContext(), UCAPIClipApp.getApp().getString(R.string.dialog_number_select)); dialog1.setContact(personalContact); dialog1.setData(dataList, number); dialog1.setNumberSelectListener( new NumberSelectDialog.NumberListener() { @Override public void onNumberSelect(PhoneNumber phoneNumber) { if (getSelectNum(phoneNumber.getNumber())) { DialogUtil.showToast(getContext(), R.string.checkifdup); } else { ContactCache.getIns().addStranger(personalContact); if (index != -1 && (!newMembers.isEmpty() || !selectMembers.isEmpty())) { if (isFirstVisible) { newMembers.get(index).setNumber(phoneNumber.getNumber()); } else { selectMembers.get(index).setNumber(phoneNumber.getNumber()); } } else { setConfMemberEntity(phoneNumber, personalContact); } } } }); closeDialog(); dialog1.show(); dialog = dialog1; } // 自定义号码的添加处理 else if (object instanceof DefContact) { final DefContact defContact = (DefContact) object; if (getSelectNum(defContact.getPhoneNumber())) { DialogUtil.showToast(getContext(), R.string.checkifdup); } else { ConferenceMemberEntity selectMember = new ConferenceMemberEntity(null, null, defContact.getPhoneNumber()); selectMember.setStatus(ConferenceMemberEntity.STATUS_LEAVE_CONF); sendUpdateList(selectMember); notifyAdapter(); } } }