Browse Source

Make Avalonia.Android compile again.

No idea if it actually works because android doesn't seem to work at all
at the moment.
pull/773/head
Steven Kirk 10 years ago
parent
commit
94082ce958
  1. 2
      src/Android/Avalonia.Android/AndroidPlatform.cs
  2. 1
      src/Android/Avalonia.Android/Avalonia.Android.csproj
  3. 59
      src/Android/Avalonia.Android/Platform/AndroidTopLevelRenderer.cs

2
src/Android/Avalonia.Android/AndroidPlatform.cs

@ -1,4 +1,3 @@
using Avalonia.Android.CanvasRendering;
using Avalonia.Android.Platform;
using Avalonia.Android.Platform.Input;
using Avalonia.Android.Platform.Specific;
@ -35,7 +34,6 @@ namespace Avalonia.Android
.Bind<IPlatformSettings>().ToConstant(this)
.Bind<IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface())
.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>()
.Bind<ITopLevelRenderer>().ToTransient<AndroidTopLevelRenderer>()
.Bind<IWindowingPlatform>().ToConstant(this);
SkiaPlatform.Initialize();

1
src/Android/Avalonia.Android/Avalonia.Android.csproj

@ -74,7 +74,6 @@
<Compile Include="Platform\Specific\AvaloniaActivity.cs" />
<Compile Include="Platform\Specific\Helpers\AndroidTouchEventsHelper.cs" />
<Compile Include="Platform\Specific\Helpers\AndroidKeyboardEventsHelper.cs" />
<Compile Include="Platform\AndroidTopLevelRenderer.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RuntimeInfo.cs" />

59
src/Android/Avalonia.Android/Platform/AndroidTopLevelRenderer.cs

@ -1,59 +0,0 @@
using Avalonia.Controls;
using Avalonia.Controls.Platform;
using Avalonia.Platform;
using Avalonia.Rendering;
using Avalonia.Threading;
using System;
using System.Collections.Generic;
namespace Avalonia.Android.CanvasRendering
{
internal class AndroidTopLevelRenderer : ITopLevelRenderer
{
public void Attach(TopLevel topLevel)
{
var resources = new List<IDisposable>();
var initialClientSize = topLevel.PlatformImpl.ClientSize;
var queueManager = ((IRenderRoot)topLevel).RenderQueueManager;
if (queueManager == null)
return;
var viewport = PlatformManager.CreateRenderTarget(topLevel.PlatformImpl);
resources.Add(viewport);
//resources.Add(queueManager.RenderNeeded.Subscribe(_
// =>
// Dispatcher.UIThread.InvokeAsync(() => topLevel.PlatformImpl.Invalidate(new Rect(topLevel.ClientSize)))));
Action pendingInvalidation = null;
resources.Add(queueManager.RenderNeeded.Subscribe(_ =>
{
if (pendingInvalidation == null)
{
pendingInvalidation = () =>
{
topLevel.PlatformImpl.Invalidate(new Rect(topLevel.ClientSize));
pendingInvalidation = null;
};
Dispatcher.UIThread.InvokeAsync(pendingInvalidation);
}
}
));
topLevel.PlatformImpl.Paint = rect =>
{
viewport.Render(topLevel);
queueManager.RenderFinished();
};
topLevel.Closed += delegate
{
foreach (var disposable in resources)
disposable.Dispose();
resources.Clear();
};
}
}
}
Loading…
Cancel
Save