From 853a37920cfe91881f58e97dfcacb6cdd45b5d11 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Mon, 2 Feb 2026 12:59:40 -0400 Subject: [PATCH] Cycle view focus if keyboard fails to open. --- .../java/org/thoughtcrime/securesms/util/ViewUtil.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java b/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java index 646bd9d037..854fa25c16 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java @@ -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); + } }); } }