Skip to content

Commit

Permalink
[Tizen] Add MauiPicker (dotnet#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
rookiejava authored and myroot committed Aug 24, 2022
1 parent 075bfce commit 46510e5
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 18 deletions.
7 changes: 1 addition & 6 deletions src/Core/src/Handlers/DatePicker/DatePickerHandler.Tizen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ namespace Microsoft.Maui.Handlers
{
public partial class DatePickerHandler : ViewHandler<IDatePicker, NEntry>
{
protected override NEntry CreatePlatformView() => new NEntry
{
IsReadOnly = true,
VerticalAlignment = VerticalAlignment.Center,
Focusable = true
};
protected override NEntry CreatePlatformView() => new MauiPicker();

protected override void ConnectHandler(NEntry platformView)
{
Expand Down
12 changes: 6 additions & 6 deletions src/Core/src/Handlers/Picker/PickerHandler.Tizen.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using Tizen.UIExtensions.NUI;
using Tizen.NUI;
using Tizen.UIExtensions.NUI;
using NColor = Tizen.NUI.Color;
using NPosition = Tizen.NUI.Position;
using NView = Tizen.NUI.BaseComponents.View;
using NEntry = Tizen.UIExtensions.NUI.Entry;

namespace Microsoft.Maui.Handlers
{
public partial class PickerHandler : ViewHandler<IPicker, NEntry>
{
protected override NEntry CreatePlatformView() => new NEntry
{
IsReadOnly = true,
Focusable = true,
};
protected override NEntry CreatePlatformView() => new MauiPicker();

protected override void ConnectHandler(NEntry platformView)
{
Expand Down
7 changes: 1 addition & 6 deletions src/Core/src/Handlers/TimePicker/TimePickerHandler.Tizen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ namespace Microsoft.Maui.Handlers
{
public partial class TimePickerHandler : ViewHandler<ITimePicker, NEntry>
{
protected override NEntry CreatePlatformView() => new NEntry
{
IsReadOnly = true,
VerticalAlignment = VerticalAlignment.Center,
Focusable = true,
};
protected override NEntry CreatePlatformView() => new MauiPicker();

protected override void ConnectHandler(NEntry platformView)
{
Expand Down
37 changes: 37 additions & 0 deletions src/Core/src/Platform/Tizen/MauiPicker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Tizen.NUI;
using NEntry = Tizen.UIExtensions.NUI.Entry;
using NView = Tizen.NUI.BaseComponents.View;
using NColor = Tizen.NUI.Color;

namespace Microsoft.Maui.Platform
{
public class MauiPicker : NEntry
{
readonly NColor _defaultUnderlineColor = NColor.DarkGray;
NView _underline;

public MauiPicker()
{
_underline = new NView
{
Color = _defaultUnderlineColor,
SizeHeight = 1d.ToScaledPixel(),
WidthResizePolicy = ResizePolicyType.FillToParent,
ParentOrigin = Position.ParentOriginBottomLeft
};

IsReadOnly = true;
Focusable = true;
VerticalAlignment = VerticalAlignment.Center;
Add(_underline);
}

protected override void OnEnabled(bool enabled)
{
base.OnEnabled(enabled);
_underline.Color = enabled ? _defaultUnderlineColor : NColor.LightGray;
}
}
}
3 changes: 3 additions & 0 deletions src/Core/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ static Microsoft.Maui.Handlers.MenuFlyoutSeparatorHandler.Mapper -> Microsoft.Ma
static Microsoft.Maui.Handlers.ViewHandler.MapToolTip(Microsoft.Maui.IViewHandler! handler, Microsoft.Maui.IView! view) -> void
static Microsoft.Maui.Platform.ViewExtensions.UpdateToolTip(this ElmSharp.EvasObject! platformView, Microsoft.Maui.ToolTip? tooltip) -> void
static Microsoft.Maui.Handlers.ViewHandler.MapContextFlyout(Microsoft.Maui.IViewHandler! handler, Microsoft.Maui.IView! view) -> void
Microsoft.Maui.Platform.MauiPicker
Microsoft.Maui.Platform.MauiPicker.MauiPicker() -> void
override Microsoft.Maui.Platform.MauiPicker.OnEnabled(bool enabled) -> void
override Microsoft.Maui.Platform.MauiStepper.OnEnabled(bool enabled) -> void
Microsoft.Maui.Handlers.IMenuFlyoutSeparatorHandler
Microsoft.Maui.Handlers.IMenuFlyoutSeparatorHandler.PlatformView.get -> object!
Expand Down

0 comments on commit 46510e5

Please sign in to comment.