Skip to content

Commit 313f635

Browse files
committed
Bump to latest
- Apply to start adding in APIs for adding legacy renderers via assembly scanning (dotnet#1333) - Update to IMauiContext (dotnet#1357) - and so on
1 parent f715268 commit 313f635

12 files changed

+46
-408
lines changed

src/Compatibility/Core/src/AppHostBuilderExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
using OpenGLViewRenderer = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.DefaultRenderer;
4545
using StreamImagesourceHandler = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.StreamImageSourceHandler;
4646
using ImageLoaderSourceHandler = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.UriImageSourceHandler;
47+
using DefaultRenderer = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.DefaultRenderer;
4748
#endif
4849

4950
namespace Microsoft.Maui.Controls.Hosting

src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static IMauiHandlersCollection AddCompatibilityRenderer<TControlType, TRe
5050
public static IMauiHandlersCollection AddCompatibilityRenderers(this IMauiHandlersCollection handlersCollection, params global::System.Reflection.Assembly[] assemblies)
5151
{
5252

53-
#if __ANDROID__ || __IOS__ || WINDOWS || MACCATALYST
53+
#if __ANDROID__ || __IOS__ || WINDOWS || MACCATALYST || TIZEN
5454

5555
Internals.Registrar.RegisterAll(
5656
assemblies,
@@ -86,7 +86,7 @@ public static IFontCollection AddCompatibilityFonts(this IFontCollection fontCol
8686
public static IImageSourceServiceCollection AddCompatibilityServices(this IImageSourceServiceCollection services, params global::System.Reflection.Assembly[] assemblies)
8787
{
8888

89-
#if __ANDROID__ || __IOS__ || WINDOWS || MACCATALYST
89+
#if __ANDROID__ || __IOS__ || WINDOWS || MACCATALYST || TIZEN
9090
Internals.Registrar.RegisterAll(
9191
assemblies,
9292
null,

src/Compatibility/Core/src/RendererToHandlerShim.Tizen.cs

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -29,105 +29,5 @@ public override ERect GetNativeContentGeometry()
2929
{
3030
return VisualElementRenderer?.GetNativeContentGeometry() ?? new ERect();
3131
}
32-
33-
//public static IViewHandler CreateShim(object renderer)
34-
//{
35-
// if (renderer is IViewHandler handler)
36-
// return handler;
37-
38-
// if (renderer is IVisualElementRenderer ivr)
39-
// return new RendererToHandlerShim(ivr);
40-
41-
// return new RendererToHandlerShim();
42-
//}
43-
44-
//public RendererToHandlerShim() : base(ViewHandler.ViewMapper)
45-
//{
46-
//}
47-
48-
//public RendererToHandlerShim(IVisualElementRenderer visualElementRenderer) : this()
49-
//{
50-
// if (visualElementRenderer != null)
51-
// SetupRenderer(visualElementRenderer);
52-
//}
53-
54-
//public void SetupRenderer(IVisualElementRenderer visualElementRenderer)
55-
//{
56-
// VisualElementRenderer = visualElementRenderer;
57-
// VisualElementRenderer.ElementChanged += OnElementChanged;
58-
59-
// if (VisualElementRenderer.Element is IView view)
60-
// {
61-
// view.Handler = this;
62-
// SetVirtualView(view);
63-
// }
64-
// else if (VisualElementRenderer.Element != null)
65-
// throw new Exception($"{VisualElementRenderer.Element} must implement: {nameof(IView)}");
66-
//}
67-
68-
//void OnElementChanged(object sender, VisualElementChangedEventArgs e)
69-
//{
70-
// if (e.OldElement is IView view)
71-
// view.Handler = null;
72-
73-
// if (e.NewElement is IView newView)
74-
// {
75-
// newView.Handler = this;
76-
// this.SetVirtualView(newView);
77-
// }
78-
// else if (e.NewElement != null)
79-
// throw new Exception($"{e.NewElement} must implement: {nameof(IView)}");
80-
//}
81-
82-
//protected override EvasObject CreateNativeView()
83-
//{
84-
// return VisualElementRenderer.NativeView;
85-
//}
86-
87-
//protected override void ConnectHandler(EvasObject nativeView)
88-
//{
89-
// base.ConnectHandler(nativeView);
90-
// VirtualView.Handler = this;
91-
//}
92-
93-
//protected override void DisconnectHandler(EvasObject nativeView)
94-
//{
95-
// Platform.Tizen.Platform.SetRenderer(VisualElementRenderer.Element, VisualElementRenderer);
96-
97-
// VisualElementRenderer.SetElement(null);
98-
99-
// base.DisconnectHandler(nativeView);
100-
// VirtualView.Handler = null;
101-
//}
102-
103-
//public override void SetVirtualView(IView view)
104-
//{
105-
// if (VisualElementRenderer == null)
106-
// {
107-
// var renderer = Internals.Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(view) ?? new DefaultRenderer();
108-
109-
// SetupRenderer(renderer);
110-
// }
111-
112-
// if (VisualElementRenderer.Element != view)
113-
// {
114-
// VisualElementRenderer.SetElement((VisualElement)view);
115-
// }
116-
// else
117-
// {
118-
// base.SetVirtualView(view);
119-
// }
120-
121-
// Platform.Tizen.Platform.SetRenderer(VisualElementRenderer.Element, VisualElementRenderer);
122-
//}
123-
124-
//public override void UpdateValue(string property)
125-
//{
126-
// base.UpdateValue(property);
127-
// if (property == "Frame")
128-
// {
129-
// NativeArrange(VisualElementRenderer.Element.Bounds);
130-
// }
131-
//}
13232
}
13333
}

src/Compatibility/Core/src/Tizen/ExportCellAttribute.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Compatibility/Core/src/Tizen/ExportHandlerAttribute.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Compatibility/Core/src/Tizen/ExportImageSourceHandlerAttribute.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Compatibility/Core/src/Tizen/ExportRendererAttribute.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

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

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,6 @@ static void SetupInit(IMauiContext context, InitializationOptions options = null
499499
Device.SetIdiom(TargetIdiom.Unsupported);
500500
}
501501

502-
if (options?.Flags.HasFlag(InitializationFlags.SkipRenderers) != true)
503-
RegisterCompatRenderers(options);
504-
505502
Application.AccentColor = GetAccentColor(profile);
506503
ExpressionSearch.Default = new TizenExpressionSearch();
507504

@@ -511,124 +508,6 @@ static void SetupInit(IMauiContext context, InitializationOptions options = null
511508
IsInitialized = true;
512509
}
513510

514-
// Once we get essentials/cg converted to using startup.cs
515-
// we will delete all the renderer code inside this file
516-
internal static void RenderersRegistered()
517-
{
518-
IsInitializedRenderers = true;
519-
}
520-
521-
internal static void RegisterCompatRenderers(InitializationOptions options)
522-
{
523-
if (!IsInitializedRenderers)
524-
{
525-
IsInitializedRenderers = true;
526-
if (options != null)
527-
{
528-
s_platformType = options.PlatformType;
529-
s_useMessagingCenter = options.UseMessagingCenter;
530-
UseSkiaSharp = options.UseSkiaSharp;
531-
UseFastLayout = options.UseFastLayout;
532-
533-
// renderers
534-
if (options.Handlers != null)
535-
{
536-
Registrar.RegisterRenderers(options.Handlers);
537-
}
538-
else
539-
{
540-
// static registrar
541-
if (options.StaticRegistarStrategy != StaticRegistrarStrategy.None)
542-
{
543-
s_staticRegistrarStrategy = options.StaticRegistarStrategy;
544-
StaticRegistrar.RegisterHandlers(options.CustomHandlers);
545-
546-
if (options.StaticRegistarStrategy == StaticRegistrarStrategy.All)
547-
{
548-
Registrar.RegisterAll(new Type[]
549-
{
550-
typeof(ExportRendererAttribute),
551-
typeof(ExportImageSourceHandlerAttribute),
552-
typeof(ExportCellAttribute),
553-
typeof(ExportHandlerAttribute),
554-
typeof(ExportFontAttribute)
555-
});
556-
557-
if (UseSkiaSharp)
558-
RegisterSkiaSharpRenderers();
559-
}
560-
}
561-
else
562-
{
563-
Registrar.RegisterAll(new Type[]
564-
{
565-
typeof(ExportRendererAttribute),
566-
typeof(ExportImageSourceHandlerAttribute),
567-
typeof(ExportCellAttribute),
568-
typeof(ExportHandlerAttribute),
569-
typeof(ExportFontAttribute)
570-
});
571-
572-
if (UseSkiaSharp)
573-
RegisterSkiaSharpRenderers();
574-
575-
if (UseFastLayout)
576-
Registrar.Registered.Register(typeof(Layout), typeof(FastLayoutRenderer));
577-
}
578-
}
579-
580-
// effects
581-
var effectScopes = options.EffectScopes;
582-
if (effectScopes != null)
583-
{
584-
for (var i = 0; i < effectScopes.Length; i++)
585-
{
586-
var effectScope = effectScopes[0];
587-
Registrar.RegisterEffects(effectScope.Name, effectScope.Effects);
588-
}
589-
}
590-
591-
// css
592-
Registrar.RegisterStylesheets(options.Flags);
593-
}
594-
else
595-
{
596-
Registrar.RegisterAll(new Type[]
597-
{
598-
typeof(ExportRendererAttribute),
599-
typeof(ExportImageSourceHandlerAttribute),
600-
typeof(ExportCellAttribute),
601-
typeof(ExportHandlerAttribute),
602-
typeof(ExportFontAttribute)
603-
});
604-
}
605-
}
606-
}
607-
608-
internal static void RegisterCompatRenderers(
609-
Assembly[] assemblies,
610-
Assembly defaultRendererAssembly,
611-
Action<Type> viewRegistered)
612-
{
613-
if (IsInitializedRenderers)
614-
return;
615-
616-
IsInitializedRenderers = true;
617-
618-
// Only need to do this once
619-
Controls.Internals.Registrar.RegisterAll(
620-
assemblies,
621-
defaultRendererAssembly,
622-
new[] {
623-
typeof(ExportRendererAttribute),
624-
typeof(ExportImageSourceHandlerAttribute),
625-
typeof(ExportCellAttribute),
626-
typeof(ExportHandlerAttribute),
627-
typeof(ExportFontAttribute)
628-
}, default(InitializationFlags),
629-
viewRegistered);
630-
}
631-
632511
static void RegisterSkiaSharpRenderers()
633512
{
634513
// Register all skiasharp-based rednerers here.

0 commit comments

Comments
 (0)