From 62111020d0c2e4f215c8953a23940f91e217cd59 Mon Sep 17 00:00:00 2001 From: Kangho Hur Date: Fri, 3 Sep 2021 15:50:10 +0900 Subject: [PATCH] [Tizen] Adds BoxView Handler --- .../Handlers/BoxView/BoxViewHandler.Tizen.cs | 25 +++++++++++++++++++ .../src/Handlers/Entry/EntryHandler.Tizen.cs | 5 ++++ .../src/Platform/Tizen/BoxViewExtensions.cs | 12 +++++++++ src/Core/src/Platform/Tizen/MauiBoxView.cs | 13 ++++++++++ 4 files changed, 55 insertions(+) create mode 100644 src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs create mode 100644 src/Core/src/Platform/Tizen/BoxViewExtensions.cs create mode 100644 src/Core/src/Platform/Tizen/MauiBoxView.cs diff --git a/src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs b/src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs new file mode 100644 index 000000000000..630fd3fdc49c --- /dev/null +++ b/src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs @@ -0,0 +1,25 @@ +using Microsoft.Maui.Graphics; + +namespace Microsoft.Maui.Handlers +{ + public partial class BoxViewHandler : ViewHandler + { + protected override MauiBoxView CreateNativeView() + { + return new MauiBoxView(NativeParent!) + { + Drawable = new BoxViewDrawable(VirtualView) + }; + } + + public static void MapColor(BoxViewHandler handler, IBoxView boxView) + { + handler.NativeView?.InvalidateBoxView(boxView); + } + + public static void MapCornerRadius(BoxViewHandler handler, IBoxView boxView) + { + handler.NativeView?.InvalidateBoxView(boxView); + } + } +} diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs b/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs index 706c6f2bf908..899f1fdbc6b1 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Tizen.cs @@ -72,6 +72,11 @@ public static void MapPlaceholder(EntryHandler handler, IEntry entry) handler.NativeView?.UpdatePlaceholder(entry); } + public static void MapPlaceholderColor(EntryHandler handler, IEntry entry) + { + handler.NativeView?.UpdatePlaceholderColor(entry); + } + public static void MapIsPassword(EntryHandler handler, IEntry entry) { handler.NativeView?.UpdateIsPassword(entry); diff --git a/src/Core/src/Platform/Tizen/BoxViewExtensions.cs b/src/Core/src/Platform/Tizen/BoxViewExtensions.cs new file mode 100644 index 000000000000..1c450ddd290b --- /dev/null +++ b/src/Core/src/Platform/Tizen/BoxViewExtensions.cs @@ -0,0 +1,12 @@ +using Microsoft.Maui.Graphics; + +namespace Microsoft.Maui +{ + public static class BoxViewExtensions + { + public static void InvalidateBoxView(this MauiBoxView nativeView, IBoxView boxView) + { + nativeView.Invalidate(); + } + } +} \ No newline at end of file diff --git a/src/Core/src/Platform/Tizen/MauiBoxView.cs b/src/Core/src/Platform/Tizen/MauiBoxView.cs new file mode 100644 index 000000000000..ab75f3de653b --- /dev/null +++ b/src/Core/src/Platform/Tizen/MauiBoxView.cs @@ -0,0 +1,13 @@ +using ElmSharp; +using SkiaGraphicsView = Microsoft.Maui.Platform.Tizen.SkiaGraphicsView; + +namespace Microsoft.Maui +{ + public class MauiBoxView : SkiaGraphicsView + { + public MauiBoxView(EvasObject parent) : base(parent) + { + DeviceScalingFactor = (float)Tizen.UIExtensions.Common.DeviceInfo.ScalingFactor; + } + } +} \ No newline at end of file