From ec87e4359b5de9fbc62fd4bc26b919c5e061c3d4 Mon Sep 17 00:00:00 2001 From: Krishna Shukla Date: Fri, 23 Dec 2016 20:26:10 +0530 Subject: [PATCH] Drawerfix/readme update (#601) * Fixed back button on navigational drawers * Removing an unused import * Cleaned up code * little clean up --- .../main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 062df386f..bd2371111 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -93,7 +93,9 @@ class MainActivity : BaseActivity() { override fun onBackPressed() { val fragment = supportFragmentManager.findFragmentById(R.id.frame_container) - if (fragment != null && fragment.tag.toInt() != startScreenId) { + if (drawer.isDrawerOpen(GravityCompat.START) || drawer.isDrawerOpen(GravityCompat.END)) { + drawer.closeDrawers() + } else if (fragment != null && fragment.tag.toInt() != startScreenId) { if (resumed) { setSelectedDrawerItem(startScreenId) } @@ -140,4 +142,4 @@ class MainActivity : BaseActivity() { companion object { private const val REQUEST_OPEN_SETTINGS = 200 } -} \ No newline at end of file +}