]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
Hide the keyboard when the options menu is displayed.
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / MainWebViewActivity.java
index 365ca4a96ff8e83200900b9cb7b5a21d7df70dc1..4200fb5e1efc74c0b5f76566cd06ab8f7c0b8681 100644 (file)
@@ -340,7 +340,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
                     highlightUrlText();
 
                     // Scroll to the beginning of the text.
-                    urlTextBox.scrollTo(0, 0);
+                    urlTextBox.setScrollX(0);
                 }
             }
         });
@@ -593,7 +593,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
                     navigationForwardMenuItem.setEnabled(mainWebView.canGoForward());
                     navigationHistoryMenuItem.setEnabled((mainWebView.canGoBack() || mainWebView.canGoForward()));
 
-                    // Hide the keyboard so we can see the navigation menu.  `0` indicates no additional flags.
+                    // Hide the keyboard (if displayed) so we can see the navigation menu.  `0` indicates no additional flags.
                     inputMethodManager.hideSoftInputFromWindow(mainWebView.getWindowToken(), 0);
 
                     // Clear the focus from `urlTextBox` if it has it.
@@ -1082,6 +1082,9 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
 
     @Override
     public boolean onPrepareOptionsMenu(Menu menu) {
+        // Hide the keyboard (if displayed) so we can see the options menu.  `0` indicates no additional flags.
+        inputMethodManager.hideSoftInputFromWindow(mainWebView.getWindowToken(), 0);
+
         // Get handles for the menu items.
         MenuItem toggleFirstPartyCookiesMenuItem = menu.findItem(R.id.toggle_first_party_cookies);
         MenuItem toggleThirdPartyCookiesMenuItem = menu.findItem(R.id.toggle_third_party_cookies);