Commit 0fe062dd authored by Matheus Jardim Bernardes's avatar Matheus Jardim Bernardes Committed by GitHub

Merge pull request #300 from RocketChat/fix_277

replicating #277 code changes
parents ea07d7fe b2db56c7
......@@ -7,9 +7,10 @@ import android.view.inputmethod.InputMethodManager;
public class KeyboardHelper {
public static void hideSoftKeyboard(Activity activity) {
if (activity.getCurrentFocus() != null) {
View currentFocus = activity.getCurrentFocus();
if (currentFocus != null) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
inputMethodManager.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
}
}
......@@ -23,4 +24,4 @@ public class KeyboardHelper {
InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment