use of net.iGap.request.RequestGroupAvatarGetList in project iGap-Android by KianIranian-STDG.
the class FragmentShowAvatars method fillListAvatar.
private void fillListAvatar(From from) {
boolean isRoomExist = false;
switch(from) {
case chat:
case setting:
RealmRegisteredInfo user = DbManager.getInstance().doRealmTask(realm -> {
return RealmRegisteredInfo.getRegistrationInfo(realm, mPeerId);
});
if (user != null) {
new RequestUserAvatarGetList().userAvatarGetList(mPeerId);
isRoomExist = true;
}
break;
case group:
RealmRoom roomGroup = DbManager.getInstance().doRealmTask(realm -> {
return realm.where(RealmRoom.class).equalTo("id", mPeerId).findFirst();
});
if (roomGroup != null) {
new RequestGroupAvatarGetList().groupAvatarGetList(mPeerId);
isRoomExist = true;
roleGroup = roomGroup.getGroupRoom().getRole();
}
break;
case channel:
RealmRoom roomChannel = DbManager.getInstance().doRealmTask(realm -> {
return realm.where(RealmRoom.class).equalTo("id", mPeerId).findFirst();
});
if (roomChannel != null) {
new RequestChannelAvatarGetList().channelAvatarGetList(mPeerId);
isRoomExist = true;
roleChannel = roomChannel.getChannelRoom().getRole();
}
break;
}
if (isRoomExist) {
avatarList = DbManager.getInstance().doRealmTask(realm -> {
return realm.where(RealmAvatar.class).equalTo("ownerId", mPeerId).findAll().sort("id", Sort.DESCENDING);
});
avatarListSize = avatarList.size();
}
}
Aggregations