From 6b80f3b394479dc49a3a4dfce730fada4bba8a70 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Thu, 8 Jun 2017 16:35:18 -0700 Subject: [PATCH] Hide the keyboard when the options menu is displayed. --- .../privacybrowser/activities/MainWebViewActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.45.2