Search in sources :

Example 16 with MediaMessage

use of com.cometchat.pro.models.MediaMessage in project android-java-chat-push-notification-app by cometchat-pro.

the class ThreadAdapter method setAudioData.

private void setAudioData(AudioMessageViewHolder viewHolder, int i) {
    BaseMessage baseMessage = messageList.get(i);
    if (baseMessage != null && baseMessage.getDeletedAt() == 0) {
        viewHolder.playBtn.setImageTintList(ColorStateList.valueOf(context.getResources().getColor(R.color.textColorWhite)));
        setAvatar(viewHolder.ivUser, baseMessage.getSender().getAvatar(), baseMessage.getSender().getName());
        viewHolder.tvUser.setText(baseMessage.getSender().getName());
        showMessageTime(viewHolder, baseMessage);
        // if (selectedItemList.contains(baseMessage.getId()))
        // viewHolder.txtTime.setVisibility(View.VISIBLE);
        // else
        // viewHolder.txtTime.setVisibility(View.GONE);
        Attachment attachment = ((MediaMessage) baseMessage).getAttachment();
        if (attachment != null) {
            viewHolder.playBtn.setVisibility(View.VISIBLE);
            viewHolder.length.setText(Utils.getFileSize(((MediaMessage) baseMessage).getAttachment().getFileSize()));
        } else {
            viewHolder.length.setText("-");
            viewHolder.playBtn.setVisibility(View.GONE);
        }
        viewHolder.playBtn.setImageResource(R.drawable.ic_play_arrow_black_24dp);
        viewHolder.playBtn.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // MediaUtils.openFile(((MediaMessage) baseMessage).getAttachment().getFileUrl(),context);
                mediaPlayer.reset();
                if (messagePosition != i) {
                    notifyItemChanged(messagePosition);
                    messagePosition = i;
                }
                try {
                    mediaPlayer.setDataSource(((MediaMessage) baseMessage).getAttachment().getFileUrl());
                    mediaPlayer.prepare();
                    mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

                        @Override
                        public void onCompletion(MediaPlayer mp) {
                            viewHolder.playBtn.setImageResource(R.drawable.ic_play_arrow_black_24dp);
                        }
                    });
                } catch (Exception e) {
                    Log.e(TAG, "MediaPlayerError: " + e.getMessage());
                }
                if (!mediaPlayer.isPlaying()) {
                    mediaPlayer.start();
                    viewHolder.playBtn.setImageResource(R.drawable.ic_pause_24dp);
                } else {
                    mediaPlayer.pause();
                    viewHolder.playBtn.setImageResource(R.drawable.ic_play_arrow_black_24dp);
                }
            }
        });
        viewHolder.rlMessageBubble.setOnLongClickListener(new View.OnLongClickListener() {

            @Override
            public boolean onLongClick(View v) {
                if (!isLongClickEnabled && !isTextMessageClick) {
                    isImageMessageClick = true;
                    setLongClickSelectedItem(baseMessage);
                    messageLongClick.setLongMessageClick(longselectedItemList);
                    notifyDataSetChanged();
                }
                return true;
            }
        });
        viewHolder.reactionLayout.setVisibility(View.GONE);
        setReactionSupport(baseMessage, viewHolder.reactionLayout);
    }
}
Also used : MediaMessage(com.cometchat.pro.models.MediaMessage) BaseMessage(com.cometchat.pro.models.BaseMessage) Attachment(com.cometchat.pro.models.Attachment) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) CardView(androidx.cardview.widget.CardView) TextView(android.widget.TextView) MaterialCardView(com.google.android.material.card.MaterialCardView) CometChatException(com.cometchat.pro.exceptions.CometChatException) JSONException(org.json.JSONException) MediaPlayer(android.media.MediaPlayer)

Example 17 with MediaMessage

use of com.cometchat.pro.models.MediaMessage in project android-java-chat-push-notification-app by cometchat-pro.

the class CometChatMessageList method startThreadActivity.

