From: Soren Stoutner Date: Thu, 19 Oct 2023 16:21:33 +0000 (-0700) Subject: Always close the drawers when opening a new intent. https://redmine.stoutner.com... X-Git-Tag: v3.16~12 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=a9d00f526a6fc67f97d479188fae66dd7f0a6dde;p=PrivacyBrowserAndroid.git Always close the drawers when opening a new intent. https://redmine.stoutner.com/issues/1036 --- 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.