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

Update RoomFragment.java

parent 7cfd024b
...@@ -11,7 +11,6 @@ import android.support.design.widget.Snackbar; ...@@ -11,7 +11,6 @@ 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.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;
...@@ -28,10 +27,11 @@ import java.util.List; ...@@ -28,10 +27,11 @@ import java.util.List;
import chat.rocket.android.BackgroundLooper; import chat.rocket.android.BackgroundLooper;
import chat.rocket.android.R; import chat.rocket.android.R;
import chat.rocket.android.activity.MainActivity;
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.chatroom.list.RoomListFragment;
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;
...@@ -319,16 +319,16 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -319,16 +319,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:
showRoomDialogFragment(R.id.action_pinned_messages); showRoomListFragment(R.id.action_pinned_messages);
break; break;
case R.id.action_favorite_messages: case R.id.action_favorite_messages:
showRoomDialogFragment(R.id.action_favorite_messages); showRoomListFragment(R.id.action_favorite_messages);
break; break;
case R.id.action_file_list: case R.id.action_file_list:
showRoomDialogFragment(R.id.action_file_list); showRoomListFragment(R.id.action_file_list);
break; break;
case R.id.action_member_list: case R.id.action_member_list:
showRoomDialogFragment(R.id.action_member_list); showRoomListFragment(R.id.action_member_list);
break; break;
default: default:
return super.onOptionsItemSelected(menuItem); return super.onOptionsItemSelected(menuItem);
...@@ -490,7 +490,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -490,7 +490,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
edittingMessage = null; edittingMessage = null;
messageFormManager.clearComposingText(); messageFormManager.clearComposingText();
} }
return true; return false;
} }
@Override @Override
...@@ -647,20 +647,18 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -647,20 +647,18 @@ public class RoomFragment extends AbstractChatRoomFragment implements
messageFormManager.setEditMessage(message.getMessage()); messageFormManager.setEditMessage(message.getMessage());
} }
private void showRoomDialogFragment(int actionId) { private void showRoomListFragment(int actionId) {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); RoomListFragment roomListFragment = RoomListFragment.Companion.newInstance(actionId,
Fragment prev = getFragmentManager().findFragmentByTag("roomDialogFragment"); roomId,
if (prev != null) { roomType,
fragmentTransaction.remove(prev); hostname,
} token,
fragmentTransaction.addToBackStack(null); userId);
DialogFragment roomDialogFragment = RoomDialogFragment.Companion.newInstance(roomId, MainActivity activity = ((MainActivity)getActivity());
roomType, FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
hostname, ft.replace(activity.getLayoutContainerForFragment(), roomListFragment, "roomListFragment");
token, ft.addToBackStack(null);
userId, ft.commit();
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