private void startThreadActivity() {
    Intent intent = new Intent(getContext(), CometChatThreadMessageListActivity.class);
    intent.putExtra(UIKitConstants.IntentStrings.CONVERSATION_NAME, name);
    intent.putExtra(UIKitConstants.IntentStrings.NAME, baseMessage.getSender().getName());
    intent.putExtra(UIKitConstants.IntentStrings.UID, baseMessage.getSender().getName());
    intent.putExtra(UIKitConstants.IntentStrings.AVATAR, baseMessage.getSender().getAvatar());
    intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID, baseMessage.getId());
    intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT, baseMessage.getReplyCount());
    intent.putExtra(UIKitConstants.IntentStrings.SENTAT, baseMessage.getSentAt());
    intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO, Extensions.getReactionsOnMessage(baseMessage));
    if (baseMessage.getCategory().equalsIgnoreCase(CometChatConstants.CATEGORY_MESSAGE)) {
        intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, baseMessage.getType());
        if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT))
            intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, ((TextMessage) baseMessage).getText());
        else {
            intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, ((MediaMessage) baseMessage).getAttachment().getFileName());
            intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, ((MediaMessage) baseMessage).getAttachment().getFileExtension());
            intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL, ((MediaMessage) baseMessage).getAttachment().getFileUrl());
            intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, ((MediaMessage) baseMessage).getAttachment().getFileSize());
            intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE, ((MediaMessage) baseMessage).getAttachment().getFileMimeType());
        }
    } else {
        try {
            if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) {
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.LOCATION);
                intent.putExtra(UIKitConstants.IntentStrings.LOCATION_LATITUDE, ((CustomMessage) baseMessage).getCustomData().getDouble("latitude"));
                intent.putExtra(UIKitConstants.IntentStrings.LOCATION_LONGITUDE, ((CustomMessage) baseMessage).getCustomData().getDouble("longitude"));
            } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.STICKERS)) {
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, ((CustomMessage) baseMessage).getCustomData().getString("name"));
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL, ((CustomMessage) baseMessage).getCustomData().getString("url"));
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.STICKERS);
            } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WHITEBOARD)) {
                intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, Extensions.getWhiteBoardUrl(baseMessage));
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.WHITEBOARD);
            } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WRITEBOARD)) {
                intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, Extensions.getWriteBoardUrl(baseMessage));
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.WRITEBOARD);
            } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.POLLS)) {
                JSONObject options = ((CustomMessage) baseMessage).getCustomData().getJSONObject("options");
                intent.putExtra(UIKitConstants.IntentStrings.POLL_QUESTION, ((CustomMessage) baseMessage).getCustomData().getString("question"));
                intent.putExtra(UIKitConstants.IntentStrings.POLL_OPTION, options.toString());
                intent.putExtra(UIKitConstants.IntentStrings.POLL_VOTE_COUNT, Extensions.getVoteCount(baseMessage));
                intent.putExtra(UIKitConstants.IntentStrings.POLL_RESULT, Extensions.getVoterInfo(baseMessage, options.length()));
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.POLLS);
            }
        } catch (Exception e) {
            Log.e(TAG, "startThreadActivityError: " + e.getMessage());
        }
    }
    intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY, baseMessage.getCategory());
    intent.putExtra(UIKitConstants.IntentStrings.TYPE, type);
    if (type.equals(CometChatConstants.CONVERSATION_TYPE_GROUP)) {
        intent.putExtra(UIKitConstants.IntentStrings.GUID, Id);
    } else {
        intent.putExtra(UIKitConstants.IntentStrings.UID, Id);
    }
    startActivity(intent);
}
Also used : MediaMessage(com.cometchat.pro.models.MediaMessage) JSONObject(org.json.JSONObject) CustomMessage(com.cometchat.pro.models.CustomMessage) Intent(android.content.Intent) TextMessage(com.cometchat.pro.models.TextMessage) CometChatException(com.cometchat.pro.exceptions.CometChatException) JSONException(org.json.JSONException)

Example 18 with MediaMessage

use of com.cometchat.pro.models.MediaMessage in project android-java-chat-push-notification-app by cometchat-pro.

the class CometChatMessageList method setComposeBoxListener.

