mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 00:01:08 +01:00
Cycle view focus if keyboard fails to open.
This commit is contained in:
@@ -89,7 +89,15 @@ public final class ViewUtil {
|
||||
if (view.isFocused()) {
|
||||
view.post(() -> {
|
||||
InputMethodManager inputMethodManager = ServiceUtil.getInputMethodManager(view.getContext());
|
||||
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||
if (!inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)) {
|
||||
/*
|
||||
* Sometimes when animations are disabled, the [InputMethodManager] can end up in a bad state.
|
||||
* To resolve this, we can just cycle the focus of the view.
|
||||
*/
|
||||
view.clearFocus();
|
||||
view.requestFocus();
|
||||
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user