Skip to content

Commit

Permalink
Bumt to latest
Browse files Browse the repository at this point in the history
- Effects (dotnet#1574)
- Improve Window and AnimationManager (dotnet#1653)
- and so on
  • Loading branch information
rookiejava committed Jul 14, 2021
1 parent fda239a commit 8cd8fc3
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,8 @@ void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e)
/// <param name="effect">The effect to register.</param>
void OnRegisterEffect(PlatformEffect effect)
{
effect.SetContainer(Element.Parent == null ? null : Platform.GetRenderer(Element.Parent)?.NativeView);
effect.SetControl(NativeView);
effect.Container = Element.Parent == null ? null : Platform.GetRenderer(Element.Parent)?.NativeView;
effect.Control = NativeView;
}

void OnMoved(object sender, EventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,53 @@ protected override void OnElementPropertyChanged(PropertyChangedEventArgs args)
}
}
}
#elif TIZEN
public class FocusPlatformEffect : PlatformEffect
{
ElmSharp.Color backgroundColor;

protected override void OnAttached()
{
try
{
(Control as ElmSharp.Widget).BackgroundColor = backgroundColor = ElmSharp.Color.FromRgb(204, 153, 255);
}
catch (Exception ex)
{
Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
}
}

protected override void OnDetached()
{
}

protected override void OnElementPropertyChanged(PropertyChangedEventArgs args)
{
base.OnElementPropertyChanged(args);

try
{
if (args.PropertyName == "IsFocused")
{
if (Control is ElmSharp.Widget widget)
{
if (widget.BackgroundColor == backgroundColor)
{
widget.BackgroundColor = ElmSharp.Color.White;
}
else
{
widget.BackgroundColor = backgroundColor;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
}
}
}
#endif
}
2 changes: 2 additions & 0 deletions src/Controls/src/Core/Platform/PlatformEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using NativeView = Android.Views.View;
#elif WINDOWS
using NativeView = Microsoft.UI.Xaml.FrameworkElement;
#elif TIZEN
using NativeView = ElmSharp.EvasObject;
#elif NETSTANDARD
using NativeView = System.Object;
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/Core/src/Platform/Tizen/HandlerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.Maui
{
public static class HandlerExtensions
{
public static EvasObject ToNative(this IView view, IMauiContext context)
public static EvasObject ToNative(this IElement view, IMauiContext context)
{
_ = view ?? throw new ArgumentNullException(nameof(view));
_ = context ?? throw new ArgumentNullException(nameof(context));
Expand Down Expand Up @@ -44,12 +44,12 @@ public static void SetWindow(this Window nativeWindow, IWindow window, IMauiCont
_ = window ?? throw new ArgumentNullException(nameof(window));
_ = mauiContext ?? throw new ArgumentNullException(nameof(mauiContext));

var handler = window.Handler as IWindowHandler;
var handler = window.Handler;
if (handler == null)
handler = mauiContext.Handlers.GetHandler(window.GetType()) as IWindowHandler;
handler = mauiContext.Handlers.GetHandler(window.GetType());

if (handler == null)
throw new Exception($"Handler not found for view {window} or was not {nameof(IWindowHandler)}'");
throw new Exception($"Handler not found for view {window}.");

handler.SetMauiContext(mauiContext);

Expand Down

0 comments on commit 8cd8fc3

Please sign in to comment.