Added fail-safe

pull/208/head
M66B 3 years ago
parent 388af6e7c5
commit 5a8763a7dc

@ -1527,17 +1527,22 @@ public class Helper {
} }
static boolean isKeyboardVisible(final View view) { static boolean isKeyboardVisible(final View view) {
if (view == null) try {
return false; if (view == null)
View root = view.getRootView(); return false;
if (root == null) View root = view.getRootView();
return false; if (root == null)
WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(root); return false;
if (insets == null) WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(root);
if (insets == null)
return false;
boolean visible = insets.isVisible(WindowInsetsCompat.Type.ime());
Log.i("isKeyboardVisible=" + visible);
return visible;
} catch (Throwable ex) {
Log.e(ex);
return false; return false;
boolean visible = insets.isVisible(WindowInsetsCompat.Type.ime()); }
Log.i("isKeyboardVisible=" + visible);
return visible;
} }
static String getViewName(View view) { static String getViewName(View view) {

Loading…
Cancel
Save