From f6d3bedee8cfe6c5359bc3f25b5c183b7dad0cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=8A=B9=EA=B7=BC/Common=20Platform=20Lab=28SR?= =?UTF-8?q?=29/Staff=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 12 Jul 2021 18:55:32 +0900 Subject: [PATCH] Fix RefreshView related issue (#51) * Fix RefreshView related issue * Fix StreamImageSourceService.Tizen --- .../Core/src/RendererToHandlerShim.Tizen.cs | 1 + .../Tizen/Renderers/RefreshViewRenderer.cs | 19 +++++++++---------- .../Core/src/Tizen/ThemeConstants.cs | 14 +++++++------- .../StreamImageSourceService.Tizen.cs | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Compatibility/Core/src/RendererToHandlerShim.Tizen.cs b/src/Compatibility/Core/src/RendererToHandlerShim.Tizen.cs index af6ee8f02603..953af2747f41 100644 --- a/src/Compatibility/Core/src/RendererToHandlerShim.Tizen.cs +++ b/src/Compatibility/Core/src/RendererToHandlerShim.Tizen.cs @@ -45,6 +45,7 @@ protected override void Dispose(bool disposing) if (disposing) { VisualElementRenderer?.Dispose(); + VisualElementRenderer = null; } base.Dispose(disposing); } diff --git a/src/Compatibility/Core/src/Tizen/Renderers/RefreshViewRenderer.cs b/src/Compatibility/Core/src/Tizen/Renderers/RefreshViewRenderer.cs index c448962f6fd8..dbc32dbf4917 100644 --- a/src/Compatibility/Core/src/Tizen/Renderers/RefreshViewRenderer.cs +++ b/src/Compatibility/Core/src/Tizen/Renderers/RefreshViewRenderer.cs @@ -11,7 +11,7 @@ namespace Microsoft.Maui.Controls.Compatibility.Platform.Tizen { - class RefreshIcon : ContentView + class RefreshIcon : AbsoluteLayout { public const int IconSize = ThemeConstants.RefreshView.Resources.IconSize; static readonly Color DefaultColor = ThemeConstants.RefreshView.ColorClass.DefaultColor; @@ -24,15 +24,10 @@ public RefreshIcon() { HeightRequest = IconSize; WidthRequest = IconSize; - var layout = new AbsoluteLayout() - { - HeightRequest = IconSize, - WidthRequest = IconSize, - }; - layout.Children.Add(new BoxView + Children.Add(new BoxView { - Color = Color.FromRgb(255, 255, 255), + Color = Color.FromRgb(200, 200, 200), CornerRadius = new CornerRadius(IconSize), }, new Rectangle(0.5, 0.5, IconSize, IconSize), AbsoluteLayoutFlags.PositionProportional); @@ -41,8 +36,7 @@ public RefreshIcon() Source = ImageSource.FromResource(IconPath, typeof(ShellItemRenderer).Assembly), }; - layout.Children.Add(_icon, new Rectangle(0.5, 0.5, IconSize - 8, IconSize - 8), AbsoluteLayoutFlags.PositionProportional); - Content = layout; + Children.Add(_icon, new Rectangle(0.5, 0.5, IconSize - 8, IconSize - 8), AbsoluteLayoutFlags.PositionProportional); IconColor = DefaultColor; } @@ -109,6 +103,10 @@ public RefreshLayout() Opacity = 0.5, }; Children.Add(RefreshIcon); + Children.Add(new BoxView + { + HeightRequest = 200 + }); } RefreshIcon RefreshIcon { get; set; } @@ -202,6 +200,7 @@ void Initialize() void UpdateRefreshLayout() { _refreshLayout = new RefreshLayout(); + _refreshLayout.Parent = Element; _refreshLayout.RefreshIconColor = RefreshView.RefreshColor; _refreshLayoutRenderer = Platform.GetOrCreateRenderer(_refreshLayout); (_refreshLayoutRenderer as ILayoutRenderer).RegisterOnLayoutUpdated(); diff --git a/src/Compatibility/Core/src/Tizen/ThemeConstants.cs b/src/Compatibility/Core/src/Tizen/ThemeConstants.cs index 18c47ae7656c..ea70d5e2c7ca 100644 --- a/src/Compatibility/Core/src/Tizen/ThemeConstants.cs +++ b/src/Compatibility/Core/src/Tizen/ThemeConstants.cs @@ -517,7 +517,7 @@ public class RefreshView public class Resources { public const int IconSize = 48; - public const string IconPath = "Microsoft.Maui.Controls.Compatibility.Resource.refresh_48dp.png"; + public const string IconPath = "Microsoft.Maui.Controls.Compatibility.Tizen.Resources.refresh_48dp.png"; } public class ColorClass @@ -566,16 +566,16 @@ public class Shell public class Resources { // The source of icon resources is https://materialdesignicons.com/ - public const string MenuIcon = "Resource.menu.png"; - public const string BackIcon = "Resource.arrow_left.png"; - public const string DotsIcon = "Resource.dots_horizontal.png"; + public const string MenuIcon = "Resources.menu.png"; + public const string BackIcon = "Resources.arrow_left.png"; + public const string DotsIcon = "Resources.dots_horizontal.png"; public class Watch { public const int DefaultNavigationViewIconSize = 60; public const int DefaultDrawerTouchWidth = 50; public const int DefaultDrawerIconSize = 40; - public const string DefaultDrawerIcon = "Microsoft.Maui.Controls.Compatibility.Resource.wc_visual_cue.png"; + public const string DefaultDrawerIcon = "Microsoft.Maui.Controls.Compatibility.Tizen.Resources.wc_visual_cue.png"; } public class TV @@ -619,8 +619,8 @@ public class MediaPlayer { public class Resources { - public const string PlayImagePath = "Microsoft.Maui.Controls.Compatibility.Resource.img_button_play.png"; - public const string PauseImagePath = "Microsoft.Maui.Controls.Compatibility.Resource.img_button_pause.png"; + public const string PlayImagePath = "Microsoft.Maui.Controls.Compatibility.Tizen.Resources.img_button_play.png"; + public const string PauseImagePath = "Microsoft.Maui.Controls.Compatibility.Tizen.Resources.img_button_pause.png"; } public class ColorClass diff --git a/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs b/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs index 0d452b5ca97b..dc5047021045 100644 --- a/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs +++ b/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Tizen.cs @@ -19,7 +19,7 @@ public partial class StreamImageSourceService try { - var stream = await imageSource.GetStreamAsync(cancellationToken).ConfigureAwait(false); + var stream = await imageSource.GetStreamAsync(cancellationToken); if (stream == null) throw new InvalidOperationException("Unable to load image stream.");