private void setComposeBoxListener() {
    composeBox.setComposeBoxListener(new ComposeActionListener() {

        @Override
        public void onEditTextMediaSelected(InputContentInfoCompat inputContentInfo) {
            Log.e(TAG, "onEditTextMediaSelected: Path=" + inputContentInfo.getLinkUri().getPath() + "\nHost=" + inputContentInfo.getLinkUri().getFragment());
            String messageType = inputContentInfo.getLinkUri().toString().substring(inputContentInfo.getLinkUri().toString().lastIndexOf('.'));
            MediaMessage mediaMessage = new MediaMessage(Id, null, CometChatConstants.MESSAGE_TYPE_IMAGE, type);
            Attachment attachment = new Attachment();
            attachment.setFileUrl(inputContentInfo.getLinkUri().toString());
            attachment.setFileMimeType(inputContentInfo.getDescription().getMimeType(0));
            attachment.setFileExtension(messageType);
            attachment.setFileName(inputContentInfo.getDescription().getLabel().toString());
            mediaMessage.setAttachment(attachment);
            Log.e(TAG, "onClick: " + attachment.toString());
            sendMediaMessage(mediaMessage);
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            if (charSequence.length() > 0) {
                sendTypingIndicator(false);
            } else {
                sendTypingIndicator(true);
            }
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (!editable.toString().isEmpty()) {
                composeBox.hideSendButton(false);
                composeBox.hideRecordOption(true);
            } else {
                composeBox.hideSendButton(true);
                composeBox.hideRecordOption(false);
            }
            if (typingTimer == null) {
                typingTimer = new Timer();
            }
            endTypingTimer();
        }

        @Override
        public void onAudioActionClicked() {
            if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                startActivityForResult(MediaUtils.openAudio(getActivity()), UIKitConstants.RequestCode.AUDIO);
            } else {
                requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, UIKitConstants.RequestCode.AUDIO);
            }
        }

        @Override
        public void onCameraActionClicked() {
            if (Utils.hasPermissions(getContext(), CAMERA_PERMISSION)) {
                startActivityForResult(MediaUtils.openCamera(getContext()), UIKitConstants.RequestCode.CAMERA);
            } else {
                requestPermissions(CAMERA_PERMISSION, UIKitConstants.RequestCode.CAMERA);
            }
        }

        @Override
        public void onGalleryActionClicked() {
            if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                startActivityForResult(MediaUtils.openGallery(getActivity()), UIKitConstants.RequestCode.GALLERY);
            } else {
                requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, UIKitConstants.RequestCode.GALLERY);
            }
        }

        @Override
        public void onFileActionClicked() {
            if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                startActivityForResult(MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC), UIKitConstants.RequestCode.FILE);
            } else {
                requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, UIKitConstants.RequestCode.FILE);
            }
        }

        @Override
        public void onSendActionClicked(EditText editText) {
            String message = editText.getText().toString().trim();
            String filterEmojiMessage = PatternUtils.removeEmojiAndSymbol(message);
            editText.setText("");
            editText.setHint(getString(R.string.message));
            FeatureRestriction.isEmojisEnabled(new FeatureRestriction.OnSuccessListener() {

                @Override
                public void onSuccess(Boolean booleanVal) {
                    if (!booleanVal) {
                        if (filterEmojiMessage.trim().length() > 0) {
                            if (isEdit) {
                                editMessage(baseMessage, message);
                                editMessageLayout.setVisibility(GONE);
                            } else if (isReply) {
                                replyMessage(baseMessage, message);
                                replyMessageLayout.setVisibility(GONE);
                            } else if (!message.isEmpty())
                                sendMessage(message);
                        } else {
                            Toast.makeText(getContext(), "Emoji Support is not enabled", Toast.LENGTH_LONG).show();
                        }
                    } else {
                        if (isEdit) {
                            editMessage(baseMessage, message);
                            editMessageLayout.setVisibility(GONE);
                        } else if (isReply) {
                            replyMessage(baseMessage, message);
                            replyMessageLayout.setVisibility(GONE);
                        } else if (!message.isEmpty())
                            sendMessage(message);
                    }
                }
            });
        }

        @Override
        public void onVoiceNoteComplete(String string) {
            if (string != null) {
                File audioFile = new File(string);
                sendMediaMessage(audioFile, CometChatConstants.MESSAGE_TYPE_AUDIO);
            }
        }

        @Override
        public void onLocationActionClicked() {
            if (Utils.hasPermissions(getContext(), Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION)) {
                initLocation();
                // locationManager = (LocationManager) Objects.requireNonNull(getContext()).getSystemService(Context.LOCATION_SERVICE);
                boolean gpsprovider = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
                if (!gpsprovider) {
                    turnOnLocation();
                } else {
                    getLocation();
                }
            } else {
                requestPermissions(new String[] { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION }, UIKitConstants.RequestCode.LOCATION);
                if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
                    checkBackgroundLocationPermissionAPI30(UIKitConstants.RequestCode.LOCATION);
                }
            }
        }

        @Override
        public void onPollActionClicked() {
            createPollDialog();
        }

        @Override
        public void onStickerClicked() {
            stickerLayout.setVisibility(View.VISIBLE);
            Extensions.fetchStickers(new ExtensionResponseListener() {

                @Override
                public void OnResponseSuccess(Object var) {
                    JSONObject stickersJSON = (JSONObject) var;
                    stickersView.setData(Id, type, Extensions.extractStickersFromJSON(stickersJSON));
                }

                @Override
                public void OnResponseFailed(CometChatException e) {
                    CometChatSnackBar.show(context, stickersView, CometChatError.localized(e), CometChatSnackBar.ERROR);
                }
            });
        }

        @Override
        public void onWhiteboardClicked() {
            Extensions.callWhiteBoardExtension(Id, type, new ExtensionResponseListener() {

                @Override
                public void OnResponseSuccess(Object var) {
                    JSONObject jsonObject = (JSONObject) var;
                }

                @Override
                public void OnResponseFailed(CometChatException e) {
                    CometChatSnackBar.show(context, rvChatListView, CometChatError.localized(e), CometChatSnackBar.ERROR);
                }
            });
        }

        @Override
        public void onWriteboardClicked() {
            Extensions.callWriteBoardExtension(Id, type, new ExtensionResponseListener() {

                @Override
                public void OnResponseSuccess(Object var) {
                    JSONObject jsonObject = (JSONObject) var;
                }

                @Override
                public void OnResponseFailed(CometChatException e) {
                    CometChatSnackBar.show(context, rvChatListView, CometChatError.localized(e), CometChatSnackBar.ERROR);
                }
            });
        }
    });
}
Also used : EditText(android.widget.EditText) CometChatException(com.cometchat.pro.exceptions.CometChatException) MediaMessage(com.cometchat.pro.models.MediaMessage) Attachment(com.cometchat.pro.models.Attachment) ComposeActionListener(com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox.listener.ComposeActionListener) InputContentInfoCompat(androidx.core.view.inputmethod.InputContentInfoCompat) ExtensionResponseListener(com.cometchat.pro.uikit.ui_components.messages.extensions.ExtensionResponseListener) Timer(java.util.Timer) JSONObject(org.json.JSONObject) Editable(android.text.Editable) JSONObject(org.json.JSONObject) OnSuccessListener(com.google.android.gms.tasks.OnSuccessListener) File(java.io.File)

