From: Soren Stoutner Date: Thu, 8 Jun 2017 23:35:18 +0000 (-0700) Subject: Hide the keyboard when the options menu is displayed. X-Git-Tag: v2.4~12 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=6b80f3b394479dc49a3a4dfce730fada4bba8a70;p=PrivacyBrowserAndroid.git Hide the keyboard when the options menu is displayed. --- 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 365ca4a9..4200fb5e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -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);