use of com.applozic.mobicomkit.listners.MediaUploadProgressHandler in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationService method sendMessageWithHandler.
public void sendMessageWithHandler(Message message, final MediaUploadProgressHandler progressHandler) {
if (message == null) {
return;
}
if (!message.hasAttachment()) {
ApplozicException exception = new ApplozicException("Message does not have any attachment.");
if (progressHandler != null) {
progressHandler.onUploadStarted(exception, null);
progressHandler.onProgressUpdate(0, exception, null);
progressHandler.onCancelled(exception, null);
}
}
Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(android.os.Message message) {
handleState(message, progressHandler);
return true;
}
});
MessageWorker.enqueueWork(context, message, null, handler);
}
use of com.applozic.mobicomkit.listners.MediaUploadProgressHandler in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationService method sendMessage.
public void sendMessage(Message message, final MediaUploadProgressHandler progressHandler, Class messageIntentClass) {
Intent intent = new Intent(context, messageIntentClass);
intent.putExtra(MobiComKitConstants.MESSAGE_JSON_INTENT, GsonUtils.getJsonFromObject(message, Message.class));
Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(android.os.Message message) {
handleState(message, progressHandler);
return true;
}
});
MessageIntentService.enqueueWork(context, intent, handler);
}
use of com.applozic.mobicomkit.listners.MediaUploadProgressHandler in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method sendOpenGroupMessage.
public void sendOpenGroupMessage(String messageText) {
attachReplyCancelLayout.setVisibility(View.GONE);
replayRelativeLayout.setVisibility(View.GONE);
attachmentLayout.setVisibility(View.GONE);
Map<String, String> messageMetaData = new HashMap<>();
if (this.messageMetaData != null && !this.messageMetaData.isEmpty()) {
messageMetaData.putAll(this.messageMetaData);
}
MessageBuilder messageBuilder = new MessageBuilder(getActivity()).setMessage(messageText).setMetadata(messageMetaData).setGroupId(channel.getKey());
if (!TextUtils.isEmpty(filePath)) {
messageBuilder.setContentType(Message.ContentType.ATTACHMENT.getValue());
messageBuilder.setFilePath(filePath);
filePath = null;
}
messageBuilder.send(new MediaUploadProgressHandler() {
@Override
public void onUploadStarted(ApplozicException e, String oldMessageKey) {
}
@Override
public void onProgressUpdate(int percentage, ApplozicException e, String oldMessageKey) {
}
@Override
public void onCancelled(ApplozicException e, String oldMessageKey) {
}
@Override
public void onCompleted(ApplozicException e, String oldMessageKey) {
}
@Override
public void onSent(Message message, String oldMessageKey) {
Message messageToBeReplied = new Message();
messageToBeReplied.setKeyString(oldMessageKey);
int indexOfObject = messageList.indexOf(messageToBeReplied);
if (indexOfObject != -1) {
messageList.set(indexOfObject, message);
recyclerDetailConversationAdapter.notifyItemChanged(indexOfObject);
}
}
});
this.messageMetaData = null;
}
Aggregations