Commit ef6cf99d authored by Lucio Maciel's avatar Lucio Maciel Committed by GitHub

Merge pull request #443 from filipedelimabrito/ux

[IMPROVEMENT] Closes keyboard of the searchView (if opened) when a chat room is visible.
parents 28aeab10 81f32b41
...@@ -128,6 +128,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -128,6 +128,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
private Message edittingMessage = null; private Message edittingMessage = null;
private SlidingPaneLayout pane; private SlidingPaneLayout pane;
private SidebarMainFragment sidebarFragment;
public RoomFragment() {} public RoomFragment() {}
...@@ -333,11 +334,13 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -333,11 +334,13 @@ public class RoomFragment extends AbstractChatRoomFragment implements
private void setupSidebar() { private void setupSidebar() {
SlidingPaneLayout subPane = getActivity().findViewById(R.id.sub_sliding_pane); SlidingPaneLayout subPane = getActivity().findViewById(R.id.sub_sliding_pane);
RoomToolbar toolbar = getActivity().findViewById(R.id.activity_main_toolbar); RoomToolbar toolbar = getActivity().findViewById(R.id.activity_main_toolbar);
sidebarFragment = (SidebarMainFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.sidebar_fragment_container);
pane.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() { pane.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
@Override @Override
public void onPanelSlide(View view, float v) { public void onPanelSlide(View view, float v) {
messageFormManager.enableComposingText(false); messageFormManager.enableComposingText(false);
sidebarFragment.clearSearchViewFocus();
//Ref: ActionBarDrawerToggle#setProgress //Ref: ActionBarDrawerToggle#setProgress
toolbar.setNavigationIconProgress(v); toolbar.setNavigationIconProgress(v);
} }
...@@ -364,11 +367,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -364,11 +367,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
} }
public void closeUserActionContainer() { public void closeUserActionContainer() {
SidebarMainFragment sidebarFragment = (SidebarMainFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.sidebar_fragment_container);
if (sidebarFragment != null) {
sidebarFragment.closeUserActionContainer(); sidebarFragment.closeUserActionContainer();
}
} }
private boolean closeSideMenuIfNeeded() { private boolean closeSideMenuIfNeeded() {
...@@ -652,4 +651,4 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -652,4 +651,4 @@ public class RoomFragment extends AbstractChatRoomFragment implements
edittingMessage = message; edittingMessage = message;
messageFormManager.setEditMessage(message.getMessage()); messageFormManager.setEditMessage(message.getMessage());
} }
} }
\ No newline at end of file
...@@ -258,6 +258,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain ...@@ -258,6 +258,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
}); });
} }
public void clearSearchViewFocus() {
searchView.clearFocus();
}
public void closeUserActionContainer() { public void closeUserActionContainer() {
final CompoundButton toggleUserAction = rootView.findViewById(R.id.toggle_user_action); final CompoundButton toggleUserAction = rootView.findViewById(R.id.toggle_user_action);
if (toggleUserAction != null && toggleUserAction.isChecked()) { if (toggleUserAction != null && toggleUserAction.isChecked()) {
......
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