From a9d00f526a6fc67f97d479188fae66dd7f0a6dde Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Thu, 19 Oct 2023 09:21:33 -0700 Subject: [PATCH] Always close the drawers when opening a new intent. https://redmine.stoutner.com/issues/1036 --- .../activities/MainWebViewActivity.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index 27a3d462..2c7560d6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -726,6 +726,14 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Run the default commands. super.onNewIntent(intent) + // Close the navigation drawer if it is open. + if (drawerLayout.isDrawerVisible(GravityCompat.START)) + drawerLayout.closeDrawer(GravityCompat.START) + + // Close the bookmarks drawer if it is open. + if (drawerLayout.isDrawerVisible(GravityCompat.END)) + drawerLayout.closeDrawer(GravityCompat.END) + // Get the information from the intent. val intentAction = intent.action val intentUriData = intent.data @@ -773,14 +781,6 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Make it so. loadUrl(currentWebView!!, url!!) } - - // Close the navigation drawer if it is open. - if (drawerLayout.isDrawerVisible(GravityCompat.START)) - drawerLayout.closeDrawer(GravityCompat.START) - - // Close the bookmarks drawer if it is open. - if (drawerLayout.isDrawerVisible(GravityCompat.END)) - drawerLayout.closeDrawer(GravityCompat.END) } } else { // The app has been restarted. // If the new intent will open a new tab, set the saved tab position to be the size of the saved state array list. -- 2.45.2