imm crash fix

This commit is contained in:
Alex Dochioiu 2023-10-11 10:45:10 +03:00
parent 0157c8ec7c
commit b3b8923014
1 changed files with 8 additions and 1 deletions

View File

@ -1525,7 +1525,14 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
public void run() {
InputMethodManager imm =
(InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
if (containerView != null && imm != null && !imm.isAcceptingText()) {
boolean isAcceptingText = false;
try {
if (imm != null) {
isAcceptingText = imm.isAcceptingText();
}
} catch (Exception ignored) {
}
if (containerView != null && imm != null && !isAcceptingText) {
imm.hideSoftInputFromWindow(
containerView.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}