浏览代码

Android - Reset android input method focus and connection state when text input focus is removed (#19083)

* reset android input method focus and connection state when text input focus is removed

* addresses comment
Emmanuel Hansen 4 月之前
父节点
当前提交
3a16c45e8c
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/Android/Avalonia.Android/Platform/Input/AndroidInputMethod.cs

+ 5 - 0
src/Android/Avalonia.Android/Platform/Input/AndroidInputMethod.cs

@@ -89,6 +89,9 @@ namespace Avalonia.Android.Platform.Input
             }
             else
             {
+                _host.ClearFocus();
+                _imm.RestartInput(View);
+                _inputConnection = null;
                 _imm.HideSoftInputFromWindow(_host.WindowToken, HideSoftInputFlags.ImplicitOnly);
             }
         }
@@ -149,7 +152,9 @@ namespace Avalonia.Android.Platform.Input
             _host.InitEditorInfo((topLevel, outAttrs) =>
             {
                 if (_client == null)
+                {
                     return null!;
+                }
 
                 _inputConnection = new AvaloniaInputConnection(topLevel, this);