use of com.yellowmessenger.sdk.models.db.ChatMessage in project yellowmessenger-sdk by yellowmessenger.
the class RecyclerChatActivity method sendImageMessage.
public void sendImageMessage(Bitmap bm, String filename) {
String message = "";
ChatMessage chatMessage = new ChatMessage(username, message, name, true);
chatMessage.setBitmap(bm);
addMessage(chatMessage);
EventBus.getDefault().post(new UploadStartEvent(chatMessage, filename));
}
use of com.yellowmessenger.sdk.models.db.ChatMessage in project yellowmessenger-sdk by yellowmessenger.
the class RecyclerChatActivity method sendMessage.
public void sendMessage(View view) {
String message = editText.getText().toString();
if (!message.trim().equals("")) {
ChatMessage chatMessage = new ChatMessage(username, message, name, true);
EventBus.getDefault().post(new SendMessageEvent(chatMessage));
addMessage(chatMessage);
editText.setText("");
optionsLayout.removeAllViews();
}
}
use of com.yellowmessenger.sdk.models.db.ChatMessage in project yellowmessenger-sdk by yellowmessenger.
the class RecyclerChatActivity method sendOption.
public void sendOption(final Question question, final Option option) {
if (option.isLocation()) {
askForLocation();
} else {
optionsLayout.setVisibility(View.GONE);
optionsLayout.removeAllViews();
ChatMessage chatMessage = new ChatMessage(username, option.getLabel(), name, true);
chatMessage.setMessageValue(option.getValue());
EventBus.getDefault().post(new SendMessageEvent(chatMessage));
addMessage(chatMessage);
}
}
use of com.yellowmessenger.sdk.models.db.ChatMessage in project yellowmessenger-sdk by yellowmessenger.
the class XMPPService method onEvent.
@Subscribe
public void onEvent(UploadStartEvent event) {
ChatMessage chatMessage = event.getChatMessage();
uploadMap.put(event.getUploadId(), chatMessage);
}
use of com.yellowmessenger.sdk.models.db.ChatMessage in project yellowmessenger-sdk by yellowmessenger.
the class XMPPService method sendUnsentMessages.
public void sendUnsentMessages() {
try {
List<ChatMessage> unsentMessages = ChatMessageDAO.getUnsentMessages();
for (ChatMessage chatMessage : unsentMessages) {
Message msg = new Message(JidCreate.from(chatMessage.getUsername(), DOMAIN, ""), Message.Type.chat);
if (chatMessage.getMessageValue() != null) {
msg.setBody(chatMessage.getMessageValue());
} else {
msg.setBody(chatMessage.getMessage());
}
mConnection.sendStanza(msg);
chatMessage.setUnsent(false);
chatMessage.setStanzaId(msg.getStanzaId());
chatMessage.save();
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations