Commit f45625b3 authored by Tiago Cunha's avatar Tiago Cunha

Fixes

parent 8f037814
...@@ -27,6 +27,7 @@ import java.lang.reflect.Field; ...@@ -27,6 +27,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import bolts.Task;
import chat.rocket.android.R; import chat.rocket.android.R;
import chat.rocket.android.api.MethodCallHelper; import chat.rocket.android.api.MethodCallHelper;
import chat.rocket.android.fragment.chatroom.dialog.FileUploadProgressDialogFragment; import chat.rocket.android.fragment.chatroom.dialog.FileUploadProgressDialogFragment;
...@@ -322,10 +323,7 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -322,10 +323,7 @@ public class RoomFragment extends AbstractChatRoomFragment
(MessageFormLayout) rootView.findViewById(R.id.message_composer); (MessageFormLayout) rootView.findViewById(R.id.message_composer);
messageFormManager = messageFormManager =
new MessageFormManager(messageFormLayout, this::showExtraActionSelectionDialog); new MessageFormManager(messageFormLayout, this::showExtraActionSelectionDialog);
messageFormManager.setSendMessageCallback(messageText -> { messageFormManager.setSendMessageCallback(this::sendMessage);
sendMessage(messageText);
return null;
});
messageFormLayout.setEditTextContentListener(this::onCommitContent); messageFormLayout.setEditTextContentListener(this::onCommitContent);
} }
...@@ -529,8 +527,8 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -529,8 +527,8 @@ public class RoomFragment extends AbstractChatRoomFragment
return true; return true;
} }
private void sendMessage(String messageText) { private Task<Void> sendMessage(String messageText) {
realmHelper.executeTransaction(realm -> return realmHelper.executeTransaction(realm ->
realm.createOrUpdateObjectFromJson(Message.class, new JSONObject() realm.createOrUpdateObjectFromJson(Message.class, new JSONObject()
.put(Message.ID, UUID.randomUUID().toString()) .put(Message.ID, UUID.randomUUID().toString())
.put(Message.SYNC_STATE, SyncState.NOT_SYNCED) .put(Message.SYNC_STATE, SyncState.NOT_SYNCED)
......
...@@ -139,8 +139,14 @@ public class MessageFormLayout extends LinearLayout { ...@@ -139,8 +139,14 @@ public class MessageFormLayout extends LinearLayout {
return getEditor().getText().toString().trim(); return getEditor().getText().toString().trim();
} }
public final void setText(CharSequence text) { public final void setText(final CharSequence text) {
getEditor().setText(text); final TextView editor = getEditor();
editor.post(new Runnable() {
@Override
public void run() {
editor.setText(text);
}
});
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
......
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