Example 19 with MediaMessage

use of com.cometchat.pro.models.MediaMessage in project android-java-chat-push-notification-app by cometchat-pro.

the class CometChatMessageList method shareMessage.

private void shareMessage() {
    if (baseMessage != null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) {
        Intent shareIntent = new Intent();
        shareIntent.setAction(Intent.ACTION_SEND);
        shareIntent.putExtra(Intent.EXTRA_TITLE, getResources().getString(R.string.app_name));
        shareIntent.putExtra(Intent.EXTRA_TEXT, ((TextMessage) baseMessage).getText());
        shareIntent.setType("text/plain");
        Intent intent = Intent.createChooser(shareIntent, getResources().getString(R.string.share_message));
        startActivity(intent);
    } else if (baseMessage != null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) {
        String mediaName = ((MediaMessage) baseMessage).getAttachment().getFileName();
        Glide.with(context).asBitmap().load(((MediaMessage) baseMessage).getAttachment().getFileUrl()).into(new SimpleTarget<Bitmap>() {

            @Override
            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), resource, mediaName, null);
                Intent shareIntent = new Intent();
                shareIntent.setAction(Intent.ACTION_SEND);
                shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(path));
                shareIntent.setType(((MediaMessage) baseMessage).getAttachment().getFileMimeType());
                Intent intent = Intent.createChooser(shareIntent, getResources().getString(R.string.share_message));
                startActivity(intent);
            }
        });
    } else if (baseMessage != null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO) || baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE) || baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) {
        MediaUtils.downloadAndShareFile(context, ((MediaMessage) baseMessage));
    }
}
Also used : SimpleTarget(com.bumptech.glide.request.target.SimpleTarget) Bitmap(android.graphics.Bitmap) MediaMessage(com.cometchat.pro.models.MediaMessage) NonNull(androidx.annotation.NonNull) Transition(com.bumptech.glide.request.transition.Transition) Intent(android.content.Intent) Nullable(androidx.annotation.Nullable)

Example 20 with MediaMessage

use of com.cometchat.pro.models.MediaMessage in project android-java-chat-push-notification-app by cometchat-pro.

the class CometChatMessageList method setLongMessageClick.

@Override
public void setLongMessageClick(List<BaseMessage> baseMessagesList) {
    Log.e(TAG, "setLongMessageClick: " + baseMessagesList);
    isReply = false;
    isEdit = false;
    messageActionFragment = new CometChatMessageActions();
    replyMessageLayout.setVisibility(GONE);
    editMessageLayout.setVisibility(GONE);
    fetchSettings();
    List<BaseMessage> textMessageList = new ArrayList<>();
    List<BaseMessage> mediaMessageList = new ArrayList<>();
    List<BaseMessage> locationMessageList = new ArrayList<>();
    List<BaseMessage> pollsMessageList = new ArrayList<>();
    List<BaseMessage> stickerMessageList = new ArrayList<>();
    List<BaseMessage> whiteBoardMessageList = new ArrayList<>();
    List<BaseMessage> writeBoardMessageList = new ArrayList<>();
    List<BaseMessage> meetingMessageList = new ArrayList<>();
    for (BaseMessage baseMessage : baseMessagesList) {
        if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) {
            textMessageList.add(baseMessage);
        } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO) || baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE) || baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) {
            mediaMessageList.add(baseMessage);
        } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) {
            locationMessageList.add(baseMessage);
        } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.STICKERS)) {
            stickerMessageList.add(baseMessage);
        } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.POLLS)) {
            pollsMessageList.add(baseMessage);
        } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WHITEBOARD)) {
            whiteBoardMessageList.add(baseMessage);
        } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WRITEBOARD)) {
            writeBoardMessageList.add(baseMessage);
        } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.GROUP_CALL)) {
            meetingMessageList.add(baseMessage);
        }
    }
    if (textMessageList.size() == 1) {
        BaseMessage basemessage = textMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (!(basemessage instanceof Action) && basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getReplyCount() > 0)
                    threadVisible = false;
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                } else {
                    editVisible = false;
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                }
                if (basemessage.getSentAt() == -1) {
                    translateVisible = false;
                    threadVisible = false;
                    deleteVisible = false;
                    editVisible = false;
                    copyVisible = false;
                    forwardVisible = false;
                    reactionVisible = false;
                    replyVisible = false;
                    shareVisible = false;
                    retryVisible = true;
                }
            }
        }
    }
    if (mediaMessageList.size() == 1) {
        translateVisible = false;
        BaseMessage basemessage = mediaMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (!(basemessage instanceof Action) && basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getReplyCount() > 0)
                    threadVisible = false;
                copyVisible = false;
                // }
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                    editVisible = false;
                } else {
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                    editVisible = false;
                }
            }
            if (basemessage.getSentAt() == -1) {
                translateVisible = false;
                threadVisible = false;
                deleteVisible = false;
                editVisible = false;
                copyVisible = false;
                forwardVisible = false;
                reactionVisible = false;
                replyVisible = false;
                shareVisible = false;
                retryVisible = true;
            }
        }
    }
    if (locationMessageList.size() == 1) {
        translateVisible = false;
        BaseMessage basemessage = locationMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (!(basemessage instanceof Action) && basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getReplyCount() > 0)
                    threadVisible = false;
                else {
                    FeatureRestriction.isThreadedMessagesEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            threadVisible = booleanVal;
                        }
                    });
                }
                copyVisible = false;
                FeatureRestriction.isMessageRepliesEnabled(new FeatureRestriction.OnSuccessListener() {

                    @Override
                    public void onSuccess(Boolean booleanVal) {
                        replyVisible = booleanVal;
                    }
                });
                shareVisible = false;
                FeatureRestriction.isShareCopyForwardMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                    @Override
                    public void onSuccess(Boolean booleanVal) {
                        forwardVisible = booleanVal;
                    }
                });
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                    editVisible = false;
                } else {
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                    editVisible = false;
                }
            }
            if (basemessage.getSentAt() == -1) {
                translateVisible = false;
                threadVisible = false;
                deleteVisible = false;
                editVisible = false;
                copyVisible = false;
                forwardVisible = false;
                reactionVisible = false;
                replyVisible = false;
                shareVisible = false;
                retryVisible = true;
            }
        }
    }
    if (pollsMessageList.size() == 1) {
        forwardVisible = false;
        translateVisible = false;
        copyVisible = false;
        editVisible = false;
        shareVisible = false;
        BaseMessage basemessage = pollsMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (!(basemessage instanceof Action) && basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getReplyCount() > 0)
                    threadVisible = false;
                else {
                    FeatureRestriction.isThreadedMessagesEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            threadVisible = booleanVal;
                        }
                    });
                }
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                } else {
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                }
            }
        }
    }
    if (stickerMessageList.size() == 1) {
        forwardVisible = false;
        copyVisible = false;
        editVisible = false;
        translateVisible = false;
        shareVisible = false;
        BaseMessage basemessage = stickerMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getReplyCount() > 0)
                    threadVisible = false;
                else {
                    FeatureRestriction.isThreadedMessagesEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            threadVisible = booleanVal;
                        }
                    });
                }
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                } else {
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                }
            }
        }
    }
    if (whiteBoardMessageList.size() == 1) {
        forwardVisible = false;
        copyVisible = false;
        translateVisible = false;
        editVisible = false;
        shareVisible = false;
        BaseMessage basemessage = whiteBoardMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getReplyCount() > 0)
                    threadVisible = false;
                else {
                    FeatureRestriction.isThreadedMessagesEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            threadVisible = booleanVal;
                        }
                    });
                }
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                } else {
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                }
            }
        }
    }
    if (writeBoardMessageList.size() == 1) {
        forwardVisible = false;
        copyVisible = false;
        editVisible = false;
        translateVisible = false;
        shareVisible = false;
        BaseMessage basemessage = writeBoardMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getReplyCount() > 0)
                    threadVisible = false;
                else {
                    FeatureRestriction.isThreadedMessagesEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            threadVisible = booleanVal;
                        }
                    });
                }
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                } else {
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                }
            }
        }
    }
    if (meetingMessageList.size() == 1) {
        forwardVisible = false;
        copyVisible = false;
        editVisible = false;
        shareVisible = false;
        replyVisible = true;
        translateVisible = false;
        threadVisible = false;
        BaseMessage basemessage = meetingMessageList.get(0);
        if (basemessage != null && basemessage.getSender() != null) {
            if (basemessage.getDeletedAt() == 0) {
                baseMessage = basemessage;
                if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) {
                    FeatureRestriction.isDeleteMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                        @Override
                        public void onSuccess(Boolean booleanVal) {
                            deleteVisible = booleanVal;
                        }
                    });
                } else {
                    if (loggedInUserScope != null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) {
                        FeatureRestriction.isDeleteMemberMessageEnabled(new FeatureRestriction.OnSuccessListener() {

                            @Override
                            public void onSuccess(Boolean booleanVal) {
                                deleteVisible = booleanVal;
                            }
                        });
                    } else {
                        deleteVisible = false;
                    }
                }
            }
        }
    }
    baseMessages = baseMessagesList;
    Bundle bundle = new Bundle();
    bundle.putBoolean("copyVisible", copyVisible);
    bundle.putBoolean("threadVisible", threadVisible);
    bundle.putBoolean("shareVisible", shareVisible);
    bundle.putBoolean("editVisible", editVisible);
    bundle.putBoolean("deleteVisible", deleteVisible);
    bundle.putBoolean("replyVisible", replyVisible);
    bundle.putBoolean("forwardVisible", forwardVisible);
    bundle.putBoolean("translateVisible", translateVisible);
    bundle.putBoolean("retryVisible", retryVisible);
    bundle.putBoolean("isReactionVisible", reactionVisible);
    if (baseMessage.getReceiverType().equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_GROUP) && !baseMessage.getSender().getUid().equalsIgnoreCase(loggedInUser.getUid())) {
        bundle.putBoolean("privateReplyVisible", replyPrivately);
        bundle.putBoolean("replyPrivatelyVisible", replyVisible);
    }
    if (CometChat.isExtensionEnabled("reactions")) {
        bundle.putBoolean("isReactionVisible", true);
    } else {
        bundle.putBoolean("isReactionVisible", false);
    }
    if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP) && baseMessage.getSender().getUid().equals(loggedInUser.getUid())) {
        FeatureRestriction.isDeliveryReceiptsEnabled(new FeatureRestriction.OnSuccessListener() {

            @Override
            public void onSuccess(Boolean booleanVal) {
                if (booleanVal)
                    bundle.putBoolean("messageInfoVisible", true);
            }
        });
    }
    bundle.putString("type", CometChatMessageListActivity.class.getName());
    messageActionFragment.setArguments(bundle);
    if (baseMessage.getSentAt() != 0) {
        if (retryVisible || editVisible || copyVisible || threadVisible || shareVisible || deleteVisible || replyVisible || forwardVisible || reactionVisible) {
            messageActionFragment.show(getFragmentManager(), messageActionFragment.getTag());
        }
    }
    messageActionFragment.setMessageActionListener(new CometChatMessageActions.MessageActionListener() {

        @Override
        public void onReplyMessagePrivately() {
            if (baseMessage != null) {
                User user = baseMessage.getSender();
                Intent intent = new Intent(context, CometChatMessageListActivity.class);
                intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid());
                intent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar());
                intent.putExtra(UIKitConstants.IntentStrings.STATUS, user.getStatus());
                intent.putExtra(UIKitConstants.IntentStrings.LINK, user.getLink());
                intent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName());
                intent.putExtra(UIKitConstants.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_USER);
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE, baseMessage.getRawMessage().toString());
                startActivity(intent);
                if (getActivity() != null)
                    getActivity().finish();
            }
        }

        @Override
        public void onPrivateReplyToUser() {
            if (baseMessage != null) {
                User user = baseMessage.getSender();
                Intent intent = new Intent(context, CometChatMessageListActivity.class);
                intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid());
                intent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar());
                intent.putExtra(UIKitConstants.IntentStrings.STATUS, user.getStatus());
                intent.putExtra(UIKitConstants.IntentStrings.LINK, user.getLink());
                intent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName());
                intent.putExtra(UIKitConstants.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_USER);
                startActivity(intent);
                if (getActivity() != null)
                    getActivity().finish();
            }
        }

        @Override
        public void onThreadMessageClick() {
            startThreadActivity();
        }

        @Override
        public void onEditMessageClick() {
            if (baseMessage != null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) {
                isEdit = true;
                isReply = false;
                tvMessageTitle.setText(getResources().getString(R.string.edit_message));
                tvMessageSubTitle.setText(((TextMessage) baseMessage).getText());
                composeBox.ivMic.setVisibility(GONE);
                composeBox.ivSend.setVisibility(View.VISIBLE);
                editMessageLayout.setVisibility(View.VISIBLE);
                composeBox.etComposeBox.setText(((TextMessage) baseMessage).getText());
                if (messageAdapter != null) {
                    messageAdapter.setSelectedMessage(baseMessage.getId());
                    messageAdapter.notifyDataSetChanged();
                }
            }
        }

        @Override
        public void onReplyMessageClick() {
            replyMessage();
        }

        @Override
        public void onForwardMessageClick() {
            startForwardMessageActivity();
        }

        @Override
        public void onDeleteMessageClick() {
            deleteMessage(baseMessage);
            if (messageAdapter != null) {
                messageAdapter.clearLongClickSelectedItem();
                messageAdapter.notifyDataSetChanged();
            }
        }

        @Override
        public void onCopyMessageClick() {
            String message = "";
            for (BaseMessage bMessage : baseMessages) {
                if (bMessage.getDeletedAt() == 0 && bMessage instanceof TextMessage) {
                    message = message + "[" + Utils.getLastMessageDate(context, bMessage.getSentAt()) + "] " + bMessage.getSender().getName() + ": " + ((TextMessage) bMessage).getText();
                }
            }
            Log.e(TAG, "onCopy: " + message);
            ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clipData = ClipData.newPlainText("MessageAdapter", message);
            clipboardManager.setPrimaryClip(clipData);
            Toast.makeText(context, getResources().getString(R.string.text_copied), Toast.LENGTH_LONG).show();
            if (messageAdapter != null) {
                messageAdapter.clearLongClickSelectedItem();
                messageAdapter.notifyDataSetChanged();
            }
        }

        @Override
        public void onShareMessageClick() {
            shareMessage();
        }

        @Override
        public void onMessageInfoClick() {
            Intent intent = new Intent(context, CometChatMessageInfoScreenActivity.class);
            intent.putExtra(UIKitConstants.IntentStrings.ID, baseMessage.getId());
            intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, baseMessage.getType());
            intent.putExtra(UIKitConstants.IntentStrings.SENTAT, baseMessage.getSentAt());
            if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) {
                intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, Extensions.checkProfanityMessage(context, baseMessage));
            } else if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_CUSTOM)) {
                if (((CustomMessage) baseMessage).getCustomData() != null)
                    intent.putExtra(UIKitConstants.IntentStrings.CUSTOM_MESSAGE, ((CustomMessage) baseMessage).getCustomData().toString());
                if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) {
                    intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.LOCATION);
                } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.STICKERS)) {
                    intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.STICKERS);
                } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WHITEBOARD)) {
                    intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.WHITEBOARD);
                    intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, Extensions.getWhiteBoardUrl(baseMessage));
                } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WRITEBOARD)) {
                    intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.WRITEBOARD);
                    intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, Extensions.getWriteBoardUrl(baseMessage));
                } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.GROUP_CALL)) {
                    intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.GROUP_CALL);
                } else {
                    intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.POLLS);
                }
            } else {
                boolean isImageNotSafe = Extensions.getImageModeration(context, baseMessage);
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL, ((MediaMessage) baseMessage).getAttachment().getFileUrl());
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, ((MediaMessage) baseMessage).getAttachment().getFileName());
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, ((MediaMessage) baseMessage).getAttachment().getFileSize());
                intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, ((MediaMessage) baseMessage).getAttachment().getFileExtension());
                intent.putExtra(UIKitConstants.IntentStrings.IMAGE_MODERATION, isImageNotSafe);
            }
            context.startActivity(intent);
        }

        @Override
        public void onReactionClick(Reaction reaction) {
            if (reaction.getName().equals("add_emoji")) {
                CometChatReactionDialog reactionDialog = new CometChatReactionDialog();
                reactionDialog.setOnEmojiClick(new OnReactionClickListener() {

                    @Override
                    public void onEmojiClicked(Reaction emojicon) {
                        sendReaction(emojicon);
                        reactionDialog.dismiss();
                    }
                });
                reactionDialog.show(getFragmentManager(), "ReactionDialog");
            } else {
                sendReaction(reaction);
            }
        }

        @Override
        public void onTranslateMessageClick() {
            try {
                String localeLanguage = Locale.getDefault().getLanguage();
                JSONObject body = new JSONObject();
                JSONArray languages = new JSONArray();
                languages.put(localeLanguage);
                body.put("msgId", baseMessage.getId());
                body.put("languages", languages);
                body.put("text", ((TextMessage) baseMessage).getText());
                CometChat.callExtension("message-translation", "POST", "/v2/translate", body, new CometChat.CallbackListener<JSONObject>() {

                    @Override
                    public void onSuccess(JSONObject jsonObject) {
                        if (Extensions.isMessageTranslated(jsonObject, ((TextMessage) baseMessage).getText())) {
                            if (baseMessage.getMetadata() != null) {
                                JSONObject meta = baseMessage.getMetadata();
                                try {
                                    meta.accumulate("values", jsonObject);
                                    baseMessage.setMetadata(meta);
                                    updateMessage(baseMessage);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                            } else {
                                baseMessage.setMetadata(jsonObject);
                                updateMessage(baseMessage);
                            }
                        } else {
                            CometChatSnackBar.show(context, rvChatListView, context.getString(R.string.no_translation_available), CometChatSnackBar.WARNING);
                        }
                    }

                    @Override
                    public void onError(CometChatException e) {
                        Toast.makeText(context, e.getCode(), Toast.LENGTH_LONG).show();
                    }
                });
            } catch (Exception e) {
                Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
            }
        }

        @Override
        public void onRetryClick() {
            if (baseMessage != null) {
                messageAdapter.remove(baseMessage);
                if (baseMessage.getType().equalsIgnoreCase(CometChatConstants.MESSAGE_TYPE_TEXT))
                    sendMessage(((TextMessage) baseMessage).getText());
            }
        }
    });
}
Also used : OnReactionClickListener(com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.listener.OnReactionClickListener) CometChatException(com.cometchat.pro.exceptions.CometChatException) Action(com.cometchat.pro.models.Action) User(com.cometchat.pro.models.User) MediaMessage(com.cometchat.pro.models.MediaMessage) ArrayList(java.util.ArrayList) CometChatReactionDialog(com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.CometChatReactionDialog) BaseMessage(com.cometchat.pro.models.BaseMessage) FeatureRestriction(com.cometchat.pro.uikit.ui_settings.FeatureRestriction) ClipboardManager(android.content.ClipboardManager) Bundle(android.os.Bundle) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException) Intent(android.content.Intent) Reaction(com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction) CometChatException(com.cometchat.pro.exceptions.CometChatException) JSONException(org.json.JSONException) JSONObject(org.json.JSONObject) CometChatMessageInfoScreenActivity(com.cometchat.pro.uikit.ui_components.messages.message_information.CometChatMessageInfoScreenActivity) CometChatMessageActions(com.cometchat.pro.uikit.ui_components.messages.message_actions.CometChatMessageActions) ClipData(android.content.ClipData) TextMessage(com.cometchat.pro.models.TextMessage)

Aggregations

MediaMessage (com.cometchat.pro.models.MediaMessage)25 Intent (android.content.Intent)16 BaseMessage (com.cometchat.pro.models.BaseMessage)14 JSONException (org.json.JSONException)11 View (android.view.View)10 ImageView (android.widget.ImageView)10 RecyclerView (androidx.recyclerview.widget.RecyclerView)10 CometChatException (com.cometchat.pro.exceptions.CometChatException)10 TextView (android.widget.TextView)9 CardView (androidx.cardview.widget.CardView)9 MaterialCardView (com.google.android.material.card.MaterialCardView)9 JSONObject (org.json.JSONObject)8 Attachment (com.cometchat.pro.models.Attachment)6 FeatureRestriction (com.cometchat.pro.uikit.ui_settings.FeatureRestriction)6 TextMessage (com.cometchat.pro.models.TextMessage)5 AlertDialog (android.app.AlertDialog)3 DialogInterface (android.content.DialogInterface)3 NonNull (androidx.annotation.NonNull)3 Nullable (androidx.annotation.Nullable)3 SimpleTarget (com.bumptech.glide.request.target.SimpleTarget)3