Commit b2b81a0f authored by Leonardo Aramaki's avatar Leonardo Aramaki

Close status panel when hiding sidebar

parent 624934ec
...@@ -3,6 +3,7 @@ package chat.rocket.android.activity; ...@@ -3,6 +3,7 @@ package chat.rocket.android.activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SlidingPaneLayout; import android.support.v4.widget.SlidingPaneLayout;
import android.support.v7.graphics.drawable.DrawerArrowDrawable; import android.support.v7.graphics.drawable.DrawerArrowDrawable;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
...@@ -107,6 +108,7 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract ...@@ -107,6 +108,7 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
@Override @Override
public void onPanelClosed(View panel) { public void onPanelClosed(View panel) {
drawerArrowDrawable.setVerticalMirror(false); drawerArrowDrawable.setVerticalMirror(false);
closeUserActionContainer();
} }
}); });
} }
...@@ -161,6 +163,14 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract ...@@ -161,6 +163,14 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
.commit(); .commit();
} }
private void closeUserActionContainer() {
SidebarMainFragment sidebarFragment = (SidebarMainFragment) getSupportFragmentManager()
.findFragmentById(R.id.sidebar_fragment_container);
if (sidebarFragment != null) {
sidebarFragment.closeUserActionContainer();
}
}
@Override @Override
protected void onRoomIdUpdated() { protected void onRoomIdUpdated() {
super.onRoomIdUpdated(); super.onRoomIdUpdated();
......
...@@ -166,12 +166,16 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain ...@@ -166,12 +166,16 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
RxCompoundButton.checkedChanges(toggleUserAction) RxCompoundButton.checkedChanges(toggleUserAction)
.compose(bindToLifecycle()) .compose(bindToLifecycle())
.subscribe( .subscribe(
aBoolean -> rootView.findViewById(R.id.user_action_outer_container) this::showUserActionContainer,
.setVisibility(aBoolean ? View.VISIBLE : View.GONE),
Logger::report Logger::report
); );
} }
private void showUserActionContainer(boolean show) {
rootView.findViewById(R.id.user_action_outer_container)
.setVisibility(show ? View.VISIBLE : View.GONE);
}
@Override @Override
public void showScreen() { public void showScreen() {
rootView.setVisibility(View.VISIBLE); rootView.setVisibility(View.VISIBLE);
...@@ -256,7 +260,7 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain ...@@ -256,7 +260,7 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
}); });
} }
private 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()) {
toggleUserAction.setChecked(false); toggleUserAction.setChecked(false);
......
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