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=38fae2ed2702872414432600b6e744418a2c6e9d;hp=16dfcaaf3e20164e325af872dfa4864d99d24772;hb=1d656c562831f535aa33903d44198dd890393f4f;hpb=6ea3e4ebd779594b45ad8f51cc40761bb6d89030 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 16dfcaaf..38fae2ed 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -454,10 +454,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook tabLayout = findViewById(R.id.tablayout); swipeRefreshLayout = findViewById(R.id.swiperefreshlayout); webViewPager = findViewById(R.id.webviewpager); - fullScreenVideoFrameLayout = findViewById(R.id.full_screen_video_framelayout); - - // Get a handle for the navigation view. NavigationView navigationView = findViewById(R.id.navigationview); + fullScreenVideoFrameLayout = findViewById(R.id.full_screen_video_framelayout); // Get a handle for the navigation menu. Menu navigationMenu = navigationView.getMenu(); @@ -3561,9 +3559,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook inputMethodManager.hideSoftInputFromWindow(currentWebView.getWindowToken(), 0); } - // Clear the focus from from the URL text box and the WebView. This removes any text selection markers and context menus, which otherwise draw above the open drawers. + // Clear the focus from from the URL text box. This removes any text selection markers and context menus, which otherwise draw above the open drawers. urlEditText.clearFocus(); - currentWebView.clearFocus(); + + // Clear the focus from from the WebView if it is not null, which can happen if a user opens a drawer while the browser is being resumed. + if (currentWebView != null) { + // Clearing the focus from the WebView removes any text selection markers and context menus, which otherwise draw above the open drawers. + currentWebView.clearFocus(); + } } } });