Commit b378cf2f authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update MessageFormManager.java

parent 73dbba85
...@@ -3,14 +3,13 @@ package chat.rocket.android.layouthelper.chatroom; ...@@ -3,14 +3,13 @@ package chat.rocket.android.layouthelper.chatroom;
import chat.rocket.android.widget.message.MessageFormLayout; import chat.rocket.android.widget.message.MessageFormLayout;
/** /**
* handling MessageForm. * Handles MessageForm.
*/ */
public class MessageFormManager { public class MessageFormManager {
private final MessageFormLayout messageFormLayout; private final MessageFormLayout messageFormLayout;
private SendMessageCallback sendMessageCallback; private SendMessageCallback sendMessageCallback;
public MessageFormManager(MessageFormLayout messageFormLayout, public MessageFormManager(MessageFormLayout messageFormLayout, MessageFormLayout.ExtraActionSelectionClickListener callback) {
MessageFormLayout.ExtraActionSelectionClickListener callback) {
this.messageFormLayout = messageFormLayout; this.messageFormLayout = messageFormLayout;
init(callback); init(callback);
} }
...@@ -24,13 +23,8 @@ public class MessageFormManager { ...@@ -24,13 +23,8 @@ public class MessageFormManager {
this.sendMessageCallback = sendMessageCallback; this.sendMessageCallback = sendMessageCallback;
} }
public void clearComposingText() {
messageFormLayout.setText("");
}
public void onMessageSend() { public void onMessageSend() {
clearComposingText(); clearComposingText();
messageFormLayout.setEnabled(true);
} }
public void setEditMessage(String message) { public void setEditMessage(String message) {
...@@ -38,16 +32,18 @@ public class MessageFormManager { ...@@ -38,16 +32,18 @@ public class MessageFormManager {
messageFormLayout.setText(message); messageFormLayout.setText(message);
} }
public void clearComposingText() {
messageFormLayout.setText("");
}
private void sendMessage(String message) { private void sendMessage(String message) {
if (sendMessageCallback == null) { if (sendMessageCallback == null) {
return; return;
} }
messageFormLayout.setEnabled(false);
sendMessageCallback.onSubmitText(message); sendMessageCallback.onSubmitText(message);
} }
public interface SendMessageCallback { public interface SendMessageCallback {
void onSubmitText(String messageText); void onSubmitText(String messageText);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment