Skip to content

Commit

Permalink
Fix RefreshView related issue (#51)
Browse files Browse the repository at this point in the history
* Fix RefreshView related issue

* Fix StreamImageSourceService.Tizen
  • Loading branch information
myroot authored and rookiejava committed Dec 27, 2021
1 parent 1069755 commit 0780696
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/Compatibility/Core/src/RendererToHandlerShim.Tizen.cs
Expand Up @@ -45,6 +45,7 @@ protected override void Dispose(bool disposing)
if (disposing)
{
VisualElementRenderer?.Dispose();
VisualElementRenderer = null;
}
base.Dispose(disposing);
}
Expand Down
19 changes: 9 additions & 10 deletions src/Compatibility/Core/src/Tizen/Renderers/RefreshViewRenderer.cs
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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;
}
Expand Down Expand Up @@ -109,6 +103,10 @@ public RefreshLayout()
Opacity = 0.5,
};
Children.Add(RefreshIcon);
Children.Add(new BoxView
{
HeightRequest = 200
});
}

RefreshIcon RefreshIcon { get; set; }
Expand Down Expand Up @@ -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();
Expand Down
14 changes: 7 additions & 7 deletions src/Compatibility/Core/src/Tizen/ThemeConstants.cs
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -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.");
Expand Down

0 comments on commit 0780696

Please sign in to comment.