use of com.cometchat.pro.core.GroupMembersRequest in project android-java-chat-push-notification-app by cometchat-pro.
the class CometChatMessageList method getMember.
/**
* This method is used to get Group Members and display names of group member.
*
* @see GroupMember
* @see GroupMembersRequest
*/
private void getMember() {
GroupMembersRequest groupMembersRequest = new GroupMembersRequest.GroupMembersRequestBuilder(Id).setLimit(30).build();
groupMembersRequest.fetchNext(new CometChat.CallbackListener<List<GroupMember>>() {
@Override
public void onSuccess(List<GroupMember> list) {
String[] s = new String[0];
if (list != null && list.size() != 0) {
s = new String[list.size()];
for (int j = 0; j < list.size(); j++) {
s[j] = list.get(j).getName();
}
}
setSubTitle(s);
}
@Override
public void onError(CometChatException e) {
Log.d(TAG, "Group Member list fetching failed with exception: " + e.getMessage());
Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
use of com.cometchat.pro.core.GroupMembersRequest in project android-java-chat-push-notification-app by cometchat-pro.
the class CometChatGroupMemberList method searchUser.
/**
* This method is used to perform search operation on list of group members.
*
* @param s is a String which is used to search group members.
*
* @see GroupMembersRequest
*/
private void searchUser(String s) {
GroupMembersRequest groupMembersRequest = new GroupMembersRequest.GroupMembersRequestBuilder(guid).setSearchKeyword(s).setLimit(10).build();
groupMembersRequest.fetchNext(new CometChat.CallbackListener<List<GroupMember>>() {
@Override
public void onSuccess(List<GroupMember> groupMembers) {
if (groupMemberListAdapter != null) {
List<GroupMember> filterlist = new ArrayList<>();
for (GroupMember gmember : groupMembers) {
if (gmember.getScope().equals(CometChatConstants.SCOPE_PARTICIPANT)) {
filterlist.add(gmember);
}
}
groupMemberListAdapter.searchGroupMembers(filterlist);
}
}
@Override
public void onError(CometChatException e) {
CometChatSnackBar.show(context, rvGroupMemberList, CometChatError.localized(e), CometChatSnackBar.ERROR);
Log.e(TAG, "onError: " + e.getMessage());
}
});
}
Aggregations