Blog edition accessibility

This commit is contained in:
Paul Schneider 2026-11-08 02:04:59 +00:00
commit f1c23965b2
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
14 changed files with 656 additions and 16 deletions

View file

@ -44,6 +44,28 @@ public class MainActivity : AvaloniaMainActivity
private void OnScreenAwakeChanged() => RunOnUiThread(UpdateScreenAwake);
internal static void ShowSoftKeyboard()
{
if (Current is not { } activity || !IsForeground)
{
global::Android.Util.Log.Warn("PostIt", "Cannot show the keyboard without a foreground activity.");
return;
}
activity.RunOnUiThread(() =>
{
if (activity.CurrentFocus is not { } view
|| activity.GetSystemService(InputMethodService) is not global::Android.Views.InputMethods.InputMethodManager inputMethod)
{
global::Android.Util.Log.Warn("PostIt", "Cannot show the keyboard without a focused native view and input method.");
return;
}
if (!inputMethod.ShowSoftInput(view, global::Android.Views.InputMethods.ShowFlags.Implicit))
global::Android.Util.Log.Warn("PostIt", "The input method did not accept the keyboard activation request.");
});
}
private void UpdateScreenAwake()
{
if (Window is not { } window) return;