Skip to content

Commit 27f2879

Browse files
committed
Bump to latest
- Modal Navigation Manager (dotnet#1563) - Implement the basic WindowHandler (dotnet#1468) - Don't extract native defaults, meaning users can no longer reset a color back to a platform theme (dotnet#1485) - Implement Alerts (Alert, Prompt and ActionSheet) (dotnet#1328) - And so on.
1 parent 6bab7f7 commit 27f2879

21 files changed

+186
-45
lines changed

src/Compatibility/Core/src/Tizen/Forms.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@ static void SetupInit(IMauiContext context, InitializationOptions options = null
484484
Device.Info = new Forms.TizenDeviceInfo();
485485
Device.SetFlags(s_flags);
486486

487+
if (options?.Flags.HasFlag(InitializationFlags.SkipRenderers) != true)
488+
RegisterCompatRenderers(options);
489+
487490
string profile = ((TizenDeviceInfo)Device.Info).Profile;
488491
if (profile == "mobile")
489492
{
@@ -523,6 +526,50 @@ static void SetupInit(IMauiContext context, InitializationOptions options = null
523526
IsInitialized = true;
524527
}
525528

529+
internal static void RegisterCompatRenderers(InitializationOptions maybeOptions = null)
530+
{
531+
if (!IsInitializedRenderers)
532+
{
533+
IsInitializedRenderers = true;
534+
if (maybeOptions != null)
535+
{
536+
var options = maybeOptions;
537+
var handlers = options.Handlers;
538+
var flags = options.Flags;
539+
var effectScopes = options.EffectScopes;
540+
541+
//TODO: ExportCell?
542+
//TODO: ExportFont
543+
544+
// renderers
545+
Registrar.RegisterRenderers(handlers);
546+
547+
// effects
548+
if (effectScopes != null)
549+
{
550+
for (var i = 0; i < effectScopes.Length; i++)
551+
{
552+
var effectScope = effectScopes[0];
553+
Registrar.RegisterEffects(effectScope.Name, effectScope.Effects);
554+
}
555+
}
556+
557+
// css
558+
Registrar.RegisterStylesheets(flags);
559+
}
560+
else
561+
{
562+
// Only need to do this once
563+
Registrar.RegisterAll(new[] {
564+
typeof(ExportRendererAttribute),
565+
typeof(ExportCellAttribute),
566+
typeof(ExportImageSourceHandlerAttribute),
567+
typeof(ExportFontAttribute)
568+
});
569+
}
570+
}
571+
}
572+
526573
static void RegisterSkiaSharpRenderers()
527574
{
528575
// Register all skiasharp-based rednerers here.

src/Compatibility/Core/src/Tizen/HandlerToRendererShim.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,14 @@ public MockParentHandler(VisualElement parent)
123123

124124
public IMauiContext MauiContext => null;
125125

126-
object IViewHandler.NativeView => NativeView;
126+
object IElementHandler.NativeView => NativeView;
127127

128128
object IViewHandler.ContainerView => NativeView;
129129

130-
bool HasContainer { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
131130
bool IViewHandler.HasContainer { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
132131

132+
Maui.IElement IElementHandler.VirtualView => throw new NotImplementedException();
133+
133134
public void DisconnectHandler() { }
134135

135136
public void Dispose()
@@ -170,6 +171,11 @@ public void UpdateValue(string property)
170171
{
171172
throw new NotImplementedException();
172173
}
174+
175+
public void SetVirtualView(Maui.IElement view)
176+
{
177+
throw new NotImplementedException();
178+
}
173179
}
174180

175181
}

src/Compatibility/Core/src/Tizen/Platform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal static IVisualElementRenderer CreateRenderer(VisualElement element)
5353
//TODO: Handle this with AppBuilderHost
5454
try
5555
{
56-
handler = Forms.MauiContext.Handlers.GetHandler(element.GetType());
56+
handler = Forms.MauiContext.Handlers.GetHandler(element.GetType()) as IViewHandler;
5757
handler.SetMauiContext(Forms.MauiContext);
5858
}
5959
catch
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#nullable enable
2+
using System;
3+
using EWindow = ElmSharp.Window;
4+
5+
namespace Microsoft.Maui.Controls
6+
{
7+
public partial class Window
8+
{
9+
internal EWindow NativeWindow =>
10+
(Handler?.NativeView as EWindow) ?? throw new InvalidOperationException("Window should have a ElmSharp.Window set.");
11+
}
12+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
namespace Microsoft.Maui.Controls.Platform
4+
{
5+
internal partial class AlertManager
6+
{
7+
internal static void Subscribe(Window window)
8+
{
9+
//TODO: Need to implementation
10+
//throw new NotImplementedException();
11+
}
12+
13+
internal static void Unsubscribe(Window window)
14+
{
15+
//TODO: Need to implementation
16+
//throw new NotImplementedException();
17+
}
18+
}
19+
}

src/Controls/src/Core/Platform/ModalNavigationService/ModalNavigationService.Tizen.cs renamed to src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Tizen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Microsoft.Maui.Controls.Platform
66
{
7-
internal partial class ModalNavigationService
7+
internal partial class ModalNavigationManager
88
{
99
ModalStack _modalStack => MauiContext.Context!.ModalStack;
1010
IPageController CurrentPageController => _navModel.CurrentPage;

src/Core/src/Handlers/Label/LabelHandler.Tizen.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public static void MapHorizontalTextAlignment(LabelHandler handler, ILabel label
2424
handler.NativeView?.UpdateHorizontalTextAlignment(label);
2525
}
2626

27+
public static void MapVerticalTextAlignment(LabelHandler handler, ILabel label)
28+
{
29+
handler.NativeView?.UpdateVerticalTextAlignment(label);
30+
}
31+
2732
public static void MapLineBreakMode(LabelHandler handler, ILabel label)
2833
{
2934
handler.NativeView?.UpdateLineBreakMode(label);

src/Core/src/Handlers/ProgressBar/ProgressBarHandler.Tizen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected override EProgressBar CreateNativeView()
1515
return progressBar;
1616
}
1717

18-
protected override void SetupDefaults(EProgressBar nativeView)
18+
void SetupDefaults(EProgressBar nativeView)
1919
{
2020
nativeView.Color = ThemeConstants.ProgressBar.ColorClass.Default;
2121
}

src/Core/src/Handlers/Slider/SliderHandler.Tizen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected override void DisconnectHandler(ESlider nativeView)
2727
nativeView!.DragStopped -= OnDragStopped;
2828
}
2929

30-
protected override void SetupDefaults(ESlider nativeView)
30+
void SetupDefaults(ESlider nativeView)
3131
{
3232
DefaultMinTrackColor = nativeView.GetBarColor();
3333
DefaultMaxTrackColor = nativeView.GetBackgroundColor();

src/Core/src/Handlers/View/ViewHandlerOfT.Tizen.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ protected virtual void Dispose(bool disposing)
193193
if (disposing)
194194
{
195195
// Dispose managed state (managed objects)
196-
if (WrappedNativeView != null)
196+
if (WrappedNativeView is TNativeView wrapped)
197197
{
198-
DisconnectHandler(WrappedNativeView);
199-
WrappedNativeView.Unrealize();
198+
DisconnectHandler(wrapped);
199+
wrapped.Unrealize();
200200
}
201201
}
202202

0 commit comments

Comments
 (0)