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