Commit f791fce4 authored by laggedHero's avatar laggedHero Committed by GitHub

Merge pull request #51 from RocketChat/fix_50

FIX #50 fix the behavior of back-press on SlidingPane is opened.
parents 6c21d19c ceb4d34f
...@@ -49,12 +49,14 @@ public class MainActivity extends AbstractAuthedActivity { ...@@ -49,12 +49,14 @@ public class MainActivity extends AbstractAuthedActivity {
} }
} }
private void closeSidebarIfNeeded() { private boolean closeSidebarIfNeeded() {
// REMARK: Tablet UI doesn't have SlidingPane! // REMARK: Tablet UI doesn't have SlidingPane!
SlidingPaneLayout pane = (SlidingPaneLayout) findViewById(R.id.sliding_pane); SlidingPaneLayout pane = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
if (pane != null) { if (pane != null && pane.isOpen()) {
pane.closePane(); pane.closePane();
return true;
} }
return false;
} }
@DebugLog @DebugLog
...@@ -105,5 +107,7 @@ public class MainActivity extends AbstractAuthedActivity { ...@@ -105,5 +107,7 @@ public class MainActivity extends AbstractAuthedActivity {
} }
} }
@Override protected boolean onBackPress() {
return closeSidebarIfNeeded() || super.onBackPress();
}
} }
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