]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Hide the keyboard every time a new webpage loads. https://redmine.stoutner.com/issue...
authorSoren Stoutner <soren@stoutner.com>
Fri, 6 Oct 2017 18:41:56 +0000 (11:41 -0700)
committerSoren Stoutner <soren@stoutner.com>
Fri, 6 Oct 2017 18:41:56 +0000 (11:41 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java

index e75d4193d9e283135d5b2678359f7b72b33c91e3..6bc302adc988ff2f72c513ce8be9bcb2a2f33023 100644 (file)
@@ -682,11 +682,8 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
                     // Load the new folder.
                     loadBookmarksFolder();
                 } else {  // The selected bookmark is not a folder.
-                    // Get the bookmark URL and assign it to `formattedUrlString`.
-                    String bookmarkUrl = bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_URL));
-
                     // Load the bookmark URL.
-                    loadUrl(bookmarkUrl);
+                    loadUrl(bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_URL)));
 
                     // Close the bookmarks drawer.
                     drawerLayout.closeDrawer(GravityCompat.END);
@@ -839,6 +836,9 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
                     mainWebView.setVisibility(View.INVISIBLE);
                 }
 
+                // Hide the keyboard.  `0` indicates no additional flags.
+                inputMethodManager.hideSoftInputFromWindow(mainWebView.getWindowToken(), 0);
+
                 // Check to see if we are waiting on Orbot.
                 if (!waitingForOrbot) {  // We are not waiting on Orbot, so we need to process the URL.
                     // We need to update `formattedUrlString` at the beginning of the load, so that if the user toggles JavaScript during the load the new website is reloaded.
@@ -2478,9 +2478,6 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
         }
 
         loadUrl(formattedUrlString);
-
-        // Hide the keyboard so we can see the webpage.  `0` indicates no additional flags.
-        inputMethodManager.hideSoftInputFromWindow(mainWebView.getWindowToken(), 0);
     }