Brion VIBBER has submitted this change and it was merged.

Change subject: Fix keyboard not hiding when it should
......................................................................


Fix keyboard not hiding when it should

Bug: 63493
Change-Id: I8e9c59bc4d37092a4035c661e559700e64e48d82
---
M wikipedia/src/main/java/org/wikipedia/Utils.java
1 file changed, 7 insertions(+), 5 deletions(-)

Approvals:
  Brion VIBBER: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wikipedia/src/main/java/org/wikipedia/Utils.java 
b/wikipedia/src/main/java/org/wikipedia/Utils.java
index 4409be1..bec0eca 100644
--- a/wikipedia/src/main/java/org/wikipedia/Utils.java
+++ b/wikipedia/src/main/java/org/wikipedia/Utils.java
@@ -204,15 +204,17 @@
     }
 
     /**
-     * Attempt to hide the Android Keyboard
+     * Attempt to hide the Android Keyboard.
+     *
+     * FIXME: This should not need to exist.
+     * I do not know why Android does not handle this automatically.
      *
      * @param activity The current activity
      */
     public static void hideSoftKeyboard(Activity activity) {
-        if (activity.getCurrentFocus() != null) {
-            InputMethodManager keyboard = 
(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
-            
keyboard.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 
0);
-        }
+        InputMethodManager keyboard = 
(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
+        // Not using getCurrentFocus as that sometimes is null, but the 
keyboard is still up.
+        
keyboard.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(),
 0);
     }
 
     public static void setupShowPasswordCheck(final CheckBox check, final 
EditText edit) {

-- 
To view, visit https://gerrit.wikimedia.org/r/125975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8e9c59bc4d37092a4035c661e559700e64e48d82
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to