diff --git a/Microsoft.Maui.Tizen.sln b/._Microsoft.Maui.Tizen.sln
similarity index 100%
rename from Microsoft.Maui.Tizen.sln
rename to ._Microsoft.Maui.Tizen.sln
diff --git a/.nuspec/Microsoft.Maui.Controls.MultiTargeting.targets b/.nuspec/Microsoft.Maui.Controls.MultiTargeting.targets
index 8e951e68f47c..b054a53e4ccd 100644
--- a/.nuspec/Microsoft.Maui.Controls.MultiTargeting.targets
+++ b/.nuspec/Microsoft.Maui.Controls.MultiTargeting.targets
@@ -31,9 +31,9 @@
-
+
-
+
diff --git a/src/Controls/src/Core/Platform/Tizen/DragGestureHandler.cs b/src/Controls/src/Core/Platform/Tizen/DragGestureHandler.cs
index eceef1d84191..7ff6dd73274a 100644
--- a/src/Controls/src/Core/Platform/Tizen/DragGestureHandler.cs
+++ b/src/Controls/src/Core/Platform/Tizen/DragGestureHandler.cs
@@ -177,7 +177,7 @@ async Task GetImageIconAsync(EvasObject parent)
var services = Handler.MauiContext?.Services;
var provider = services.GetService(typeof(IImageSourceServiceProvider)) as IImageSourceServiceProvider;
var service = provider?.GetImageSourceService(mImage);
- var result = await service.LoadImageAsync(mImage, image);
+ var result = await service.GetImageAsync(mImage, image);
if (result == null)
return null;
return image;
diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs b/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs
index 613e9e7045ce..b95a278daa12 100644
--- a/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs
+++ b/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs
@@ -447,7 +447,7 @@ EToolbarItem AppendTabsItem(string text, ImageSource iconSource)
var provider = MauiContext.Services.GetRequiredService();
var service = provider.GetRequiredImageSourceService(iconSource);
- _ = service.LoadImageAsync(iconSource, image);
+ _ = service.GetImageAsync(iconSource, image);
item.SetIconPart(image);
}
diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs b/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs
index 92f3c5b8e6f9..bc0e27c5077c 100644
--- a/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs
+++ b/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs
@@ -265,7 +265,7 @@ async void UpdateMenuIcon()
var provider = MauiContext.Services.GetRequiredService();
var service = provider.GetRequiredImageSourceService(source);
- await service.LoadImageAsync(source, _menuIcon);
+ await service.GetImageAsync(source, _menuIcon);
}
_menuButton.SetIconPart(_menuIcon);
_menuButton.Show();
diff --git a/src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs b/src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs
deleted file mode 100644
index 630fd3fdc49c..000000000000
--- a/src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-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/Button/ButtonHandler.Tizen.cs b/src/Core/src/Handlers/Button/ButtonHandler.Tizen.cs
index 5f7ac9c8e270..2873777a351b 100644
--- a/src/Core/src/Handlers/Button/ButtonHandler.Tizen.cs
+++ b/src/Core/src/Handlers/Button/ButtonHandler.Tizen.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Tizen.UIExtensions.ElmSharp;
namespace Microsoft.Maui.Handlers
@@ -17,7 +18,6 @@ protected override void ConnectHandler(Button nativeView)
nativeView.Released += OnButtonClicked;
nativeView.Clicked += OnButtonReleased;
nativeView.Pressed += OnButtonPressed;
-
base.ConnectHandler(nativeView);
}
@@ -26,32 +26,40 @@ protected override void DisconnectHandler(Button nativeView)
nativeView.Released -= OnButtonClicked;
nativeView.Clicked -= OnButtonReleased;
nativeView.Pressed -= OnButtonPressed;
-
base.DisconnectHandler(nativeView);
}
- public static void MapText(ButtonHandler handler, IButton button)
+ public static void MapText(IButtonHandler handler, IText button)
{
- handler.NativeView?.UpdateText(button);
+ handler.TypedNativeView?.UpdateText(button);
}
- public static void MapTextColor(ButtonHandler handler, IButton button)
+ public static void MapTextColor(IButtonHandler handler, ITextStyle button)
{
- handler.NativeView?.UpdateTextColor(button);
+ handler.TypedNativeView?.UpdateTextColor(button);
}
- //TODO : Need to impl
- [MissingMapper]
- public static void MapImageSource(ButtonHandler handler, IButton image) { }
+ public static void MapImageSource(IButtonHandler handler, IButton image) =>
+ MapImageSourceAsync(handler, image).FireAndForget(handler);
+
+ public static Task MapImageSourceAsync(IButtonHandler handler, IButton image)
+ {
+ if (image.ImageSource == null)
+ {
+ return Task.CompletedTask;
+ }
+
+ return handler.ImageSourceLoader.UpdateImageSourceAsync();
+ }
[MissingMapper]
- public static void MapCharacterSpacing(ButtonHandler handler, IButton button) { }
+ public static void MapCharacterSpacing(IButtonHandler handler, ITextStyle button) { }
[MissingMapper]
- public static void MapFont(ButtonHandler handler, IButton button) { }
+ public static void MapFont(IButtonHandler handler, ITextStyle button) { }
[MissingMapper]
- public static void MapPadding(ButtonHandler handler, IButton button) { }
+ public static void MapPadding(IButtonHandler handler, IButton button) { }
void OnButtonClicked(object? sender, EventArgs e)
{
@@ -67,5 +75,11 @@ void OnButtonPressed(object? sender, EventArgs e)
{
VirtualView?.Pressed();
}
+
+ void OnSetImageSource(Image? image)
+ {
+ NativeView.Image = image;
+ VirtualView.ImageSourceLoaded();
+ }
}
}
\ No newline at end of file
diff --git a/src/Core/src/Handlers/Button/ButtonHandler.cs b/src/Core/src/Handlers/Button/ButtonHandler.cs
index 580ee477d8be..5c7ad15a788b 100644
--- a/src/Core/src/Handlers/Button/ButtonHandler.cs
+++ b/src/Core/src/Handlers/Button/ButtonHandler.cs
@@ -4,7 +4,9 @@
using PlatformView = Google.Android.Material.Button.MaterialButton;
#elif WINDOWS
using PlatformView = Microsoft.UI.Xaml.Controls.Button;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
+#elif TIZEN
+using PlatformView = Tizen.UIExtensions.ElmSharp.Button;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformView = System.Object;
#endif
diff --git a/src/Core/src/Handlers/Button/IButtonHandler.cs b/src/Core/src/Handlers/Button/IButtonHandler.cs
index 7c097ad3ac60..94e7159156a7 100644
--- a/src/Core/src/Handlers/Button/IButtonHandler.cs
+++ b/src/Core/src/Handlers/Button/IButtonHandler.cs
@@ -4,7 +4,9 @@
using PlatformView = Google.Android.Material.Button.MaterialButton;
#elif WINDOWS
using PlatformView = Microsoft.UI.Xaml.Controls.Button;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
+#elif TIZEN
+using PlatformView = Tizen.UIExtensions.ElmSharp.Button;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformView = System.Object;
#endif
@@ -16,4 +18,4 @@ public partial interface IButtonHandler : IViewHandler
new PlatformView PlatformView { get; }
ImageSourcePartLoader ImageSourceLoader { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Core/src/Handlers/Image/IImageHandler.cs b/src/Core/src/Handlers/Image/IImageHandler.cs
index fae4c2a528d7..fbaddcd8a656 100644
--- a/src/Core/src/Handlers/Image/IImageHandler.cs
+++ b/src/Core/src/Handlers/Image/IImageHandler.cs
@@ -4,7 +4,9 @@
using PlatformView = Android.Widget.ImageView;
#elif WINDOWS
using PlatformView = Microsoft.UI.Xaml.Controls.Image;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
+#elif TIZEN
+using PlatformView = Tizen.UIExtensions.ElmSharp.Image;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformView = System.Object;
#endif
diff --git a/src/Core/src/Handlers/Image/ImageHandler.Tizen.cs b/src/Core/src/Handlers/Image/ImageHandler.Tizen.cs
index 0073c5dbe7eb..ba8ee99c662e 100644
--- a/src/Core/src/Handlers/Image/ImageHandler.Tizen.cs
+++ b/src/Core/src/Handlers/Image/ImageHandler.Tizen.cs
@@ -18,7 +18,7 @@ protected override Image CreateNativeView()
protected override void DisconnectHandler(Image nativeView)
{
base.DisconnectHandler(nativeView);
- _sourceManager.Reset();
+ SourceLoader.Reset();
}
public override bool NeedsContainer =>
@@ -26,32 +26,38 @@ protected override void DisconnectHandler(Image nativeView)
VirtualView?.Clip != null ||
base.NeedsContainer;
- public static void MapBackground(ImageHandler handler, IImage image)
+ public static void MapBackground(IImageHandler handler, IImage image)
{
handler.UpdateValue(nameof(IViewHandler.ContainerView));
handler.GetWrappedNativeView()?.UpdateBackground(image);
}
- public static void MapAspect(ImageHandler handler, IImage image) =>
- handler.NativeView?.UpdateAspect(image);
+ public static void MapAspect(IImageHandler handler, IImage image) =>
+ handler.TypedNativeView?.UpdateAspect(image);
- public static void MapIsAnimationPlaying(ImageHandler handler, IImage image) =>
- handler.NativeView?.UpdateIsAnimationPlaying(image);
+ public static void MapIsAnimationPlaying(IImageHandler handler, IImage image) =>
+ handler.TypedNativeView?.UpdateIsAnimationPlaying(image);
- public static void MapSource(ImageHandler handler, IImage image) =>
+ public static void MapSource(IImageHandler handler, IImage image) =>
MapSourceAsync(handler, image).FireAndForget(handler);
- public static async Task MapSourceAsync(ImageHandler handler, IImage image)
+ public static async Task MapSourceAsync(IImageHandler handler, IImage image)
{
if (handler.NativeView == null)
return;
- var token = handler._sourceManager.BeginLoad();
+ // TODO : fix it later
+ //return handler.SourceLoader.UpdateImageSourceAsync();
+ var token = handler.SourceLoader.SourceManager.BeginLoad();
var provider = handler.GetRequiredService();
- var result = await handler.NativeView.UpdateSourceAsync(image, provider, token);
+ var result = await handler.TypedNativeView.UpdateSourceAsync(image, provider, token);
+ handler.SourceLoader.SourceManager.CompleteLoad(result);
+ }
- handler._sourceManager.CompleteLoad(result);
+ void OnSetImageSource(Image? obj)
+ {
+ //Empty on purpose
}
}
diff --git a/src/Core/src/Handlers/Image/ImageHandler.cs b/src/Core/src/Handlers/Image/ImageHandler.cs
index e48a9fdbe079..f33d6b728533 100644
--- a/src/Core/src/Handlers/Image/ImageHandler.cs
+++ b/src/Core/src/Handlers/Image/ImageHandler.cs
@@ -6,7 +6,9 @@
using PlatformView = Android.Widget.ImageView;
#elif WINDOWS
using PlatformView = Microsoft.UI.Xaml.Controls.Image;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
+#elif TIZEN
+using PlatformView = Tizen.UIExtensions.ElmSharp.Image;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformView = System.Object;
#endif
@@ -16,7 +18,7 @@ public partial class ImageHandler : IImageHandler
{
public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper)
{
-#if __ANDROID__ || WINDOWS
+#if __ANDROID__ || WINDOWS || TIZEN
[nameof(IImage.Background)] = MapBackground,
#endif
[nameof(IImage.Aspect)] = MapAspect,
@@ -46,4 +48,4 @@ public ImageHandler(IPropertyMapper mapper) : base(mapper ?? Mapper)
PlatformView IImageHandler.PlatformView => PlatformView;
}
-}
\ No newline at end of file
+}
diff --git a/src/Core/src/Handlers/ImageButton/ImageButtonHandler.Tizen.cs b/src/Core/src/Handlers/ImageButton/ImageButtonHandler.Tizen.cs
new file mode 100644
index 000000000000..faf12900a4b3
--- /dev/null
+++ b/src/Core/src/Handlers/ImageButton/ImageButtonHandler.Tizen.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ElmSharp;
+using TImage = Tizen.UIExtensions.ElmSharp.Image;
+
+namespace Microsoft.Maui.Handlers
+{
+ //TODO: Need to impl
+ public partial class ImageButtonHandler : ViewHandler
+ {
+ protected override TImage CreateNativeView() => throw new NotImplementedException();
+
+ void OnSetImageSource(TImage? obj)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Core/src/Handlers/ImageButton/ImageButtonHandler.cs b/src/Core/src/Handlers/ImageButton/ImageButtonHandler.cs
index bf90c5e0ed4c..a311a6e97ab2 100644
--- a/src/Core/src/Handlers/ImageButton/ImageButtonHandler.cs
+++ b/src/Core/src/Handlers/ImageButton/ImageButtonHandler.cs
@@ -10,8 +10,12 @@
using System;
using PlatformImage = Microsoft.UI.Xaml.Media.ImageSource;
using PlatformImageView = Microsoft.UI.Xaml.Controls.Image;
-using PlatformView = Microsoft.UI.Xaml.Controls.Button;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
+using PlatformView = Microsoft.UI.Xaml.FrameworkElement;
+#elif TIZEN
+using PlatformImage = Tizen.UIExtensions.ElmSharp.Image;
+using PlatformView = Tizen.UIExtensions.ElmSharp.Image;
+using PlatformImageView = Tizen.UIExtensions.ElmSharp.Image;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformImage = System.Object;
using PlatformImageView = System.Object;
using PlatformView = System.Object;
@@ -67,4 +71,4 @@ public ImageButtonHandler(IPropertyMapper mapper) : base(mapper ?? Mapper)
ImageSourcePartLoader IImageHandler.SourceLoader => SourceLoader;
}
-}
\ No newline at end of file
+}
diff --git a/src/Core/src/Handlers/IndicatorView/IndicatorViewHandler.Tizen.cs b/src/Core/src/Handlers/IndicatorView/IndicatorViewHandler.Tizen.cs
new file mode 100644
index 000000000000..ed7fc53aa570
--- /dev/null
+++ b/src/Core/src/Handlers/IndicatorView/IndicatorViewHandler.Tizen.cs
@@ -0,0 +1,60 @@
+using System;
+using Tizen.UIExtensions.ElmSharp;
+
+namespace Microsoft.Maui.Handlers
+{
+ public partial class IndicatorViewHandler : ViewHandler
+ {
+ protected override IndicatorView CreateNativeView()
+ {
+ _ = NativeParent ?? throw new ArgumentNullException(nameof(NativeParent));
+ return new IndicatorView(NativeParent);
+ }
+
+ protected override void ConnectHandler(IndicatorView nativeView)
+ {
+ base.ConnectHandler(nativeView);
+ NativeView.SelectedPosition += OnSelectedPosition;
+ }
+
+ protected override void DisconnectHandler(IndicatorView nativeView)
+ {
+ base.DisconnectHandler(nativeView);
+ NativeView.SelectedPosition -= OnSelectedPosition;
+ }
+
+ public static void MapCount(IndicatorViewHandler handler, IIndicatorView indicator)
+ {
+ handler.NativeView.UpdateIndicatorCount(indicator);
+ }
+
+ public static void MapPosition(IndicatorViewHandler handler, IIndicatorView indicator)
+ {
+ handler.NativeView.UpdatePosition(indicator);
+ }
+
+ //TODO : Need to impl
+ [MissingMapper]
+ public static void MapHideSingle(IndicatorViewHandler handler, IIndicatorView indicator) { }
+
+ [MissingMapper]
+ public static void MapMaximumVisible(IndicatorViewHandler handler, IIndicatorView indicator) { }
+
+ [MissingMapper]
+ public static void MapIndicatorSize(IndicatorViewHandler handler, IIndicatorView indicator) { }
+
+ [MissingMapper]
+ public static void MapIndicatorColor(IndicatorViewHandler handler, IIndicatorView indicator) { }
+
+ [MissingMapper]
+ public static void MapSelectedIndicatorColor(IndicatorViewHandler handler, IIndicatorView indicator) { }
+
+ [MissingMapper]
+ public static void MapIndicatorShape(IndicatorViewHandler handler, IIndicatorView indicator) { }
+
+ void OnSelectedPosition(object? sender, SelectedPositionChangedEventArgs e)
+ {
+ VirtualView.Position = e.SelectedPosition;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Core/src/Handlers/NavigationPage/NavigationViewHandler.Tizen.cs b/src/Core/src/Handlers/NavigationPage/NavigationViewHandler.Tizen.cs
index 21a990f4dc48..6c9692d7caa0 100644
--- a/src/Core/src/Handlers/NavigationPage/NavigationViewHandler.Tizen.cs
+++ b/src/Core/src/Handlers/NavigationPage/NavigationViewHandler.Tizen.cs
@@ -13,7 +13,7 @@
namespace Microsoft.Maui.Handlers
{
- internal partial class NavigationViewHandler :
+ public partial class NavigationViewHandler :
ViewHandler, INativeViewHandler
{
readonly List _naviItemContentPartList = new List();
diff --git a/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Tizen.cs b/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Tizen.cs
index 0c545a8f94d2..ebcbb3d881d7 100644
--- a/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Tizen.cs
+++ b/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Tizen.cs
@@ -11,10 +11,10 @@ namespace Microsoft.Maui
{
public partial class FileImageSourceService
{
- public override Task?> LoadImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
- LoadImageAsync((IFileImageSource)imageSource, image, cancellationToken);
+ public override Task?> GetImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
+ GetImageAsync((IFileImageSource)imageSource, image, cancellationToken);
- public async Task?> LoadImageAsync(IFileImageSource imageSource, Image image, CancellationToken cancellationToken = default)
+ public async Task?> GetImageAsync(IFileImageSource imageSource, Image image, CancellationToken cancellationToken = default)
{
if (imageSource.IsEmpty)
return null;
@@ -24,17 +24,16 @@ public partial class FileImageSourceService
{
if (!string.IsNullOrEmpty(filename))
{
- var isLoadComplate = await image.LoadAsync(GetPath(filename), cancellationToken);
+ var isLoadComplated = await image.LoadAsync(GetPath(filename), cancellationToken);
- if (!isLoadComplate)
+ if (!isLoadComplated)
{
//If it fails, call the Load function to remove the previous image.
image.Load(string.Empty);
throw new InvalidOperationException("Unable to load image file.");
}
- var result = new ImageSourceServiceResult(isLoadComplate);
-
+ var result = new ImageSourceServiceResult(image, () => image.Unrealize());
return result;
}
else
diff --git a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Tizen.cs b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Tizen.cs
index 3c4fa95ac4b5..2ded0740a9bb 100644
--- a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Tizen.cs
+++ b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Tizen.cs
@@ -9,10 +9,10 @@ namespace Microsoft.Maui
{
public partial class FontImageSourceService
{
- public override Task?> LoadImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
- LoadImageAsync((IFontImageSource)imageSource, image, cancellationToken);
+ public override Task?> GetImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
+ GetImageAsync((IFontImageSource)imageSource, image, cancellationToken);
- public async Task?> LoadImageAsync(IFontImageSource imageSource, Image image, CancellationToken cancellationToken = default)
+ public async Task?> GetImageAsync(IFontImageSource imageSource, Image image, CancellationToken cancellationToken = default)
{
if (imageSource.IsEmpty)
return null;
@@ -20,15 +20,14 @@ public partial class FontImageSourceService
try
{
//TODO : Fix me correctly later.
- var isLoadComplate = await image.LoadAsync(string.Empty, cancellationToken);
+ var isLoadComplated = await image.LoadAsync(string.Empty, cancellationToken);
- if (!isLoadComplate)
+ if (!isLoadComplated)
{
throw new InvalidOperationException("Unable to load image file.");
}
- var result = new ImageSourceServiceResult(isLoadComplate);
-
+ var result = new ImageSourceServiceResult(image, () => image.Unrealize());
return result;
}
catch (Exception ex)
diff --git a/src/Core/src/ImageSources/IImageSourceService.cs b/src/Core/src/ImageSources/IImageSourceService.cs
index 529617ae598c..51a4fc4fb45a 100644
--- a/src/Core/src/ImageSources/IImageSourceService.cs
+++ b/src/Core/src/ImageSources/IImageSourceService.cs
@@ -22,7 +22,7 @@ public interface IImageSourceService
float scale = 1,
CancellationToken cancellationToken = default);
#elif TIZEN || __TIZEN__
- Task?> LoadImageAsync(
+ Task?> GetImageAsync(
IImageSource imageSource,
Tizen.UIExtensions.ElmSharp.Image image,
CancellationToken cancellationToken = default);
diff --git a/src/Core/src/ImageSources/ImageSourceExtensions.cs b/src/Core/src/ImageSources/ImageSourceExtensions.cs
index da67d1ecd68c..44d0be82b2a8 100644
--- a/src/Core/src/ImageSources/ImageSourceExtensions.cs
+++ b/src/Core/src/ImageSources/ImageSourceExtensions.cs
@@ -10,7 +10,9 @@
using PlatformImage = Android.Graphics.Drawables.Drawable;
#elif WINDOWS
using PlatformImage = Microsoft.UI.Xaml.Media.ImageSource;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
+#elif TIZEN
+using PlatformImage = Tizen.UIExtensions.ElmSharp.Image;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformImage = System.Object;
#endif
@@ -52,6 +54,9 @@ static async Task LoadImageResult(Task?
return imageSourceService.GetDrawableAsync(imageSource, mauiContext.Context!);
#elif WINDOWS
return imageSourceService.GetImageSourceAsync(imageSource);
+#elif TIZEN
+ var nativeImage = new NativeImage(mauiContext.Context!.NativeParent!);
+ return imageSourceService.GetImageAsync(imageSource, nativeImage);
#else
throw new NotImplementedException();
#endif
diff --git a/src/Core/src/ImageSources/ImageSourceService.cs b/src/Core/src/ImageSources/ImageSourceService.cs
index 3e3e71fe076e..c79d0fe76867 100644
--- a/src/Core/src/ImageSources/ImageSourceService.cs
+++ b/src/Core/src/ImageSources/ImageSourceService.cs
@@ -48,7 +48,7 @@ public ImageSourceService(ILogger? logger = null)
float scale = 1,
CancellationToken cancellationToken = default);
#elif TIZEN || __TIZEN__
- public abstract Task?> LoadImageAsync(
+ public abstract Task?> GetImageAsync(
IImageSource imageSource,
Tizen.UIExtensions.ElmSharp.Image image,
CancellationToken cancellationToken = default);
diff --git a/src/Core/src/ImageSources/ImageSourceServiceResult.cs b/src/Core/src/ImageSources/ImageSourceServiceResult.cs
index fd54df50ed69..f85a6ec541f0 100644
--- a/src/Core/src/ImageSources/ImageSourceServiceResult.cs
+++ b/src/Core/src/ImageSources/ImageSourceServiceResult.cs
@@ -6,7 +6,9 @@
using PlatformView = Android.Graphics.Drawables.Drawable;
#elif WINDOWS
using PlatformView = Microsoft.UI.Xaml.Media.ImageSource;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
+#elif TIZEN
+using PlatformView = Tizen.UIExtensions.ElmSharp.Image;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformView = System.Object;
#endif
diff --git a/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs b/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs
index dc5047021045..8898426defd8 100644
--- a/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs
+++ b/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs
@@ -9,10 +9,10 @@ namespace Microsoft.Maui
{
public partial class StreamImageSourceService
{
- public override Task?> LoadImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
- LoadImageAsync((IStreamImageSource)imageSource, image, cancellationToken);
+ public override Task?> GetImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
+ GetImageAsync((IStreamImageSource)imageSource, image, cancellationToken);
- public async Task?> LoadImageAsync(IStreamImageSource imageSource, Image image, CancellationToken cancellationToken = default)
+ public async Task?> GetImageAsync(IStreamImageSource imageSource, Image image, CancellationToken cancellationToken = default)
{
if (imageSource.IsEmpty)
return null;
@@ -24,12 +24,12 @@ public partial class StreamImageSourceService
if (stream == null)
throw new InvalidOperationException("Unable to load image stream.");
- var result = await image.LoadAsync(stream, cancellationToken);
+ var isLoadComplated = await image.LoadAsync(stream, cancellationToken);
- if (!result)
+ if (!isLoadComplated)
throw new InvalidOperationException("Unable to decode image from stream.");
- return new ImageSourceServiceResult(result);
+ return new ImageSourceServiceResult(image, () => image.Unrealize());
}
catch (Exception ex)
{
diff --git a/src/Core/src/ImageSources/Tizen/ImageSourceServiceResult.cs b/src/Core/src/ImageSources/Tizen/ImageSourceServiceResult.cs
deleted file mode 100644
index 6e48ceaec7c1..000000000000
--- a/src/Core/src/ImageSources/Tizen/ImageSourceServiceResult.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#nullable enable
-using System;
-
-namespace Microsoft.Maui
-{
- public class ImageSourceServiceResult : IImageSourceServiceResult
- {
- Action? _dispose;
-
- public ImageSourceServiceResult(bool result, Action? dispose = null)
- : this(result, false, dispose)
- {
- }
-
- public ImageSourceServiceResult(bool result, bool resolutionDependent, Action? dispose = null)
- {
- Value = result;
- IsResolutionDependent = resolutionDependent;
- _dispose = dispose;
- }
-
- public bool Value { get; }
-
- public bool IsResolutionDependent { get; }
-
- public bool IsDisposed { get; private set; }
-
- public void Dispose()
- {
- if (IsDisposed)
- return;
-
- IsDisposed = true;
-
- _dispose?.Invoke();
- _dispose = null;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.Tizen.cs b/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.Tizen.cs
index 32a588c1ea2d..36a7bdccf2c5 100644
--- a/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.Tizen.cs
+++ b/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.Tizen.cs
@@ -9,10 +9,10 @@ namespace Microsoft.Maui
{
public partial class UriImageSourceService
{
- public override Task?> LoadImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
- LoadImageAsync((IUriImageSource)imageSource, image, cancellationToken);
+ public override Task?> GetImageAsync(IImageSource imageSource, Image image, CancellationToken cancellationToken = default) =>
+ GetImageAsync((IUriImageSource)imageSource, image, cancellationToken);
- public async Task?> LoadImageAsync(IUriImageSource imageSource, Image image, CancellationToken cancellationToken = default)
+ public async Task?> GetImageAsync(IUriImageSource imageSource, Image image, CancellationToken cancellationToken = default)
{
if (imageSource.IsEmpty)
return null;
@@ -21,12 +21,12 @@ public partial class UriImageSourceService
try
{
- var result = await image.LoadAsync(uri, cancellationToken);
+ var isLoadComplated = await image.LoadAsync(uri, cancellationToken);
- if (!result)
+ if (!isLoadComplated)
throw new InvalidOperationException($"Unable to load image URI '{uri}'.");
- return new ImageSourceServiceResult(result);
+ return new ImageSourceServiceResult(image, () => image.Unrealize());
}
catch (Exception ex)
{
diff --git a/src/Core/src/Platform/ImageSourcePartLoader.cs b/src/Core/src/Platform/ImageSourcePartLoader.cs
index 8cb4c404ce01..84e612236654 100644
--- a/src/Core/src/Platform/ImageSourcePartLoader.cs
+++ b/src/Core/src/Platform/ImageSourcePartLoader.cs
@@ -11,9 +11,12 @@
#elif WINDOWS
using PlatformImage = Microsoft.UI.Xaml.Media.ImageSource;
using PlatformView = Microsoft.UI.Xaml.FrameworkElement;
-#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID)
-using PlatformView = System.Object;
+#elif TIZEN
+using PlatformImage = Tizen.UIExtensions.ElmSharp.Image;
+using PlatformView = Tizen.UIExtensions.ElmSharp.Image;
+#elif NETSTANDARD || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformImage = System.Object;
+using PlatformView = System.Object;
#endif
namespace Microsoft.Maui.Platform
@@ -56,7 +59,7 @@ public async Task UpdateImageSourceAsync()
if (imageSource != null)
{
-#if IOS || ANDROID || WINDOWS
+#if IOS || ANDROID || WINDOWS || TIZEN
var result = await imageSource.UpdateSourceAsync(PlatformView, ImageSourceServiceProvider, SetImage!, token)
.ConfigureAwait(false);
diff --git a/src/Core/src/Platform/Tizen/BoxViewExtensions.cs b/src/Core/src/Platform/Tizen/BoxViewExtensions.cs
deleted file mode 100644
index 1c450ddd290b..000000000000
--- a/src/Core/src/Platform/Tizen/BoxViewExtensions.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-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/ButtonExtensions.cs b/src/Core/src/Platform/Tizen/ButtonExtensions.cs
index a64a5df690db..c517ae04a492 100644
--- a/src/Core/src/Platform/Tizen/ButtonExtensions.cs
+++ b/src/Core/src/Platform/Tizen/ButtonExtensions.cs
@@ -4,12 +4,12 @@ namespace Microsoft.Maui
{
public static class ButtonExtensions
{
- public static void UpdateTextColor(this Button nativeButton, IButton button)
+ public static void UpdateTextColor(this Button nativeButton, ITextStyle button)
{
nativeButton.TextColor = button.TextColor.ToNative();
}
- public static void UpdateText(this Button nativeButton, IButton button)
+ public static void UpdateText(this Button nativeButton, IText button)
{
nativeButton.Text = button.Text ?? "";
}
diff --git a/src/Core/src/Platform/Tizen/ImageExtensions.cs b/src/Core/src/Platform/Tizen/ImageExtensions.cs
index e485c12abb63..bec10e6f2a5c 100644
--- a/src/Core/src/Platform/Tizen/ImageExtensions.cs
+++ b/src/Core/src/Platform/Tizen/ImageExtensions.cs
@@ -22,7 +22,7 @@ public static void UpdateIsAnimationPlaying(this Image nativeImage, IImageSource
nativeImage.IsAnimationPlaying = image.IsAnimationPlaying;
}
- public static async Task?> UpdateSourceAsync(this Image nativeImage, IImageSourcePart image, IImageSourceServiceProvider services, CancellationToken cancellationToken = default)
+ public static async Task?> UpdateSourceAsync(this Image nativeImage, IImageSourcePart image, IImageSourceServiceProvider services, CancellationToken cancellationToken = default)
{
nativeImage.Clear();
@@ -40,10 +40,10 @@ public static void UpdateIsAnimationPlaying(this Image nativeImage, IImageSource
try
{
var service = services.GetRequiredImageSourceService(imageSource);
- var result = await service.LoadImageAsync(imageSource, nativeImage, cancellationToken);
- var isLoaded = result?.Value;
+ var result = await service.GetImageAsync(imageSource, nativeImage, cancellationToken);
+ var isLoaded = result != null;
- var applied = !cancellationToken.IsCancellationRequested && isLoaded == true && imageSource == image.Source;
+ var applied = !cancellationToken.IsCancellationRequested && isLoaded && imageSource == image.Source;
// only set the image if we are still on the same one
if (applied)
@@ -75,5 +75,58 @@ public static void UpdateIsAnimationPlaying(this Image nativeImage, IImageSource
return null;
}
+
+ public static async Task?> UpdateSourceAsync(this IImageSourcePart image, Image destinationContext, IImageSourceServiceProvider services, Action setImage, CancellationToken cancellationToken = default)
+ {
+ image.UpdateIsLoading(false);
+
+ var imageSource = image.Source;
+ if (imageSource == null)
+ return null;
+
+ var events = image as IImageSourcePartEvents;
+
+ events?.LoadingStarted();
+ image.UpdateIsLoading(true);
+
+ try
+ {
+ var service = services.GetRequiredImageSourceService(imageSource);
+ var result = await service.GetImageAsync(imageSource, destinationContext, cancellationToken);
+ var tImage = result?.Value;
+
+ var applied = !cancellationToken.IsCancellationRequested && tImage != null && imageSource == image.Source;
+
+ // only set the image if we are still on the same one
+ if (applied)
+ {
+ setImage.Invoke(tImage);
+ destinationContext.UpdateIsAnimationPlaying(image);
+ }
+
+ events?.LoadingCompleted(applied);
+
+ return result;
+ }
+ catch (OperationCanceledException)
+ {
+ // no-op
+ events?.LoadingCompleted(false);
+ }
+ catch (Exception ex)
+ {
+ events?.LoadingFailed(ex);
+ }
+ finally
+ {
+ // only mark as finished if we are still working on the same image
+ if (imageSource == image.Source)
+ {
+ image.UpdateIsLoading(false);
+ }
+ }
+
+ return null;
+ }
}
}
diff --git a/src/Core/src/Platform/Tizen/MauiIndicatorViewExtensions.cs b/src/Core/src/Platform/Tizen/MauiIndicatorViewExtensions.cs
new file mode 100644
index 000000000000..a221a9beb46c
--- /dev/null
+++ b/src/Core/src/Platform/Tizen/MauiIndicatorViewExtensions.cs
@@ -0,0 +1,20 @@
+using Tizen.UIExtensions.ElmSharp;
+
+namespace Microsoft.Maui
+{
+ public static class MauiIndicatorViewExtensions
+ {
+ public static void UpdateIndicatorCount(this IndicatorView nativeView, IIndicatorView indicator)
+ {
+ nativeView.ClearIndex();
+ nativeView.AppendIndex(indicator.Count);
+ nativeView.Update(0);
+ nativeView.UpdatePosition(indicator);
+ }
+
+ public static void UpdatePosition(this IndicatorView nativeView, IIndicatorView indicator)
+ {
+ nativeView.UpdateSelectedIndex(indicator.Position);
+ }
+ }
+}
diff --git a/src/Core/src/Platform/Tizen/ViewExtensions.cs b/src/Core/src/Platform/Tizen/ViewExtensions.cs
index cc399ed7294d..b7f400f0efb3 100644
--- a/src/Core/src/Platform/Tizen/ViewExtensions.cs
+++ b/src/Core/src/Platform/Tizen/ViewExtensions.cs
@@ -67,6 +67,12 @@ public static void UpdateClip(this EvasObject nativeView, IView view)
wrapper.Clip = view.Clip;
}
+ public static void UpdateShadow(this EvasObject nativeView, IView view)
+ {
+ if (nativeView is WrapperView wrapper)
+ wrapper.Shadow = view.Shadow;
+ }
+
public static void UpdateAutomationId(this EvasObject nativeView, IView view)
{
{