Search in sources :

Example 1 with RequestGroupAvatarGetList

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();
    }
}
Also used : LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) AppUtils(net.iGap.module.AppUtils) OnGroupAvatarDelete(net.iGap.observers.interfaces.OnGroupAvatarDelete) RequestGroupAvatarGetList(net.iGap.request.RequestGroupAvatarGetList) ProtoFileDownload(net.iGap.proto.ProtoFileDownload) MessageProgress(net.iGap.messageprogress.MessageProgress) OnUserAvatarDelete(net.iGap.observers.interfaces.OnUserAvatarDelete) G(net.iGap.G) GroupChatRole(net.iGap.module.enums.GroupChatRole) DialogAnimation(net.iGap.module.DialogAnimation) R.string.array_Delete_photo(net.iGap.R.string.array_Delete_photo) View(android.view.View) Log(android.util.Log) HelperImageBackColor(net.iGap.helper.HelperImageBackColor) RequestUserAvatarGetList(net.iGap.request.RequestUserAvatarGetList) HelperCalander(net.iGap.helper.HelperCalander) Status(net.iGap.module.downloader.Status) OnComplete(net.iGap.observers.interfaces.OnComplete) RealmRoom(net.iGap.realm.RealmRoom) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Downloader(net.iGap.module.downloader.Downloader) RealmStory(net.iGap.realm.RealmStory) ViewGroup(android.view.ViewGroup) HelperLog(net.iGap.helper.HelperLog) List(java.util.List) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) RealmRegisteredInfo(net.iGap.realm.RealmRegisteredInfo) Sort(io.realm.Sort) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) NotNull(org.jetbrains.annotations.NotNull) DownloadObject(net.iGap.module.downloader.DownloadObject) RealmChangeListener(io.realm.RealmChangeListener) Context(android.content.Context) AttachmentObject(net.iGap.structs.AttachmentObject) RippleView(net.iGap.libs.rippleeffect.RippleView) AndroidUtils(net.iGap.module.AndroidUtils) PagerAdapter(androidx.viewpager.widget.PagerAdapter) AccountManager(net.iGap.module.accountManager.AccountManager) ViewPager(androidx.viewpager.widget.ViewPager) ArrayList(java.util.ArrayList) Toast(android.widget.Toast) LayoutCreator(net.iGap.helper.LayoutCreator) AvatarHandler(net.iGap.helper.avatar.AvatarHandler) RequestChannelAvatarGetList(net.iGap.request.RequestChannelAvatarGetList) RequestChannelAvatarDelete(net.iGap.request.RequestChannelAvatarDelete) HelperDownloadFile(net.iGap.helper.HelperDownloadFile) LayoutInflater(android.view.LayoutInflater) PhotoView(com.github.chrisbanes.photoview.PhotoView) RealmResults(io.realm.RealmResults) RequestUserAvatarDelete(net.iGap.request.RequestUserAvatarDelete) TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) RequestGroupAvatarDelete(net.iGap.request.RequestGroupAvatarDelete) File(java.io.File) OnChannelAvatarDelete(net.iGap.observers.interfaces.OnChannelAvatarDelete) Color(android.graphics.Color) RealmAvatar(net.iGap.realm.RealmAvatar) Glide(com.bumptech.glide.Glide) HelperSaveFile(net.iGap.helper.HelperSaveFile) ProtoGlobal(net.iGap.proto.ProtoGlobal) R(net.iGap.R) ChannelChatRole(net.iGap.module.enums.ChannelChatRole) DbManager(net.iGap.module.accountManager.DbManager) RealmAttachment(net.iGap.realm.RealmAttachment) RequestUserAvatarGetList(net.iGap.request.RequestUserAvatarGetList) RealmRoom(net.iGap.realm.RealmRoom) RequestGroupAvatarGetList(net.iGap.request.RequestGroupAvatarGetList) RequestChannelAvatarGetList(net.iGap.request.RequestChannelAvatarGetList) RealmRegisteredInfo(net.iGap.realm.RealmRegisteredInfo)

Aggregations

Context (android.content.Context)1 Color (android.graphics.Color)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Bundle (android.os.Bundle)1 Log (android.util.Log)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 Toast (android.widget.Toast)1 Nullable (androidx.annotation.Nullable)1 PagerAdapter (androidx.viewpager.widget.PagerAdapter)1 ViewPager (androidx.viewpager.widget.ViewPager)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 Glide (com.bumptech.glide.Glide)1 PhotoView (com.github.chrisbanes.photoview.PhotoView)1 RealmChangeListener (io.realm.RealmChangeListener)1 RealmResults (io.realm.RealmResults)1 Sort (io.realm.Sort)1