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