Blog edition accessibility
This commit is contained in:
parent
a131a6ddf8
commit
f1c23965b2
14 changed files with 656 additions and 16 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ internal static class PlatformBootstrap
|
|||
|
||||
Platform.CreateServiceProvider = AndroidServiceProvider.GetOrCreate;
|
||||
Platform.BackgroundChatService = AndroidBackgroundChatService.Instance;
|
||||
Platform.ShowSoftKeyboard = MainActivity.ShowSoftKeyboard;
|
||||
Platform.TryGetCurrentLocationAsync = AndroidCurrentLocationProvider.TryGetCurrentLocationAsync;
|
||||
Platform.CreateVideoSurface = (player, replay) => new AndroidVideoSurface(player, replay);
|
||||
if (System.OperatingSystem.IsAndroidVersionAtLeast(26))
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<AndroidPackageFormat>apk</AndroidPackageFormat>
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
||||
<!-- LibVLC's native package targets inspect the plural RID property. -->
|
||||
<RuntimeIdentifiers Condition="'$(RuntimeIdentifiers)' == '' and '$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</RuntimeIdentifiers>
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
<ProjectReference Include="..\PostIt\PostIt.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
|
||||
<Compile Include="..\PostIt.Tests\AndroidMarkdownEditorTestActivity.cs" Link="Tests\AndroidMarkdownEditorTestActivity.cs" />
|
||||
<Compile Include="..\PostIt.Tests\AndroidChatServiceTestActivity.cs" Link="Tests\AndroidChatServiceTestActivity.cs" />
|
||||
<Compile Include="..\PostIt.Tests\AndroidPodcastCaptureTestActivity.cs" Link="Tests\AndroidPodcastCaptureTestActivity.cs" />
|
||||
<Compile Include="..\PostIt.Tests\AndroidCameraFrameRotationTestActivity.cs" Link="Tests\AndroidCameraFrameRotationTestActivity.cs" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue