Skip to content

Commit

Permalink
Bump to latest
Browse files Browse the repository at this point in the history
- Apply to patch related to Animation (dotnet#1436)
- Apply to register Microsoft.Maui.Graphics Platforms (dotnet#1441)
- and so on.
  • Loading branch information
rookiejava committed Aug 9, 2021
1 parent 623ff32 commit 031f9f9
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 39 deletions.
30 changes: 1 addition & 29 deletions src/Compatibility/Core/src/Tizen/TizenPlatformServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using ElmSharp;
using Microsoft.Maui.Animations;
using Microsoft.Maui.Controls.Internals;
using TAppControl = Tizen.Applications.AppControl;
using Color = Microsoft.Maui.Graphics.Color;
Expand All @@ -22,30 +23,6 @@ public TizenPlatformServices()
s_context = SynchronizationContext.Current;
}

public class TizenTicker : Ticker
{
readonly Timer _timer;

public TizenTicker()
{
_timer = new Timer((object o) => HandleElapsed(o), this, Timeout.Infinite, Timeout.Infinite);
}

protected override void EnableTimer()
{
_timer.Change(16, 16);
}

protected override void DisableTimer()
{
_timer.Change(-1, -1);
}

void HandleElapsed(object state)
{
s_context.Post((o) => SendSignals(-1), null);
}
}
#region IPlatformServices implementation

public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
Expand Down Expand Up @@ -115,11 +92,6 @@ public void BeginInvokeOnMainThread(Action action)
s_context.Post((o) => action(), null);
}

public Ticker CreateTicker()
{
return new TizenTicker();
}

public void StartTimer(TimeSpan interval, Func<bool> callback)
{
Timer timer = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#nullable enable

using System;
using System.Threading.Tasks;

namespace Microsoft.Maui.Controls.Platform
{
internal partial class ModalNavigationService
{
public Task<Page> PopModalAsync(bool animated)
{
// TODO: Need to implementation
throw new NotImplementedException();
}

public Task PushModalAsync(Page modal, bool animated)
{
// TODO: Need to implementation
throw new NotImplementedException();
}
}
}
42 changes: 42 additions & 0 deletions src/Core/src/Animations/NativeTicker.Tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System.Threading;
using Tizen.Applications;

namespace Microsoft.Maui.Animations
{
public class NativeTicker : Ticker
{
readonly Timer _timer;
readonly SynchronizationContext? _context;
bool _isRunning;

public override bool IsRunning => _isRunning;

public NativeTicker()
{
if (SynchronizationContext.Current == null)
{
TizenSynchronizationContext.Initialize();
}

_context = SynchronizationContext.Current;
_timer = new Timer((object o) => HandleElapsed(o), this, Timeout.Infinite, Timeout.Infinite);
}

public override void Start()
{
_timer.Change(16, 16);
_isRunning = true;
}

public override void Stop()
{
_timer.Change(-1, -1);
_isRunning = false;
}

void HandleElapsed(object state)
{
_context?.Post((o) => Fire?.Invoke(), null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ public LifecycleBuilder(ILifecycleBuilder builder)
_builder = builder;
}

public void AddEvent(string eventName, Delegate action) =>
public void AddEvent<TDelegate>(string eventName, TDelegate action)
where TDelegate : Delegate
{
_builder.AddEvent(eventName, action);
}
}
}
}
22 changes: 13 additions & 9 deletions src/Core/src/Platform/Tizen/MauiApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,38 @@ protected override void OnPreCreate()
.Build();

Services = host.Services;
Application = Services.GetRequiredService<IApplication>();

Current.Services?.InvokeLifecycleEvents<TizenLifecycle.OnPreCreate>(del => del(this));
if (Services == null)
throw new InvalidOperationException($"The {nameof(IServiceProvider)} instance was not found.");

Current.Services.InvokeLifecycleEvents<TizenLifecycle.OnPreCreate>(del => del(this));
}

protected override void OnCreate()
{
base.OnCreate();

var services = MauiApplication.Current.Services;
var mauiApp = MauiApplication.Current.Application;
Application = Services.GetRequiredService<IApplication>();

if (Application == null)
throw new InvalidOperationException($"The {nameof(IApplication)} instance was not found.");

MauiContext mauiContext;
IWindow window;

var context = CoreUIAppContext.GetInstance(this);

// TODO Fix once we have multiple windows
if (mauiApp.Windows.Count > 0)
if (Application.Windows.Count > 0)
{
window = mauiApp.Windows[0];
mauiContext = new MauiContext(services, context);
window = Application.Windows[0];
mauiContext = new MauiContext(Services, context);
}
else
{
mauiContext = new MauiContext(services, context);
mauiContext = new MauiContext(Services, context);
ActivationState state = new ActivationState(mauiContext);
window = mauiApp.CreateWindow(state);
window = Application.CreateWindow(state);
}

var page = window.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,10 @@ public BitmapExportContext CreateBitmapExportContext(int width, int height, floa
{
return new SkiaBitmapExportContext(width, height, displayScale, 72, false);
}

public RectangleF GetPathBounds(PathF path)
{
return path.GetBoundsByFlattening();
}
}
}
5 changes: 5 additions & 0 deletions src/Core/src/Platform/Tizen/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public static void UpdateOpacity(this EvasObject nativeView, IView view)
}
}

public static void UpdateClip(this WrapperView nativeView, IView view)
{
nativeView.Clip = view.Clip;
}

public static void UpdateAutomationId(this EvasObject nativeView, IView view)
{
{
Expand Down

0 comments on commit 031f9f9

Please sign in to comment.