use of net.iGap.observers.interfaces.OnSelectedList in project iGap-Android by KianIranian-STDG.
the class FragmentShowMember method goToAddMember.
private void goToAddMember() {
List<StructContactInfo> userList = Contacts.retrieve(null);
RealmList<RealmMember> memberList = DbManager.getInstance().doRealmTask(realm -> {
return RealmMember.getMembers(realm, mRoomID);
});
for (int i = 0; i < memberList.size(); i++) {
for (int j = 0; j < userList.size(); j++) {
if (userList.get(j).peerId == memberList.get(i).getPeerId()) {
userList.remove(j);
break;
}
}
}
if (getActivity() != null) {
ShowCustomList showCustomListFragment = new ShowCustomList();
showCustomListFragment.setFields(roomType, userList, new OnSelectedList() {
@Override
public void getSelectedList(boolean result, String message, int countForShowLastMessage, final ArrayList<StructContactInfo> list) {
if (isGroup) {
for (int i = 0; i < list.size(); i++) {
new RequestGroupAddMember().groupAddMember(mRoomID, list.get(i).peerId, RealmRoomMessage.findCustomMessageId(mRoomID, countForShowLastMessage));
}
} else {
for (int i = 0; i < list.size(); i++) {
new RequestChannelAddMember().channelAddMember(mRoomID, list.get(i).peerId);
}
}
}
});
Bundle bundle = new Bundle();
bundle.putBoolean("DIALOG_SHOWING", true);
bundle.putLong("COUNT_MESSAGE", 0);
showCustomListFragment.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), showCustomListFragment).setReplace(false).load();
}
}
Aggregations