boolean isKeyboardVisible = WindowInsetsCompat. toWindowInsetsCompat(activity.getWindow().getDecorView().getRootWindowInsets())