Skip to content

Commit

Permalink
Fix keyboard hiding bug (#2652)
Browse files Browse the repository at this point in the history
* Fix keyboard hiding bug

* Update comment
  • Loading branch information
FikriMilano committed Sep 3, 2024
1 parent 7f4ecd2 commit f4041da
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ internal class OptionSelectDialogFragment(
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
)
// Adjust the dialog after the keyboard is on so that OK-CANCEL buttons are visible.
// SOFT_INPUT_ADJUST_RESIZE is deprecated and the suggested alternative
// setDecorFitsSystemWindows is available api level 30 and above.
// Ideally SOFT_INPUT_ADJUST_RESIZE supposed to be used, but in some devices the
// keyboard immediately hide itself after being opened, that's why SOFT_INPUT_ADJUST_PAN
// is used instead. There's no issue with setDecorFitsSystemWindows and is only
// available for api level 30 and above.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
it.setDecorFitsSystemWindows(false)
} else {
it.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
it.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
}
}
}
Expand Down

0 comments on commit f4041da

Please sign in to comment.