Search in sources :

Example 11 with StoryObject

use of net.iGap.story.StoryObject in project iGap-Android by KianIranian-STDG.

the class MessageDataStorage method getStoryWithFileToken.

public StoryObject getStoryWithFileToken(String fileToken) {
    CountDownLatch countDownLatch = new CountDownLatch(1);
    StoryObject[] storyObjects = new StoryObject[1];
    storageQueue.postRunnable(() -> {
        try {
            RealmStoryProto realmStoryProto = database.where(RealmStoryProto.class).equalTo("sessionId", AccountManager.getInstance().getCurrentUser().getId()).equalTo("isForReply", false).equalTo("fileToken", fileToken).findFirst();
            if (realmStoryProto != null) {
                storyObjects[0] = StoryObject.create(realmStoryProto);
            }
            countDownLatch.countDown();
        } catch (Exception e) {
            FileLog.e(e);
        } finally {
            countDownLatch.countDown();
        }
    });
    try {
        countDownLatch.await();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return storyObjects[0];
}
Also used : MainStoryObject(net.iGap.story.MainStoryObject) StoryObject(net.iGap.story.StoryObject) RealmStoryProto(net.iGap.realm.RealmStoryProto) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 12 with StoryObject

use of net.iGap.story.StoryObject in project iGap-Android by KianIranian-STDG.

the class MessageDataStorage method getStoryWithUploadId.

public StoryObject getStoryWithUploadId(long uploadId) {
    CountDownLatch countDownLatch = new CountDownLatch(1);
    StoryObject[] storyObjects = new StoryObject[1];
    storageQueue.postRunnable(() -> {
        try {
            RealmStoryProto realmStoryProto = database.where(RealmStoryProto.class).equalTo("sessionId", AccountManager.getInstance().getCurrentUser().getId()).equalTo("isForReply", false).equalTo("id", uploadId).findFirst();
            if (realmStoryProto != null) {
                storyObjects[0] = StoryObject.create(realmStoryProto);
            }
            countDownLatch.countDown();
        } catch (Exception e) {
            FileLog.e(e);
        } finally {
            countDownLatch.countDown();
        }
    });
    try {
        countDownLatch.await();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return storyObjects[0];
}
Also used : MainStoryObject(net.iGap.story.MainStoryObject) StoryObject(net.iGap.story.StoryObject) RealmStoryProto(net.iGap.realm.RealmStoryProto) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 13 with StoryObject

use of net.iGap.story.StoryObject in project iGap-Android by KianIranian-STDG.

the class StoryViewFragment method setUpPager.

private void setUpPager() {
    List<StoryUser> storyUserList = new ArrayList<>();
    for (int i = 0; i < storyResults.size(); i++) {
        List<StoryObject> realmStoryProtos = storyResults.get(i).storyObjects;
        StoryUser storyUser = new StoryUser();
        List<Story> stories = new ArrayList<>();
        storyUser.setUserName(storyResults.get(i).displayName);
        storyUser.setUserId(storyResults.get(i).userId);
        storyUser.setRoomId(storyResults.get(i).roomId);
        for (int j = 0; j < realmStoryProtos.size(); j++) {
            StoryObject storyObject = realmStoryProtos.get(j);
            if (storyResults.get(i).orginatorValue == 0 && storyObject.userId == userId) {
                currentPage = i;
            } else if (storyResults.get(i).orginatorValue == 1 && storyObject.roomId == roomId) {
                currentPage = i;
            }
            if (isSingle) {
                if (storyObject.storyId != 0 && storyObject.storyId == storyId) {
                    Story story = new Story(null, bitmap, storyObject.caption, storyObject.createdAt, storyObject.userId, storyObject.roomId, storyObject.displayName, storyObject.storyId, storyObject.attachmentObject, null, storyObject.viewCount, storyObject.isForRoom, storyObject.isVerified, storyObject.storyViewInfoObjects);
                    stories.add(story);
                    storyUser.setStories(stories);
                    break;
                } else if (storyObject.index == storyId) {
                    Story story = new Story(null, bitmap, storyObject.caption, storyObject.createdAt, storyObject.userId, storyObject.roomId, storyObject.displayName, storyObject.storyId, storyObject.attachmentObject, null, storyObject.viewCount, storyObject.isForRoom, storyObject.isVerified, storyObject.storyViewInfoObjects);
                    stories.add(story);
                    storyUser.setStories(stories);
                    break;
                }
            } else {
                Story story = new Story(null, bitmap, storyObject.caption, storyObject.createdAt, storyObject.userId, storyObject.roomId, storyObject.displayName, storyObject.storyId, storyObject.attachmentObject, null, storyObject.viewCount, storyObject.isForRoom, storyObject.isVerified, storyObject.storyViewInfoObjects);
                stories.add(story);
                storyUser.setStories(stories);
            }
        }
        if (storyUser.getStories() != null && storyUser.getStories().size() > 0) {
            storyUserList.add(storyUser);
        }
    }
    pagerAdapter = new StoryPagerAdapter(getChildFragmentManager(), FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT, storyUserList, this, myStory, isForReply);
    viewPager.setAdapter(pagerAdapter);
    viewPager.setCurrentItem(currentPage);
    viewPager.setPageTransformer(true, new PageTransformer());
    viewPager.addOnPageChangeListener(new PageChangeListener() {

        @Override
        void onPageScrollCanceled() {
            StoryDisplayFragment fragment = (StoryDisplayFragment) pagerAdapter.findFragmentByPosition(viewPager, currentPage);
        // Log.e("mmd", "onPageScrollCanceled resumeCurrentStory: "  );
        // fragment.resumeCurrentStory();
        }

        @Override
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            currentPage = position;
        }
    });
}
Also used : StoryObject(net.iGap.story.StoryObject) MainStoryObject(net.iGap.story.MainStoryObject) ArrayList(java.util.ArrayList)

Example 14 with StoryObject

use of net.iGap.story.StoryObject in project iGap-Android by KianIranian-STDG.

the class StoryCell method initView.

public void initView(Context context, boolean needDivider, CircleStatus status, ImageLoadingView.Status imageLoadingStatus, IconClicked iconClicked, long createTime) {
    removeAllViews();
    if (G.themeColor == Theme.DARK) {
        setBackground(Theme.getSelectorDrawable(Theme.getInstance().getDividerColor(context)));
    } else {
        setBackgroundColor(Color.WHITE);
    }
    this.status = status;
    this.needDivider = needDivider;
    this.iconClicked = iconClicked;
    this.context = context;
    setWillNotDraw(!needDivider);
    View view;
    switch(this.status) {
        case CIRCLE_IMAGE:
            circleImage = new CircleImageView(getContext());
            circleImage.setLayoutParams(LayoutCreator.createFrame(56, 56, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, isRtl ? 0 : padding, 8, isRtl ? padding : 0, 8));
            view = circleImage;
            break;
        case LOADING_CIRCLE_IMAGE:
            circleImageLoading = new ImageLoadingView(context);
            circleImageLoading.setStatus(imageLoadingStatus);
            circleImageLoading.setLayoutParams(LayoutCreator.createFrame(72, 72, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, isRtl ? 0 : 8, 8, isRtl ? 8 : 0, 8));
            view = circleImageLoading;
            break;
        default:
            throw new IllegalStateException("Unexpected value: " + this.status);
    }
    addView(view);
    addIcon = new MaterialDesignTextView(context);
    addIcon.setText(R.string.icon_add_whit_circle);
    addIcon.setTextColor(getResources().getColor(R.color.green));
    addIcon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    addIcon.setGravity(isRtl ? Gravity.LEFT : Gravity.RIGHT);
    addView(addIcon, LayoutCreator.createFrame(18, 18, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, isRtl ? 0 : padding, 8, isRtl ? padding : 0, 8));
    topViewRootView = new LinearLayout(context);
    topViewRootView.setOrientation(LinearLayout.HORIZONTAL);
    topViewRootView.setGravity(Gravity.CENTER);
    addView(topViewRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, isRtl ? padding : ((padding * 2) + 56), 11.5f, isRtl ? ((padding * 2) + 56) : padding, 0));
    channelIconTv = new FontIconTextView(getContext());
    setTextSize(channelIconTv, R.dimen.dp14);
    channelIconTv.setText(R.string.icon_channel);
    channelIconTv.setTextColor(Theme.getInstance().getAccentColor(channelIconTv.getContext()));
    channelIconTv.setVisibility(GONE);
    topViewRootView.addView(channelIconTv, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    topText = new TextView(context);
    topText.setSingleLine();
    topText.setTypeface(ResourcesCompat.getFont(getContext(), R.font.main_font_bold));
    ViewMaker.setTextSize(topText, R.dimen.dp15);
    topText.setSingleLine(true);
    topText.setEllipsize(TextUtils.TruncateAt.END);
    topText.setTextColor(Theme.getInstance().getSendMessageTextColor(topText.getContext()));
    topText.setGravity((isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    topViewRootView.addView(topText, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, !isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0, isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0));
    verifyIconTv = new FontIconTextView(getContext());
    verifyIconTv.setTextColor(getContext().getResources().getColor(R.color.verify_color));
    verifyIconTv.setText(R.string.icon_blue_badge);
    setTextSize(verifyIconTv, R.dimen.standardTextSize);
    verifyIconTv.setVisibility(GONE);
    topViewRootView.addView(verifyIconTv, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, !isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0, isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0));
    middleText = new TextView(context);
    middleText.setSingleLine();
    middleText.setTypeface(ResourcesCompat.getFont(getContext(), R.font.main_font_bold));
    ViewMaker.setTextSize(middleText, R.dimen.dp15);
    middleText.setSingleLine(true);
    middleText.setEllipsize(TextUtils.TruncateAt.END);
    middleText.setTextColor(Theme.getInstance().getPrimaryTextColor(context));
    middleText.setGravity((isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    middleText.setVisibility(GONE);
    addView(middleText, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, isRtl ? padding : ((padding * 2) + 56), 0, isRtl ? ((padding * 2) + 56) : padding, 0));
    bottomText = new TextView(context);
    bottomText.setSingleLine();
    ViewMaker.setTypeFace(bottomText);
    ViewMaker.setTextSize(bottomText, R.dimen.dp13);
    bottomText.setGravity((isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    bottomText.setTextColor(Color.GRAY);
    addView(bottomText, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, isRtl ? padding : ((padding * 2) + 56), 34.5f, isRtl ? ((padding * 2) + 56) : padding, 0));
    icon = new IconView(getContext());
    icon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    icon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
    addView(icon, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, padding, 0, padding, 0));
    icon2 = new IconView(getContext());
    icon2.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    icon2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
    addView(icon2, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, isRtl ? (padding + 30) : padding, 0, isRtl ? padding : (30 + padding), 0));
    LinearLayout iconsRootView = new LinearLayout(getContext());
    iconsRootView.setOrientation(LinearLayout.HORIZONTAL);
    iconsRootView.setGravity(Gravity.CENTER);
    addView(iconsRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, isRtl ? 0 : 8, 8, isRtl ? 8 : 0, 8));
    uploadIcon = new MaterialDesignTextView(getContext());
    uploadIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    uploadIcon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 23);
    uploadIcon.setText(R.string.icon_upload);
    uploadIcon.setVisibility(GONE);
    uploadIcon.setTextColor(Theme.getInstance().getSendMessageTextColor(uploadIcon.getContext()));
    uploadIcon.setGravity(Gravity.CENTER);
    uploadIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if ((circleImageLoading.getStatus() == ImageLoadingView.Status.FAILED && isFromMyStatus && !isRoom) || (circleImageLoading.getStatus() == ImageLoadingView.Status.FAILED && isFromMyStatus && isRoom && mode == 1)) {
                deleteIcon.setVisibility(GONE);
                uploadIcon.setVisibility(GONE);
                middleText.setTextColor(Theme.getInstance().getTitleTextColor(context));
                middleText.setText(context.getString(R.string.story_sending));
                circleImageLoading.setStatus(ImageLoadingView.Status.LOADING);
                StoryObject realmStoryProto;
                if (fileToken != null) {
                    realmStoryProto = MessageDataStorage.getInstance(AccountManager.selectedAccount).getStoryWithFileToken(fileToken);
                } else {
                    realmStoryProto = MessageDataStorage.getInstance(AccountManager.selectedAccount).getStoryWithUploadId(uploadId);
                }
                if (realmStoryProto != null && realmStoryProto.fileToken != null) {
                    MessageDataStorage.getInstance(AccountManager.selectedAccount).updateStoryStatus(realmStoryProto.id, MessageObject.STATUS_SENDING);
                    List<ProtoStoryUserAddNew.StoryAddRequest> storyAddRequests = new ArrayList<>();
                    ProtoStoryUserAddNew.StoryAddRequest.Builder storyAddRequest = ProtoStoryUserAddNew.StoryAddRequest.newBuilder();
                    storyAddRequest.setToken(realmStoryProto.fileToken);
                    storyAddRequest.setCaption(realmStoryProto.caption);
                    storyAddRequests.add(storyAddRequest.build());
                    if (isRoom) {
                        MessageController.getInstance(AccountManager.selectedAccount).addMyRoomStory(storyAddRequests, roomId);
                    } else {
                        MessageController.getInstance(AccountManager.selectedAccount).addMyStory(storyAddRequests);
                    }
                } else if (realmStoryProto != null && !Uploader.getInstance().isCompressingOrUploading(String.valueOf(realmStoryProto.id))) {
                    MessageDataStorage.getInstance(AccountManager.selectedAccount).updateStoryStatus(realmStoryProto.id, MessageObject.STATUS_SENDING);
                    HttpUploader.isStoryUploading = true;
                    Uploader.getInstance().upload(UploadObject.createForStory(realmStoryProto.id, realmStoryProto.attachmentObject.filePath, null, realmStoryProto.caption, ProtoGlobal.RoomMessageType.STORY));
                }
                EventManager.getInstance(AccountManager.selectedAccount).postEvent(EventManager.STORY_SENDING);
            } else {
                deleteStory.deleteStory(StoryCell.this, storyId, roomId, isRoom);
            }
        }
    });
    deleteIcon = new MaterialDesignTextView(getContext());
    deleteIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    deleteIcon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 23);
    deleteIcon.setText(R.string.icon_other_horizontal_dots);
    deleteIcon.setVisibility(GONE);
    deleteIcon.setTextColor(Theme.getInstance().getSendMessageTextColor(deleteIcon.getContext()));
    deleteIcon.setGravity(Gravity.CENTER);
    deleteIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            deleteStory.deleteStory(StoryCell.this, storyId, roomId, isRoom);
        }
    });
    iconsRootView.addView(uploadIcon, LayoutCreator.createLinear(72, 72, Gravity.CENTER_VERTICAL));
    iconsRootView.addView(deleteIcon, LayoutCreator.createLinear(72, 72, Gravity.CENTER_VERTICAL));
    if (status == CircleStatus.LOADING_CIRCLE_IMAGE) {
        setOnClickListener(v -> {
            deleteStory.onStoryClick(this);
        });
        circleImageLoading.setOnClickListener(v -> {
            deleteStory.onStoryClick(this);
        });
    }
}
Also used : IconView(net.iGap.messenger.ui.components.IconView) MainStoryObject(net.iGap.story.MainStoryObject) StoryObject(net.iGap.story.StoryObject) FontIconTextView(net.iGap.module.FontIconTextView) View(android.view.View) FontIconTextView(net.iGap.module.FontIconTextView) TextView(android.widget.TextView) ImageLoadingView(net.iGap.story.liststories.ImageLoadingView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) IconView(net.iGap.messenger.ui.components.IconView) CircleImageView(net.iGap.module.CircleImageView) CircleImageView(net.iGap.module.CircleImageView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) ImageLoadingView(net.iGap.story.liststories.ImageLoadingView) FontIconTextView(net.iGap.module.FontIconTextView) TextView(android.widget.TextView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) List(java.util.List) ArrayList(java.util.ArrayList) ProtoStoryUserAddNew(net.iGap.proto.ProtoStoryUserAddNew) LinearLayout(android.widget.LinearLayout)

