From b8adf36cbf732da19dcd100ba89d1b01af6db694 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 27 Feb 2024 00:25:34 +0100 Subject: scroll EditText to visible area after the keyboard appeared --- .../java/se/leap/bitmaskclient/base/utils/ViewHelper.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java') diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java index ed7bd9f2..e04ba70d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java @@ -229,8 +229,19 @@ public class ViewHelper { } public static void hideKeyboardFrom(Context context, View view) { + if (context == null) { + return; + } InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } + public static boolean isKeyboardShown(Context context) { + if (context == null) { + return false; + } + InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); + return imm.isActive(); + } + } -- cgit v1.2.3