Skip to content

Commit

Permalink
Bump to latest (rc1)
Browse files Browse the repository at this point in the history
- ImageButtonHandler and Handler Re-usability (dotnet#2352)
- Remove IBoxView (dotnet#2619)
- Add SupportedOSPlatformVersion (dotnet#2565)
- Merge all the .NET 6 projects/solutions (dotnet#2505)
- Shadow Support (dotnet#570)
- Add IndicatorView handler(dotnet#2038)
  • Loading branch information
rookiejava committed Apr 11, 2022
1 parent 04c9445 commit 8a77e8c
Show file tree
Hide file tree
Showing 31 changed files with 276 additions and 154 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .nuspec/Microsoft.Maui.Controls.MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('tizen')) != true AND $(TargetFramework.StartsWith('net6.0-tizen')) != true ">
<Compile Remove="**\**\*.Tizen.cs" />
<None Include="**\**\*.Tizen.cs" />
<None Include="**\**\*.Tizen.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\Tizen\**\*.cs" />
<None Include="**\Tizen\**\*.cs" />
<None Include="**\Tizen\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="'$(_MauiNoTargetPlatform)' != 'True'">
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) != true AND '$(TargetFramework)' != 'net6.0'">
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Platform/Tizen/DragGestureHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async Task<EvasObject> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ EToolbarItem AppendTabsItem(string text, ImageSource iconSource)
var provider = MauiContext.Services.GetRequiredService<IImageSourceServiceProvider>();
var service = provider.GetRequiredImageSourceService(iconSource);

_ = service.LoadImageAsync(iconSource, image);
_ = service.GetImageAsync(iconSource, image);

item.SetIconPart(image);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ async void UpdateMenuIcon()
var provider = MauiContext.Services.GetRequiredService<IImageSourceServiceProvider>();
var service = provider.GetRequiredImageSourceService(source);

await service.LoadImageAsync(source, _menuIcon);
await service.GetImageAsync(source, _menuIcon);
}
_menuButton.SetIconPart(_menuIcon);
_menuButton.Show();
Expand Down
25 changes: 0 additions & 25 deletions src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs

This file was deleted.

38 changes: 26 additions & 12 deletions src/Core/src/Handlers/Button/ButtonHandler.Tizen.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading.Tasks;
using Tizen.UIExtensions.ElmSharp;

namespace Microsoft.Maui.Handlers
Expand All @@ -17,7 +18,6 @@ protected override void ConnectHandler(Button nativeView)
nativeView.Released += OnButtonClicked;
nativeView.Clicked += OnButtonReleased;
nativeView.Pressed += OnButtonPressed;

base.ConnectHandler(nativeView);
}

Expand All @@ -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)
{
Expand All @@ -67,5 +75,11 @@ void OnButtonPressed(object? sender, EventArgs e)
{
VirtualView?.Pressed();
}

void OnSetImageSource(Image? image)
{
NativeView.Image = image;
VirtualView.ImageSourceLoaded();
}
}
}
4 changes: 3 additions & 1 deletion src/Core/src/Handlers/Button/ButtonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions src/Core/src/Handlers/Button/IButtonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -16,4 +18,4 @@ public partial interface IButtonHandler : IViewHandler
new PlatformView PlatformView { get; }
ImageSourcePartLoader ImageSourceLoader { get; }
}
}
}
4 changes: 3 additions & 1 deletion src/Core/src/Handlers/Image/IImageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 17 additions & 11 deletions src/Core/src/Handlers/Image/ImageHandler.Tizen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,46 @@ protected override Image CreateNativeView()
protected override void DisconnectHandler(Image nativeView)
{
base.DisconnectHandler(nativeView);
_sourceManager.Reset();
SourceLoader.Reset();
}

public override bool NeedsContainer =>
VirtualView?.Background != null ||
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<IImageSourceServiceProvider>();
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
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/Core/src/Handlers/Image/ImageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -16,7 +18,7 @@ public partial class ImageHandler : IImageHandler
{
public static IPropertyMapper<IImage, IImageHandler> Mapper = new PropertyMapper<IImage, IImageHandler>(ViewHandler.ViewMapper)
{
#if __ANDROID__ || WINDOWS
#if __ANDROID__ || WINDOWS || TIZEN
[nameof(IImage.Background)] = MapBackground,
#endif
[nameof(IImage.Aspect)] = MapAspect,
Expand Down Expand Up @@ -46,4 +48,4 @@ public ImageHandler(IPropertyMapper mapper) : base(mapper ?? Mapper)

PlatformView IImageHandler.PlatformView => PlatformView;
}
}
}
19 changes: 19 additions & 0 deletions src/Core/src/Handlers/ImageButton/ImageButtonHandler.Tizen.cs
Original file line number Diff line number Diff line change
@@ -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<IImageButton, TImage>
{
protected override TImage CreateNativeView() => throw new NotImplementedException();

void OnSetImageSource(TImage? obj)
{
throw new NotImplementedException();
}
}
}
10 changes: 7 additions & 3 deletions src/Core/src/Handlers/ImageButton/ImageButtonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -67,4 +71,4 @@ public ImageButtonHandler(IPropertyMapper mapper) : base(mapper ?? Mapper)

ImageSourcePartLoader IImageHandler.SourceLoader => SourceLoader;
}
}
}
60 changes: 60 additions & 0 deletions src/Core/src/Handlers/IndicatorView/IndicatorViewHandler.Tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using Tizen.UIExtensions.ElmSharp;

namespace Microsoft.Maui.Handlers
{
public partial class IndicatorViewHandler : ViewHandler<IIndicatorView, IndicatorView>
{
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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Microsoft.Maui.Handlers
{
internal partial class NavigationViewHandler :
public partial class NavigationViewHandler :
ViewHandler<INavigationView, Naviframe>, INativeViewHandler
{
readonly List<Widget> _naviItemContentPartList = new List<Widget>();
Expand Down
Loading

0 comments on commit 8a77e8c

Please sign in to comment.