Example 15 with StoryObject

use of net.iGap.story.StoryObject in project iGap-Android by KianIranian-STDG.

the class StoryCell method setData.

public void setData(StoryObject storyObject, boolean isRoom, String displayName, String color, Context context, boolean needDivider, CircleStatus status, ImageLoadingView.Status imageLoadingStatus, IconClicked iconClicked) {
    initView(context, needDivider, status, imageLoadingStatus, iconClicked, storyObject.createdAt);
    this.userId = storyObject.userId;
    this.roomId = storyObject.roomId;
    this.isFromMyStatus = true;
    String name = HelperImageBackColor.getFirstAlphabetName(storyObject.displayName != null ? storyObject.displayName : "");
    if (circleImageLoading.getStatus() == ImageLoadingView.Status.FAILED) {
        if (isRoom && mode == 0) {
            deleteIcon.setTextColor(Color.RED);
            topText.setText(storyObject.displayName);
            bottomText.setText(context.getString(R.string.story_could_not_sent));
            bottomText.setTextColor(Color.RED);
        } else {
            uploadIcon.setVisibility(VISIBLE);
            deleteIcon.setVisibility(VISIBLE);
            deleteIcon.setText(R.string.icon_delete);
            topText.setVisibility(GONE);
            bottomText.setVisibility(GONE);
            middleText.setVisibility(VISIBLE);
            middleText.setText(context.getString(R.string.story_could_not_sent));
            middleText.setTextColor(Color.RED);
        }
    } else if (circleImageLoading.getStatus() == ImageLoadingView.Status.LOADING) {
        if (isRoom && mode == 0) {
            topText.setText(storyObject.displayName);
            bottomText.setText(context.getString(R.string.story_sending));
        } else {
            uploadIcon.setVisibility(GONE);
            deleteIcon.setVisibility(GONE);
            topText.setVisibility(GONE);
            middleText.setVisibility(VISIBLE);
            middleText.setText(context.getString(R.string.story_sending));
            middleText.setTextColor(Theme.getInstance().getTitleTextColor(context));
        }
    } else {
        topText.setVisibility(VISIBLE);
        bottomText.setVisibility(VISIBLE);
        middleText.setVisibility(GONE);
        uploadIcon.setVisibility(GONE);
        deleteIcon.setVisibility(VISIBLE);
        if (isRoom && mode == 0) {
            topText.setText(storyObject.displayName);
        } else {
            if (G.selectedLanguage.equals("fa")) {
                topText.setText(HelperCalander.convertToUnicodeFarsiNumber(String.valueOf(storyObject.viewCount)) + " " + context.getString(R.string.story_views));
            } else {
                topText.setText(storyObject.viewCount + " " + context.getString(R.string.story_views));
            }
        }
        bottomText.setText(LastSeenTimeUtil.computeTime(context, storyObject.userId, storyObject.createdAt / 1000L, false, false));
    }
    AttachmentObject attachment = storyObject.attachmentObject;
    if (attachment != null && (attachment.thumbnailPath != null || attachment.filePath != null)) {
        try {
            Glide.with(G.context).load(attachment.filePath != null ? attachment.filePath : attachment.thumbnailPath).placeholder(new BitmapDrawable(context.getResources(), HelperImageBackColor.drawAlphabetOnPicture(LayoutCreator.dp(64), name, color))).into(circleImageLoading);
        } catch (Exception e) {
            Glide.with(G.context).load(HelperImageBackColor.drawAlphabetOnPicture(LayoutCreator.dp(64), name, color)).into(circleImageLoading);
        }
    } else if (attachment != null) {
        Glide.with(G.context).load(new BitmapDrawable(context.getResources(), HelperImageBackColor.drawAlphabetOnPicture(LayoutCreator.dp(64), name, color))).into(circleImageLoading);
        DownloadObject object = DownloadObject.createForStory(attachment, storyObject.storyId, true);
        Log.e("skfjskjfsd", "setData2: " + storyId + "/" + object.downloadId);
        if (object != null) {
            Downloader.getInstance(AccountManager.selectedAccount).download(object, arg -> {
                if (arg.status == Status.SUCCESS && arg.data != null) {
                    String filepath = arg.data.getFilePath();
                    String downloadedFileToken = arg.data.getToken();
                    if (!(new File(filepath).exists())) {
                        HelperLog.getInstance().setErrorLog(new Exception("File Dont Exist After Download !!" + filepath));
                    }
                    if (arg.data.getDownloadObject().downloadId == storyId) {
                        DbManager.getInstance().doRealmTransaction(realm1 -> {
                            RealmStoryProto realmStoryProto = realm1.where(RealmStoryProto.class).equalTo("isForReply", false).equalTo("storyId", storyId).findFirst();
                            if (realmStoryProto != null) {
                                realmStoryProto.getFile().setLocalFilePath(filepath);
                            }
                        });
                        G.runOnUiThread(() -> Glide.with(G.context).load(filepath).placeholder(new BitmapDrawable(context.getResources(), HelperImageBackColor.drawAlphabetOnPicture(LayoutCreator.dp(64), name, color))).into(circleImageLoading));
                    }
                }
            });
        }
    } else {
        Glide.with(G.context).load(new BitmapDrawable(context.getResources(), HelperImageBackColor.drawAlphabetOnPicture(LayoutCreator.dp(64), name, color))).into(circleImageLoading);
    }
}
Also used : LinearLayout(android.widget.LinearLayout) NonNull(androidx.annotation.NonNull) UploadObject(net.iGap.module.upload.UploadObject) FrameLayout(android.widget.FrameLayout) LastSeenTimeUtil(net.iGap.module.LastSeenTimeUtil) Theme(net.iGap.module.Theme) G(net.iGap.G) HttpUploader(net.iGap.helper.upload.ApiBased.HttpUploader) RealmStoryProto(net.iGap.realm.RealmStoryProto) View(android.view.View) Canvas(android.graphics.Canvas) Log(android.util.Log) HelperImageBackColor(net.iGap.helper.HelperImageBackColor) MainStoryObject(net.iGap.story.MainStoryObject) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType) HelperCalander(net.iGap.helper.HelperCalander) MessageController(net.iGap.controllers.MessageController) Status(net.iGap.module.downloader.Status) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Downloader(net.iGap.module.downloader.Downloader) RealmStory(net.iGap.realm.RealmStory) Uploader(net.iGap.module.upload.Uploader) HelperLog(net.iGap.helper.HelperLog) FontIconTextView(net.iGap.module.FontIconTextView) List(java.util.List) TextView(android.widget.TextView) ProtoStoryUserAddNew(net.iGap.proto.ProtoStoryUserAddNew) ViewMaker.i_Dp(net.iGap.adapter.items.chat.ViewMaker.i_Dp) Paint(android.graphics.Paint) EventManager(net.iGap.observers.eventbus.EventManager) DownloadObject(net.iGap.module.downloader.DownloadObject) Context(android.content.Context) AttachmentObject(net.iGap.structs.AttachmentObject) ResourcesCompat(androidx.core.content.res.ResourcesCompat) ViewMaker.setTextSize(net.iGap.adapter.items.chat.ViewMaker.setTextSize) AccountManager(net.iGap.module.accountManager.AccountManager) StoryObject(net.iGap.story.StoryObject) ArrayList(java.util.ArrayList) LayoutCreator(net.iGap.helper.LayoutCreator) AvatarHandler(net.iGap.helper.avatar.AvatarHandler) ImageLoadingView(net.iGap.story.liststories.ImageLoadingView) MessageObject(net.iGap.structs.MessageObject) TextUtils(android.text.TextUtils) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) IconView(net.iGap.messenger.ui.components.IconView) CircleImageView(net.iGap.module.CircleImageView) File(java.io.File) Color(android.graphics.Color) Gravity(android.view.Gravity) Glide(com.bumptech.glide.Glide) TypedValue(android.util.TypedValue) ViewMaker(net.iGap.adapter.items.chat.ViewMaker) ProtoGlobal(net.iGap.proto.ProtoGlobal) MessageDataStorage(net.iGap.controllers.MessageDataStorage) R(net.iGap.R) DbManager(net.iGap.module.accountManager.DbManager) RealmStoryProto(net.iGap.realm.RealmStoryProto) AttachmentObject(net.iGap.structs.AttachmentObject) DownloadObject(net.iGap.module.downloader.DownloadObject) BitmapDrawable(android.graphics.drawable.BitmapDrawable) File(java.io.File)

Aggregations

StoryObject (net.iGap.story.StoryObject)24 MainStoryObject (net.iGap.story.MainStoryObject)22 ArrayList (java.util.ArrayList)18 RealmStoryProto (net.iGap.realm.RealmStoryProto)15 CountDownLatch (java.util.concurrent.CountDownLatch)12 RealmStory (net.iGap.realm.RealmStory)8 Sort (io.realm.Sort)4 List (java.util.List)4 RealmAttachment (net.iGap.realm.RealmAttachment)3 View (android.view.View)2 LinearLayout (android.widget.LinearLayout)2 TextView (android.widget.TextView)2 File (java.io.File)2 IconView (net.iGap.messenger.ui.components.IconView)2 CircleImageView (net.iGap.module.CircleImageView)2 FontIconTextView (net.iGap.module.FontIconTextView)2 MaterialDesignTextView (net.iGap.module.MaterialDesignTextView)2 ProtoStoryUserAddNew (net.iGap.proto.ProtoStoryUserAddNew)2 RealmRegisteredInfo (net.iGap.realm.RealmRegisteredInfo)2 ImageLoadingView (net.iGap.story.liststories.ImageLoadingView)2