Commit baa0ddaf authored by Yusuke Iwaki's avatar Yusuke Iwaki

just rename MessageComposer -> MessageFormLayout, MessageComposerManager -> MessageFormManager.

parent 4563ff68
......@@ -29,7 +29,7 @@ import chat.rocket.android.helper.LoadMoreScrollListener;
import chat.rocket.android.helper.LogcatIfError;
import chat.rocket.android.helper.OnBackPressListener;
import chat.rocket.android.helper.TextUtils;
import chat.rocket.android.layouthelper.chatroom.MessageComposerManager;
import chat.rocket.android.layouthelper.chatroom.MessageFormManager;
import chat.rocket.android.layouthelper.chatroom.MessageListAdapter;
import chat.rocket.android.layouthelper.chatroom.PairedMessage;
import chat.rocket.android.log.RCLog;
......@@ -50,7 +50,7 @@ import chat.rocket.android.realm_helper.RealmModelListAdapter;
import chat.rocket.android.realm_helper.RealmObjectObserver;
import chat.rocket.android.realm_helper.RealmStore;
import chat.rocket.android.service.RocketChatService;
import chat.rocket.android.widget.message.MessageComposer;
import chat.rocket.android.widget.message.MessageFormLayout;
import permissions.dispatcher.NeedsPermission;
import permissions.dispatcher.RuntimePermissions;
......@@ -70,7 +70,7 @@ public class RoomFragment extends AbstractChatRoomFragment
private String token;
private LoadMoreScrollListener scrollListener;
private RealmObjectObserver<LoadMessageProcedure> procedureObserver;
private MessageComposerManager messageComposerManager;
private MessageFormManager messageComposerManager;
private MessageSelectionDialogFragment.ClickListener messageSelectionClickListener =
messageSpec -> RoomFragmentPermissionsDispatcher
......@@ -224,9 +224,9 @@ public class RoomFragment extends AbstractChatRoomFragment
}
private void setupMessageComposer() {
final MessageComposer messageComposer =
(MessageComposer) rootView.findViewById(R.id.message_composer);
messageComposerManager = new MessageComposerManager(messageComposer);
final MessageFormLayout messageFormLayout =
(MessageFormLayout) rootView.findViewById(R.id.message_composer);
messageComposerManager = new MessageFormManager(messageFormLayout);
messageComposerManager.setSendMessageCallback(messageText ->
realmHelper.executeTransaction(realm ->
realm.createOrUpdateObjectFromJson(Message.class, new JSONObject()
......
package chat.rocket.android.layouthelper.chatroom;
import bolts.Task;
import chat.rocket.android.widget.message.MessageComposer;
import chat.rocket.android.widget.message.MessageFormLayout;
/**
* handling visibility of FAB-compose and MessageComposer.
* handling MessageForm.
*/
public class MessageComposerManager {
private final MessageComposer messageComposer;
public class MessageFormManager {
private final MessageFormLayout messageFormLayout;
private SendMessageCallback sendMessageCallback;
private ExtrasPickerListener extrasPickerListener;
public MessageComposerManager(MessageComposer messageComposer) {
this.messageComposer = messageComposer;
public MessageFormManager(MessageFormLayout messageFormLayout) {
this.messageFormLayout = messageFormLayout;
init();
}
private void init() {
messageComposer.setOnActionListener(new MessageComposer.ActionListener() {
messageFormLayout.setOnActionListener(new MessageFormLayout.ActionListener() {
@Override
public void onSubmit(String message) {
sendMessage(message);
......@@ -43,7 +43,7 @@ public class MessageComposerManager {
}
public void clearComposingText() {
messageComposer.setText("");
messageFormLayout.setText("");
}
private void sendMessage(String message) {
......@@ -51,12 +51,12 @@ public class MessageComposerManager {
return;
}
messageComposer.setEnabled(false);
messageFormLayout.setEnabled(false);
sendMessageCallback.onSubmit(message).onSuccess(task -> {
clearComposingText();
return null;
}).continueWith(task -> {
messageComposer.setEnabled(true);
messageFormLayout.setEnabled(true);
return null;
});
}
......
......@@ -9,7 +9,7 @@
android:layout_height="match_parent"
android:layout_above="@+id/message_composer" />
<chat.rocket.android.widget.message.MessageComposer
<chat.rocket.android.widget.message.MessageFormLayout
android:id="@+id/message_composer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -11,14 +11,13 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import chat.rocket.android.widget.R;
public class MessageComposer extends LinearLayout {
public class MessageFormLayout extends LinearLayout {
protected ActionListener actionListener;
protected ViewGroup composer;
......@@ -26,23 +25,23 @@ public class MessageComposer extends LinearLayout {
private View btnExtra;
private View btnSubmit;
public MessageComposer(Context context) {
public MessageFormLayout(Context context) {
super(context);
init();
}
public MessageComposer(Context context, AttributeSet attrs) {
public MessageFormLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MessageComposer(Context context, AttributeSet attrs, int defStyleAttr) {
public MessageFormLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public MessageComposer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
public MessageFormLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
......
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