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=6eeeb253b25a1492d0b689133b7220167886bd1a;hp=4180e28c31f5c2c574f8dfa7b529194b41fcb9c9;hb=044e469923b042c6f019083166d8a543aa5edee3;hpb=d83bd21f11673e7a2332805918885d431ce1938f 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 4180e28c..6eeeb253 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -3595,6 +3595,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public void onDrawerClosed(@NonNull View drawerView) { + // Reset the drawer icon when the drawer is closed. Otherwise, it is an arrow if the drawer is open when the app is restarted. + actionBarDrawerToggle.syncState(); } @Override @@ -4824,6 +4826,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } private void addNewTab(String url, boolean moveToTab) { + // Clear the focus from the URL edit text, so that it will be populated with the information from the new tab. + urlEditText.clearFocus(); + // Get the new page number. The page numbers are 0 indexed, so the new page number will match the current count. int newTabNumber = tabLayout.getTabCount(); @@ -4865,9 +4870,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook if (webViewPagerAdapter.deletePage(currentTabNumber, webViewPager)) { setCurrentWebView(currentTabNumber); } - - // Expand the app bar if it is currently collapsed. - appBarLayout.setExpanded(true); } private void saveWebpageArchive(String filePath) { @@ -5055,13 +5057,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 frame layout. + FrameLayout webViewFrameLayout = (FrameLayout) webViewTabFragment.getView(); // Only wipe out the WebView if it exists. - if (fragmentView != null) { + if (webViewFrameLayout != null) { // Get the nested scroll WebView from the tab fragment. - NestedScrollWebView nestedScrollWebView = fragmentView.findViewById(R.id.nestedscroll_webview); + NestedScrollWebView nestedScrollWebView = webViewFrameLayout.findViewById(R.id.nestedscroll_webview); // Clear SSL certificate preferences for this WebView. nestedScrollWebView.clearSslPreferences(); @@ -5069,6 +5071,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Clear the back/forward history for this WebView. nestedScrollWebView.clearHistory(); + // Remove all the views from the frame layout. + webViewFrameLayout.removeAllViews(); + // Destroy the internal state of the WebView. nestedScrollWebView.destroy(); }