X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FMainWebViewActivity.java;h=4180e28c31f5c2c574f8dfa7b529194b41fcb9c9;hp=326a85706dc38df91e8941c6cebaedebd93e1d40;hb=d83bd21f11673e7a2332805918885d431ce1938f;hpb=5702947e2275caf08ec6683de117d19e924f0492 diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 326a8570..4180e28c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -4854,16 +4854,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } private void closeCurrentTab() { - // Pause the current WebView. This prevents buffered audio from playing after the tab is closed. - currentWebView.onPause(); - // Get the current tab number. int currentTabNumber = tabLayout.getSelectedTabPosition(); // Delete the current tab. tabLayout.removeTabAt(currentTabNumber); - // Delete the current page. If the selected page number did not change during the delete, it will return true, meaning that the current WebView must be reset. + // Delete the current page. If the selected page number did not change during the delete (because the newly selected tab has has same number as the previously deleted tab), it will return true, + // meaning that the current WebView must be reset. Otherwise it will happen automatically as the selected tab number changes. if (webViewPagerAdapter.deletePage(currentTabNumber, webViewPager)) { setCurrentWebView(currentTabNumber); } @@ -5022,13 +5020,13 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Get the WebView tab fragment. WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(i); - // Get the fragment view. - View fragmentView = webViewTabFragment.getView(); + // Get the WebView fragment view. + View webViewFragmentView = webViewTabFragment.getView(); // Only clear the cache if the WebView exists. - if (fragmentView != null) { + if (webViewFragmentView != null) { // Get the nested scroll WebView from the tab fragment. - NestedScrollWebView nestedScrollWebView = fragmentView.findViewById(R.id.nestedscroll_webview); + NestedScrollWebView nestedScrollWebView = webViewFragmentView.findViewById(R.id.nestedscroll_webview); // Clear the cache for this WebView. nestedScrollWebView.clearCache(true);