X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FMainWebViewActivity.kt;h=ccaa58fae7121f6afec1d4c23b964424b0d25d4a;hp=c6d91350ea3a2116eca251efa663e3bbd276749f;hb=8a7255a5e91e2fc907c6d133db99d805ee2f20de;hpb=f54dc14f2a76e7d45964abb22f19785744fce2e9 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 c6d91350..ccaa58fa 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -4191,10 +4191,12 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Set the current WebView. setCurrentWebView(position) - // Select the corresponding tab if it does not match the currently selected page. This will happen if the page was scrolled by creating a new tab. - if (tabLayout.selectedTabPosition != position) { - // Wait until the new tab has been created. - tabLayout.post { + // Wait until the new tab has been created. + tabLayout.post { + // Select the corresponding tab if it does not match the currently selected page. This will happen if the page was scrolled by creating a new tab. + // The checking of the position was moved inside the post block to prevent a race condition that caused the tab to be selected twice and the encryption dialog to be displayed. + // + if (tabLayout.selectedTabPosition != position) { // Get a handle for the tab. val tab = tabLayout.getTabAt(position)!!