Commit 8b83d03d authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update RoomFragment.java

parent 95336773
...@@ -11,6 +11,8 @@ import android.support.design.widget.Snackbar; ...@@ -11,6 +11,8 @@ import android.support.design.widget.Snackbar;
import android.support.v13.view.inputmethod.InputConnectionCompat; import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v13.view.inputmethod.InputContentInfoCompat; import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.os.BuildCompat; import android.support.v4.os.BuildCompat;
import android.support.v4.util.Pair; import android.support.v4.util.Pair;
import android.support.v4.widget.SlidingPaneLayout; import android.support.v4.widget.SlidingPaneLayout;
...@@ -29,6 +31,7 @@ import chat.rocket.android.R; ...@@ -29,6 +31,7 @@ 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;
import chat.rocket.android.fragment.chatroom.dialog.MessageOptionsDialogFragment; import chat.rocket.android.fragment.chatroom.dialog.MessageOptionsDialogFragment;
import chat.rocket.android.fragment.chatroom.dialog.RoomDialogFragment;
import chat.rocket.android.fragment.sidebar.SidebarMainFragment; import chat.rocket.android.fragment.sidebar.SidebarMainFragment;
import chat.rocket.android.helper.AbsoluteUrlHelper; import chat.rocket.android.helper.AbsoluteUrlHelper;
import chat.rocket.android.helper.FileUploadHelper; import chat.rocket.android.helper.FileUploadHelper;
...@@ -96,7 +99,11 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -96,7 +99,11 @@ public class RoomFragment extends AbstractChatRoomFragment implements
private static final String ROOM_ID = "roomId"; private static final String ROOM_ID = "roomId";
private String hostname; private String hostname;
private String token;
private String userId;
private String roomId; private String roomId;
private String roomName;
private String roomType;
private LoadMoreScrollListener scrollListener; private LoadMoreScrollListener scrollListener;
private MessageFormManager messageFormManager; private MessageFormManager messageFormManager;
private RecyclerView messageRecyclerView; private RecyclerView messageRecyclerView;
...@@ -313,16 +320,16 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -313,16 +320,16 @@ public class RoomFragment extends AbstractChatRoomFragment implements
toolbar.setOnMenuItemClickListener(menuItem -> { toolbar.setOnMenuItemClickListener(menuItem -> {
switch (menuItem.getItemId()) { switch (menuItem.getItemId()) {
case R.id.action_pinned_messages: case R.id.action_pinned_messages:
// TODO showRoomDialogFragment(R.id.action_pinned_messages);
break; break;
case R.id.action_favorite_messages: case R.id.action_favorite_messages:
// TODO showRoomDialogFragment(R.id.action_favorite_messages);
break; break;
case R.id.action_file_list: case R.id.action_file_list:
// TODO showRoomDialogFragment(R.id.action_file_list);
break; break;
case R.id.action_member_list: case R.id.action_member_list:
// TODO showRoomDialogFragment(R.id.action_member_list);
break; break;
default: default:
return super.onOptionsItemSelected(menuItem); return super.onOptionsItemSelected(menuItem);
...@@ -547,12 +554,16 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -547,12 +554,16 @@ public class RoomFragment extends AbstractChatRoomFragment implements
@Override @Override
public void setupWith(RocketChatAbsoluteUrl rocketChatAbsoluteUrl) { public void setupWith(RocketChatAbsoluteUrl rocketChatAbsoluteUrl) {
token = rocketChatAbsoluteUrl.getToken();
userId = rocketChatAbsoluteUrl.getUserId();
messageListAdapter.setAbsoluteUrl(rocketChatAbsoluteUrl); messageListAdapter.setAbsoluteUrl(rocketChatAbsoluteUrl);
} }
@Override @Override
public void render(Room room) { public void render(Room room) {
setToolbarTitle(room.getName()); roomName = room.getName();
roomType = room.getType();
setToolbarTitle(roomName);
boolean unreadMessageExists = room.isAlert(); boolean unreadMessageExists = room.isAlert();
if (newMessageIndicatorManager != null && previousUnreadMessageExists && !unreadMessageExists) { if (newMessageIndicatorManager != null && previousUnreadMessageExists && !unreadMessageExists) {
...@@ -637,4 +648,20 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -637,4 +648,20 @@ public class RoomFragment extends AbstractChatRoomFragment implements
edittingMessage = message; edittingMessage = message;
messageFormManager.setEditMessage(message.getMessage()); messageFormManager.setEditMessage(message.getMessage());
} }
private void showRoomDialogFragment(int actionId) {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
Fragment prev = getFragmentManager().findFragmentByTag("roomDialogFragment");
if (prev != null) {
fragmentTransaction.remove(prev);
}
fragmentTransaction.addToBackStack(null);
DialogFragment roomDialogFragment = RoomDialogFragment.Companion.newInstance(roomId, roomName, roomType,
hostname,
token,
userId,
actionId);
roomDialogFragment.show(fragmentTransaction, "roomDialogFragment");
}
} }
\ 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