|
|
@ -1,17 +1,27 @@ |
|
|
|
|
|
using System; |
|
|
|
|
|
using System.IO; |
|
|
using Avalonia.Android.CanvasRendering; |
|
|
using Avalonia.Android.CanvasRendering; |
|
|
using Avalonia.Android.Platform; |
|
|
using Avalonia.Android.Platform; |
|
|
using Avalonia.Android.Platform.Input; |
|
|
using Avalonia.Android.Platform.Input; |
|
|
using Avalonia.Android.Platform.Specific; |
|
|
using Avalonia.Android.Platform.SkiaPlatform; |
|
|
|
|
|
using Avalonia.Controls; |
|
|
using Avalonia.Controls.Platform; |
|
|
using Avalonia.Controls.Platform; |
|
|
using Avalonia.Input; |
|
|
using Avalonia.Input; |
|
|
using Avalonia.Input.Platform; |
|
|
using Avalonia.Input.Platform; |
|
|
using Avalonia.Platform; |
|
|
using Avalonia.Platform; |
|
|
using Avalonia.Shared.PlatformSupport; |
|
|
using Avalonia.Shared.PlatformSupport; |
|
|
using Avalonia.Skia; |
|
|
|
|
|
using System; |
|
|
namespace Avalonia |
|
|
using System.Collections.Generic; |
|
|
{ |
|
|
using Avalonia.Android.Platform.SkiaPlatform; |
|
|
public static class AndroidApplicationExtensions |
|
|
using System.IO; |
|
|
{ |
|
|
|
|
|
public static AppBuilder UseAndroid(this AppBuilder builder) |
|
|
|
|
|
{ |
|
|
|
|
|
builder.WindowingSubsystem = Avalonia.Android.AndroidPlatform.Initialize; |
|
|
|
|
|
return builder; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
namespace Avalonia.Android |
|
|
namespace Avalonia.Android |
|
|
{ |
|
|
{ |
|
|
@ -25,26 +35,23 @@ namespace Avalonia.Android |
|
|
|
|
|
|
|
|
private readonly double _scalingFactor = 1; |
|
|
private readonly double _scalingFactor = 1; |
|
|
|
|
|
|
|
|
AndroidPlatform() |
|
|
public AndroidPlatform() |
|
|
|
|
|
{ |
|
|
|
|
|
_scalingFactor = global::Android.App.Application.Context.Resources.DisplayMetrics.ScaledDensity; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void Initialize() |
|
|
{ |
|
|
{ |
|
|
AvaloniaLocator.CurrentMutable |
|
|
AvaloniaLocator.CurrentMutable |
|
|
.Bind<IClipboard>().ToTransient<ClipboardImpl>() |
|
|
.Bind<IClipboard>().ToTransient<ClipboardImpl>() |
|
|
.Bind<IStandardCursorFactory>().ToTransient<CursorFactory>() |
|
|
.Bind<IStandardCursorFactory>().ToTransient<CursorFactory>() |
|
|
.Bind<IKeyboardDevice>().ToSingleton<AndroidKeyboardDevice>() |
|
|
.Bind<IKeyboardDevice>().ToSingleton<AndroidKeyboardDevice>() |
|
|
.Bind<IMouseDevice>().ToSingleton<AndroidMouseDevice>() |
|
|
.Bind<IMouseDevice>().ToSingleton<AndroidMouseDevice>() |
|
|
.Bind<IPlatformSettings>().ToConstant(this) |
|
|
.Bind<IPlatformSettings>().ToConstant(Instance) |
|
|
.Bind<IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface()) |
|
|
.Bind<IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface()) |
|
|
.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>() |
|
|
.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>() |
|
|
.Bind<ITopLevelRenderer>().ToTransient<AndroidTopLevelRenderer>() |
|
|
.Bind<ITopLevelRenderer>().ToTransient<AndroidTopLevelRenderer>() |
|
|
.Bind<IWindowingPlatform>().ToConstant(this); |
|
|
.Bind<IWindowingPlatform>().ToConstant(Instance); |
|
|
|
|
|
|
|
|
SkiaPlatform.Initialize(); |
|
|
|
|
|
|
|
|
|
|
|
_scalingFactor = global::Android.App.Application.Context.Resources.DisplayMetrics.ScaledDensity; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//we have custom Assetloader so no need to overwrite it
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Init(Type applicationType) |
|
|
public void Init(Type applicationType) |
|
|
|