forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 22 additions & 13 deletions
35
src/Core/src/Handlers/RefreshView/RefreshViewHandler.Tizen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.Maui.Graphics; | ||
using NView = Tizen.NUI.BaseComponents.View; | ||
|
||
namespace Microsoft.Maui.Handlers | ||
{ | ||
// TODO : Need to implement | ||
public partial class RefreshViewHandler : ViewHandler<IRefreshView, NView> | ||
public partial class RefreshViewHandler : ViewHandler<IRefreshView, MauiRefreshLayout> | ||
{ | ||
protected override NView CreatePlatformView() => throw new NotImplementedException(); | ||
|
||
public static void MapIsRefreshing(IRefreshViewHandler handler, IRefreshView refreshView) | ||
{ | ||
} | ||
protected override MauiRefreshLayout CreatePlatformView() => new(); | ||
|
||
public static void MapContent(IRefreshViewHandler handler, IRefreshView refreshView) | ||
protected override void ConnectHandler(MauiRefreshLayout platformView) | ||
{ | ||
base.ConnectHandler(platformView); | ||
platformView.Refreshing += OnRefreshing; | ||
} | ||
|
||
public static void MapRefreshColor(IRefreshViewHandler handler, IRefreshView refreshView) | ||
void OnRefreshing(object? sender, EventArgs e) | ||
{ | ||
VirtualView.IsRefreshing = true; | ||
} | ||
|
||
public static void MapRefreshViewBackground(IRefreshViewHandler handler, IView view) | ||
protected override void DisconnectHandler(MauiRefreshLayout platformView) | ||
{ | ||
platformView.Refreshing -= OnRefreshing; | ||
platformView.Content = null; | ||
base.DisconnectHandler(platformView); | ||
} | ||
|
||
public static void MapIsRefreshing(IRefreshViewHandler handler, IRefreshView refreshView) => | ||
handler.PlatformView.UpdateIsRefreshing(refreshView); | ||
|
||
public static void MapContent(IRefreshViewHandler handler, IRefreshView refreshView) => | ||
handler.PlatformView.UpdateContent(handler.VirtualView.Content, handler.MauiContext); | ||
|
||
public static void MapRefreshColor(IRefreshViewHandler handler, IRefreshView refreshView) => | ||
handler.PlatformView.UpdateRefreshColor(refreshView); | ||
|
||
public static void MapBackground(IRefreshViewHandler handler, IRefreshView view) | ||
=> handler.PlatformView.UpdateBackground(view); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Microsoft.Maui.Graphics; | ||
using Tizen.UIExtensions.NUI; | ||
using TColor = Tizen.UIExtensions.Common.Color; | ||
|
||
namespace Microsoft.Maui.Platform | ||
{ | ||
public class MauiRefreshLayout : RefreshLayout | ||
{ | ||
IPlatformViewHandler? _contentHandler; | ||
|
||
public void UpdateContent(IView? content, IMauiContext? mauiContext) | ||
{ | ||
Content = null; | ||
_contentHandler?.Dispose(); | ||
_contentHandler = null; | ||
|
||
if (content != null && mauiContext != null) | ||
{ | ||
var contentView = content.ToPlatform(mauiContext); | ||
if (content.Handler is IPlatformViewHandler thandler) | ||
{ | ||
_contentHandler = thandler; | ||
} | ||
Content = contentView; | ||
} | ||
} | ||
|
||
public void UpdateIsRefreshing(IRefreshView view) | ||
{ | ||
IsRefreshing = view.IsRefreshing; | ||
} | ||
|
||
public void UpdateRefreshColor(IRefreshView view) | ||
{ | ||
IconColor = view.RefreshColor?.ToPlatform() ?? TColor.Default; | ||
} | ||
|
||
public void UpdateBackground(IRefreshView view) | ||
{ | ||
IconBackgroundColor = view.Background.ToColor()?.ToPlatform() ?? TColor.Default; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters