Commit 0c4e45a6 authored by Jonas L.'s avatar Jonas L.

Add closing the menu by the back button

parent ffc85be9
......@@ -116,4 +116,12 @@ class MainActivity: AppCompatActivity() {
.replace(R.id.container, fragment)
.commit()
}
override fun onBackPressed() {
if (drawer.isDrawerOpen) {
drawer.closeDrawer()
} else {
super.onBackPressed()
}
}
}
......@@ -185,7 +185,9 @@ class ViewerActivity : AppCompatActivity(), StackAdapterHandler, ViewPager.OnPag
override fun onBackPressed() {
val status = model.getStatus().value
if (status is ViewerStatusRunning && status.stack.currentElementIndex > 0) {
if (drawer.isDrawerOpen) {
drawer.closeDrawer()
} else if (status is ViewerStatusRunning && status.stack.currentElementIndex > 0) {
// go one step back
model.openPage(status.stack.currentElementIndex - 1)
} else {
......
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