Merge branch '4.6.0' into 4.7.0
This commit is contained in:
Коммит
59dc683bc9
|
@ -44,8 +44,6 @@ namespace Xamarin.Forms.ControlGallery.Android
|
|||
base.OnCreate(bundle);
|
||||
|
||||
#if TEST_EXPERIMENTAL_RENDERERS
|
||||
// Fake_Flag is here so we can test for flag initialization issues
|
||||
Forms.SetFlags("Fake_Flag"/*, "CollectionView_Experimental", "Shell_Experimental"*/);
|
||||
#else
|
||||
Forms.SetFlags("UseLegacyRenderers", "SwipeView_Experimental", "MediaElement_Experimental", "AppTheme_Experimental");
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Xamarin.Forms.Controls.GalleryPages.SwipeViewGalleries
|
|||
deleteSwipeItem
|
||||
};
|
||||
|
||||
leftSwipeItems.Mode = SwipeMode.Execute;
|
||||
leftSwipeItems.Mode = SwipeMode.Reveal;
|
||||
|
||||
var swipeContent = new Grid
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ namespace Xamarin.Forms.Controls.GalleryPages.SwipeViewGalleries
|
|||
|
||||
swipeView.SwipeEnded += (sender, e) =>
|
||||
{
|
||||
eventsInfo.Text += $"SwipeEnded - Direction:{e.SwipeDirection}" + Environment.NewLine;
|
||||
eventsInfo.Text += $"SwipeEnded - Direction:{e.SwipeDirection}, IsOpen: {e.IsOpen}" + Environment.NewLine;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace Xamarin.Forms
|
|||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void OnRequestedThemeChanged(AppThemeChangedEventArgs args)
|
||||
{
|
||||
if (Device.Flags.IndexOf(ExperimentalFlags.AppThemeExperimental) == -1)
|
||||
if (Device.Flags == null || Device.Flags.IndexOf(ExperimentalFlags.AppThemeExperimental) == -1)
|
||||
return;
|
||||
|
||||
// On iOS the event is triggered more than once.
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
public const string Label = "label";
|
||||
public const string SecondaryLabel = "secondaryLabel";
|
||||
public const string TertiaryLabel = "tertiaryLabel";
|
||||
public const string QuaternaryLabel = "quaternaryLabellabel";
|
||||
public const string QuaternaryLabel = "quaternaryLabel";
|
||||
public const string PlaceholderText = "placeholderText";
|
||||
public const string Separator = "separator";
|
||||
public const string OpaqueSeparator = "opaqueSeparator";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using FormsElement = Forms.Application;
|
||||
|
||||
public static class Application
|
||||
|
@ -27,8 +28,7 @@
|
|||
return config;
|
||||
}
|
||||
|
||||
public static readonly BindableProperty OverlayContentProperty
|
||||
= BindableProperty.CreateAttached("OverlayContent", typeof(View), typeof(FormsElement), default(View));
|
||||
public static readonly BindableProperty OverlayContentProperty = BindableProperty.CreateAttached("OverlayContent", typeof(View), typeof(FormsElement), default(View));
|
||||
|
||||
public static View GetOverlayContent(BindableObject application)
|
||||
{
|
||||
|
@ -50,5 +50,30 @@
|
|||
SetOverlayContent(config.Element, value);
|
||||
return config;
|
||||
}
|
||||
|
||||
public static readonly BindablePropertyKey ActiveBezelInteractionElementPropertyKey = BindableProperty.CreateAttachedReadOnly("ActiveBezelInteractionElement", typeof(Element), typeof(FormsElement), default(Element));
|
||||
|
||||
public static Element GetActiveBezelInteractionElement(BindableObject application)
|
||||
{
|
||||
return (Element)application.GetValue(ActiveBezelInteractionElementPropertyKey.BindableProperty);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static void SetActiveBezelInteractionElement(BindableObject application, Element value)
|
||||
{
|
||||
application.SetValue(ActiveBezelInteractionElementPropertyKey, value);
|
||||
}
|
||||
|
||||
public static Element GetActiveBezelInteractionElement(this IPlatformElementConfiguration<Tizen, FormsElement> config)
|
||||
{
|
||||
return GetActiveBezelInteractionElement(config.Element);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static IPlatformElementConfiguration<Tizen, FormsElement> SetActiveBezelInteractionElement(this IPlatformElementConfiguration<Tizen, FormsElement> config, Element value)
|
||||
{
|
||||
SetActiveBezelInteractionElement(config.Element, value);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
|
|||
public const string CheckBox = "default";
|
||||
public const string Toggle = "toggle";
|
||||
public const string Favorite = "favorite";
|
||||
public const string OnOff = "on&off";
|
||||
public const string Small = "small";
|
||||
}
|
||||
|
||||
public static class ProgressBarStyle
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
|
||||
{
|
||||
using FormsElement = Forms.Switch;
|
||||
|
||||
public static class Switch
|
||||
{
|
||||
public static readonly BindableProperty ColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(FormsElement), Color.Default);
|
||||
|
||||
public static Color GetColor(BindableObject element)
|
||||
{
|
||||
return (Color)element.GetValue(ColorProperty);
|
||||
}
|
||||
|
||||
public static void SetColor(BindableObject element, Color color)
|
||||
{
|
||||
element.SetValue(ColorProperty, color);
|
||||
}
|
||||
|
||||
public static Color GetColor(this IPlatformElementConfiguration<Tizen, FormsElement> config)
|
||||
{
|
||||
return GetColor(config.Element);
|
||||
}
|
||||
|
||||
public static IPlatformElementConfiguration<Tizen, FormsElement> SetColor(this IPlatformElementConfiguration<Tizen, FormsElement> config, Color color)
|
||||
{
|
||||
SetColor(config.Element, color);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,9 +42,11 @@ namespace Xamarin.Forms
|
|||
|
||||
public class SwipeEndedEventArgs : BaseSwipeEventArgs
|
||||
{
|
||||
public SwipeEndedEventArgs(SwipeDirection swipeDirection) : base(swipeDirection)
|
||||
public SwipeEndedEventArgs(SwipeDirection swipeDirection, bool isOpen) : base(swipeDirection)
|
||||
{
|
||||
|
||||
IsOpen = isOpen;
|
||||
}
|
||||
|
||||
public bool IsOpen { get; set; }
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
{
|
||||
public class SwipeViewRenderer : ViewRenderer<SwipeView, AView>
|
||||
{
|
||||
const float OpenSwipeThresholdPercentage = 0.6f; // 60%
|
||||
const int SwipeThreshold = 250;
|
||||
const int SwipeItemWidth = 100;
|
||||
const long SwipeAnimationDuration = 200;
|
||||
|
@ -449,7 +450,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
UpdateSwipeItems();
|
||||
}
|
||||
|
||||
|
||||
if (!_isSwiping)
|
||||
{
|
||||
RaiseSwipeStarted();
|
||||
|
@ -735,7 +736,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
int drawableWidth = drawable.IntrinsicWidth;
|
||||
int drawableHeight = drawable.IntrinsicHeight;
|
||||
|
||||
if(drawableWidth > drawableHeight)
|
||||
if (drawableWidth > drawableHeight)
|
||||
{
|
||||
var iconWidth = iconSize;
|
||||
var iconHeight = drawableHeight * iconWidth / drawableWidth;
|
||||
|
@ -1050,7 +1051,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
if (_swipeDirection == null)
|
||||
return;
|
||||
|
||||
var swipeThresholdPercent = 0.6 * GetSwipeThreshold();
|
||||
var swipeThresholdPercent = OpenSwipeThresholdPercentage * GetSwipeThreshold();
|
||||
|
||||
if (Math.Abs(_swipeOffset) >= swipeThresholdPercent)
|
||||
{
|
||||
|
@ -1366,7 +1367,14 @@ namespace Xamarin.Forms.Platform.Android
|
|||
if (_swipeDirection == null || !ValidateSwipeDirection())
|
||||
return;
|
||||
|
||||
var swipeEndedEventArgs = new SwipeEndedEventArgs(_swipeDirection.Value);
|
||||
bool isOpen = false;
|
||||
|
||||
var swipeThresholdPercent = OpenSwipeThresholdPercentage * GetSwipeThreshold();
|
||||
|
||||
if (Math.Abs(_swipeOffset) >= swipeThresholdPercent)
|
||||
isOpen = true;
|
||||
|
||||
var swipeEndedEventArgs = new SwipeEndedEventArgs(_swipeDirection.Value, isOpen);
|
||||
((ISwipeViewController)Element).SendSwipeEnded(swipeEndedEventArgs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,21 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
Scroll.HorizontalPageScrollLimit = 1;
|
||||
Scroll.VerticalPageScrollLimit = 1;
|
||||
Scroll.SetPageSize(1.0, 1.0);
|
||||
Scroll.HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible;
|
||||
Scroll.VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible;
|
||||
}
|
||||
|
||||
public EScroller Scroll => base.Scroller;
|
||||
|
||||
protected override ViewHolder CreateViewHolder()
|
||||
{
|
||||
return new ViewHolder(this)
|
||||
{
|
||||
FocusedColor = ElmSharp.Color.Transparent,
|
||||
SelectedColor = ElmSharp.Color.Transparent,
|
||||
};
|
||||
}
|
||||
|
||||
ESize ICollectionViewController.GetItemSize(int widthConstraint, int heightConstraint)
|
||||
{
|
||||
return AllocatedSize;
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
|
||||
public CollectionView(EvasObject parent) : base(parent)
|
||||
{
|
||||
AllowFocus(true);
|
||||
SetLayoutCallback(OnLayout);
|
||||
Scroller = CreateScroller(parent);
|
||||
Scroller.Show();
|
||||
|
@ -248,6 +249,11 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
return Adaptor.MeasureItem(index, widthConstraint, heightConstraint);
|
||||
}
|
||||
|
||||
protected virtual ViewHolder CreateViewHolder()
|
||||
{
|
||||
return new ViewHolder(this);
|
||||
}
|
||||
|
||||
ViewHolder ICollectionViewController.RealizeView(int index)
|
||||
{
|
||||
if (Adaptor == null)
|
||||
|
@ -261,7 +267,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
else
|
||||
{
|
||||
var content = Adaptor.CreateNativeView(index, this);
|
||||
holder = new ViewHolder(this);
|
||||
holder = CreateViewHolder();
|
||||
holder.RequestSelected += OnRequestItemSelection;
|
||||
holder.Content = content;
|
||||
holder.ViewCategory = Adaptor.GetViewCategory(index);
|
||||
|
|
|
@ -6,6 +6,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
{
|
||||
public class IndicatorView : Index
|
||||
{
|
||||
const int OddMiddleItem = 10;
|
||||
const int EvenMiddleItem = 11;
|
||||
List<IndexItem> _list = new List<IndexItem>();
|
||||
|
||||
public IndicatorView(EvasObject parent) : base(parent)
|
||||
|
@ -53,17 +55,15 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
{
|
||||
foreach (var item in _list)
|
||||
{
|
||||
int center = 10;
|
||||
int start = center - (_list.Count / 2);
|
||||
int index = _list.IndexOf(item);
|
||||
int position = start + index;
|
||||
if (_list.Count % 2 == 0)
|
||||
{
|
||||
int position = EvenMiddleItem - (_list.Count / 2) + _list.IndexOf(item);
|
||||
string itemStyle = "item/even_" + position;
|
||||
item.Style = itemStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
int position = OddMiddleItem - (_list.Count / 2) + _list.IndexOf(item);
|
||||
string itemStyle = "item/odd_" + position;
|
||||
item.Style = itemStyle;
|
||||
}
|
||||
|
|
|
@ -41,19 +41,6 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
}
|
||||
}
|
||||
|
||||
public TimeSpan Time
|
||||
{
|
||||
get
|
||||
{
|
||||
return DateTime.TimeOfDay;
|
||||
}
|
||||
set
|
||||
{
|
||||
DateTime -= DateTime.TimeOfDay;
|
||||
DateTime += value;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateMode()
|
||||
{
|
||||
if (Mode == DateTimePickerMode.Date)
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
public class DateTimePickerDialog : Dialog, IDateTimeDialog
|
||||
{
|
||||
EvasObject _parent;
|
||||
DateTimePicker _picker;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a dialog window.
|
||||
/// </summary>
|
||||
|
@ -16,23 +18,62 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
Initialize();
|
||||
}
|
||||
|
||||
public DateTimePicker Picker { get; protected set; }
|
||||
/// <summary>
|
||||
/// Gets or sets picker style
|
||||
/// </summary>
|
||||
public DateTimePickerMode Mode
|
||||
{
|
||||
get => _picker.Mode;
|
||||
set => _picker.Mode = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the upper boundary of the DateTime field.
|
||||
/// </summary>
|
||||
public DateTime MaximumDateTime
|
||||
{
|
||||
get => _picker.MaximumDateTime;
|
||||
set => _picker.MaximumDateTime = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the lower boundary of the DateTime field.
|
||||
/// </summary>
|
||||
public DateTime MinimumDateTime
|
||||
{
|
||||
get => _picker.MinimumDateTime;
|
||||
set => _picker.MinimumDateTime = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current value of the DateTime field.
|
||||
/// </summary>
|
||||
public DateTime DateTime
|
||||
{
|
||||
get => _picker.DateTime;
|
||||
set => _picker.DateTime = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the date of this dialog has changed.
|
||||
/// </summary>
|
||||
public event EventHandler<DateChangedEventArgs> DateTimeChanged;
|
||||
|
||||
protected virtual DateTimePicker CreatePicker(EvasObject parent)
|
||||
{
|
||||
return new DateTimePicker(parent);
|
||||
}
|
||||
/// <summary>
|
||||
/// Occurs when the picker dialog has opened.
|
||||
/// </summary>
|
||||
public event EventHandler PickerOpened;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the picker dialog has closed.
|
||||
/// </summary>
|
||||
public event EventHandler PickerClosed;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
Picker = CreatePicker(_parent);
|
||||
Picker.Show();
|
||||
Content = Picker;
|
||||
_picker = new DateTimePicker(_parent);
|
||||
_picker.Show();
|
||||
Content = _picker;
|
||||
|
||||
//TODO need to add internationalization support
|
||||
PositiveButton = new EButton(_parent) { Text = "Set" };
|
||||
|
@ -46,10 +87,17 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
NegativeButton.Clicked += (s, e) =>
|
||||
{
|
||||
Hide();
|
||||
PickerClosed?.Invoke(this, EventArgs.Empty);
|
||||
};
|
||||
BackButtonPressed += (object s, EventArgs e) =>
|
||||
{
|
||||
Hide();
|
||||
PickerClosed?.Invoke(this, EventArgs.Empty);
|
||||
};
|
||||
|
||||
ShowAnimationFinished += (object s, EventArgs e) =>
|
||||
{
|
||||
PickerOpened?.Invoke(this, EventArgs.Empty);
|
||||
};
|
||||
|
||||
// TODO This is Tizen TV Limitation.
|
||||
|
@ -60,7 +108,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
{
|
||||
if (e.KeyName == "Return")
|
||||
{
|
||||
if (Picker != null && Picker.IsFocused)
|
||||
if (_picker != null && _picker.IsFocused)
|
||||
{
|
||||
Confirm();
|
||||
e.Flags |= EvasEventFlag.OnHold;
|
||||
|
@ -72,8 +120,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native
|
|||
|
||||
void Confirm()
|
||||
{
|
||||
DateTimeChanged?.Invoke(this, new DateChangedEventArgs(Picker.DateTime));
|
||||
DateTimeChanged?.Invoke(this, new DateChangedEventArgs(_picker.DateTime));
|
||||
Hide();
|
||||
PickerClosed?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ElmSharp;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Tizen.Native
|
||||
{
|
||||
public interface IDateTimeDialog
|
||||
{
|
||||
string Title { get; set; }
|
||||
DateTimePicker Picker { get; }
|
||||
DateTimePickerMode Mode { get; set; }
|
||||
DateTime MaximumDateTime { get; set; }
|
||||
DateTime MinimumDateTime { get; set; }
|
||||
DateTime DateTime { get; set; }
|
||||
|
||||
event EventHandler<DateChangedEventArgs> DateTimeChanged;
|
||||
event EventHandler PickerOpened;
|
||||
event EventHandler PickerClosed;
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
void Unrealize();
|
||||
|
|
|
@ -4,38 +4,45 @@ using ElmSharp.Wearable;
|
|||
|
||||
namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
||||
{
|
||||
public class WatchDateTimePicker : DateTimePicker
|
||||
public class WatchDateTimePicker : CircleDateTimeSelector, IRotaryInteraction
|
||||
{
|
||||
readonly CircleSurface _surface;
|
||||
public WatchDateTimePicker(EvasObject parent, CircleSurface surface) : base()
|
||||
DateTimePickerMode _mode;
|
||||
|
||||
public IRotaryActionWidget RotaryWidget => this;
|
||||
|
||||
public WatchDateTimePicker(EvasObject parent, CircleSurface surface) : base(parent, surface)
|
||||
{
|
||||
_surface = surface;
|
||||
Realize(parent);
|
||||
UpdateMode();
|
||||
}
|
||||
|
||||
public CircleDateTimeSelector CircleSelector { get; private set; }
|
||||
|
||||
protected override void UpdateMode()
|
||||
public DateTimePickerMode Mode
|
||||
{
|
||||
if (Mode == DateTimePickerMode.Date)
|
||||
get
|
||||
{
|
||||
return _mode;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_mode != value)
|
||||
{
|
||||
_mode = value;
|
||||
UpdateMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateMode()
|
||||
{
|
||||
if (_mode == DateTimePickerMode.Date)
|
||||
{
|
||||
Style = "datepicker/circle";
|
||||
Format = "%d/%b/%Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
Style = "timepicker/circle";
|
||||
Format = "%d/%b/%Y %I:%M %p";
|
||||
}
|
||||
}
|
||||
|
||||
protected override IntPtr CreateHandle(EvasObject parent)
|
||||
{
|
||||
CircleSelector = new CircleDateTimeSelector(parent, _surface);
|
||||
if (CircleSelector.RealHandle != CircleSelector.Handle)
|
||||
{
|
||||
RealHandle = CircleSelector.RealHandle;
|
||||
}
|
||||
return CircleSelector.Handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,11 @@ using ElmSharp;
|
|||
using ElmSharp.Wearable;
|
||||
using ELayout = ElmSharp.Layout;
|
||||
using EButton = ElmSharp.Button;
|
||||
using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Application;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
||||
{
|
||||
public class WatchDataTimePickerDialog : Popup, IDateTimeDialog
|
||||
public class WatchDateTimePickerDialog : Popup, IDateTimeDialog
|
||||
{
|
||||
ELayout _surfaceLayout;
|
||||
ELayout _datetimeLayout;
|
||||
|
@ -14,8 +15,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
EButton _doneButton;
|
||||
Box _container;
|
||||
string _title;
|
||||
WatchDateTimePicker _picker;
|
||||
|
||||
public WatchDataTimePickerDialog(EvasObject parent) : base(parent)
|
||||
public WatchDateTimePickerDialog(EvasObject parent) : base(parent)
|
||||
{
|
||||
AlignmentX = -1;
|
||||
AlignmentY = -1;
|
||||
|
@ -36,9 +38,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
_datetimeLayout.SetTheme("layout", "circle", "datetime");
|
||||
_surface = new CircleSurface(_surfaceLayout);
|
||||
|
||||
WatchPicker = new WatchDateTimePicker(parent, _surface);
|
||||
WatchPicker.Show();
|
||||
_datetimeLayout.SetContent(WatchPicker);
|
||||
_picker = new WatchDateTimePicker(parent, _surface);
|
||||
_picker.Show();
|
||||
_datetimeLayout.SetContent(_picker);
|
||||
|
||||
_doneButton = new Button(parent)
|
||||
{
|
||||
|
@ -48,13 +50,14 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
_datetimeLayout.SetPartContent("elm.swallow.btn", _doneButton);
|
||||
_doneButton.Clicked += OnDoneClicked;
|
||||
|
||||
((IRotaryActionWidget)WatchPicker.CircleSelector).Activate();
|
||||
ActivateRotaryInteraction();
|
||||
|
||||
_datetimeLayout.Show();
|
||||
_surfaceLayout.Show();
|
||||
_container.Show();
|
||||
|
||||
SetContent(_container);
|
||||
ShowAnimationFinished += OnShowAnimationFinished;
|
||||
BackButtonPressed += OnBackButtonPressed;
|
||||
}
|
||||
|
||||
|
@ -68,10 +71,44 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
}
|
||||
}
|
||||
|
||||
public DateTimePicker Picker => WatchPicker;
|
||||
protected WatchDateTimePicker WatchPicker { get; }
|
||||
public DateTimePickerMode Mode
|
||||
{
|
||||
get => _picker.Mode;
|
||||
set => _picker.Mode = value;
|
||||
}
|
||||
|
||||
public DateTime MaximumDateTime
|
||||
{
|
||||
get => _picker.MaximumDateTime;
|
||||
set => _picker.MaximumDateTime = value;
|
||||
}
|
||||
|
||||
public DateTime MinimumDateTime
|
||||
{
|
||||
get => _picker.MinimumDateTime;
|
||||
set => _picker.MinimumDateTime = value;
|
||||
}
|
||||
|
||||
public DateTime DateTime
|
||||
{
|
||||
get => _picker.DateTime;
|
||||
set => _picker.DateTime = value;
|
||||
}
|
||||
|
||||
public event EventHandler<DateChangedEventArgs> DateTimeChanged;
|
||||
public event EventHandler PickerOpened;
|
||||
public event EventHandler PickerClosed;
|
||||
|
||||
protected virtual void ActivateRotaryInteraction()
|
||||
{
|
||||
if (_picker is IRotaryInteraction ri)
|
||||
{
|
||||
if (Specific.GetUseBezelInteraction(Application.Current))
|
||||
{
|
||||
ri.RotaryWidget.Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnContainerLayout()
|
||||
{
|
||||
|
@ -82,14 +119,21 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
void OnDoneClicked(object sender, EventArgs e)
|
||||
{
|
||||
System.Console.WriteLine("Done clicked");
|
||||
System.Console.WriteLine("Picker.DateTime - {0} ", Picker.DateTime);
|
||||
DateTimeChanged?.Invoke(this, new DateChangedEventArgs(Picker.DateTime));
|
||||
System.Console.WriteLine("Picker.DateTime - {0} ", _picker.DateTime);
|
||||
DateTimeChanged?.Invoke(this, new DateChangedEventArgs(_picker.DateTime));
|
||||
Hide();
|
||||
PickerClosed?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
void OnBackButtonPressed(object sender, EventArgs e)
|
||||
{
|
||||
Hide();
|
||||
PickerClosed?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
void OnShowAnimationFinished(object sender, EventArgs e)
|
||||
{
|
||||
PickerOpened?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,6 +15,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
|
||||
public IntPtr CircleHandle => _circleGenList.CircleHandle;
|
||||
|
||||
public CircleGenList CircleGenList => _circleGenList;
|
||||
|
||||
public CircleSurface CircleSurface => _surface;
|
||||
|
||||
public IRotaryActionWidget RotaryWidget { get => this; }
|
||||
|
@ -34,13 +36,6 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
Scroller.Scrolled += OnScrolled;
|
||||
}
|
||||
|
||||
public override void AddSource(IEnumerable source, Cell beforeCell = null)
|
||||
{
|
||||
base.AddSource(source, beforeCell);
|
||||
AddHeaderPadding();
|
||||
AddFooterPadding();
|
||||
}
|
||||
|
||||
public override void SetHeader(VisualElement header)
|
||||
{
|
||||
if (_headerPadding != null)
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
|||
|
||||
public CircleSurface CircleSurface => _surface;
|
||||
|
||||
public CircleScroller CircleScroller => _circleScroller;
|
||||
|
||||
public IRotaryActionWidget RotaryWidget { get => this; }
|
||||
|
||||
public WatchScroller(EvasObject parent, CircleSurface surface)
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using ElmSharp;
|
||||
using ElmSharp.Wearable;
|
||||
using TizenDotnetUtil = Tizen.Common.DotnetUtil;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Tizen.Native.Watch
|
||||
{
|
||||
public class WatchSpinner : CircleSpinner, IRotaryInteraction
|
||||
{
|
||||
SmartEvent _wheelAppeared, _wheelDisappeared;
|
||||
|
||||
public event EventHandler WheelAppeared;
|
||||
|
||||
public event EventHandler WheelDisappeared;
|
||||
|
||||
public IRotaryActionWidget RotaryWidget { get => this; }
|
||||
|
||||
public WatchSpinner(EvasObject parent, CircleSurface surface) : base(parent, surface)
|
||||
{
|
||||
Style = "circle";
|
||||
|
||||
if (TizenDotnetUtil.TizenAPIVersion == 4)
|
||||
{
|
||||
_wheelAppeared = new ElmSharp.SmartEvent(this, "genlist,show");
|
||||
_wheelDisappeared = new ElmSharp.SmartEvent(this, "genlist,hide");
|
||||
}
|
||||
else
|
||||
{
|
||||
_wheelAppeared = new ElmSharp.SmartEvent(this, "list,show");
|
||||
_wheelDisappeared = new ElmSharp.SmartEvent(this, "list,hide");
|
||||
}
|
||||
|
||||
_wheelAppeared.On += (s, e) => WheelAppeared?.Invoke(this, EventArgs.Empty);
|
||||
_wheelDisappeared.On += (s, e) => WheelDisappeared?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using Xamarin.Forms.Platform.Tizen.Native;
|
||||
using WatchDataTimePickerDialog = Xamarin.Forms.Platform.Tizen.Native.Watch.WatchDataTimePickerDialog;
|
||||
using WatchDateTimePickerDialog = Xamarin.Forms.Platform.Tizen.Native.Watch.WatchDateTimePickerDialog;
|
||||
using EEntry = ElmSharp.Entry;
|
||||
using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Application;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Tizen
|
||||
{
|
||||
|
@ -25,7 +26,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
{
|
||||
if (Device.Idiom == TargetIdiom.Watch)
|
||||
{
|
||||
return new WatchDataTimePickerDialog(Forms.NativeParent);
|
||||
return new WatchDateTimePickerDialog(Forms.NativeParent);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -51,6 +52,8 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
var dialog = CreateDialog();
|
||||
dialog.Title = DialogTitle;
|
||||
dialog.DateTimeChanged += OnDateTimeChanged;
|
||||
dialog.PickerOpened += OnPickerOpened;
|
||||
dialog.PickerClosed += OnPickerClosed;
|
||||
return dialog;
|
||||
});
|
||||
}
|
||||
|
@ -94,6 +97,8 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
if (_lazyDialog.IsValueCreated)
|
||||
{
|
||||
_lazyDialog.Value.DateTimeChanged -= OnDateTimeChanged;
|
||||
_lazyDialog.Value.PickerOpened += OnPickerOpened;
|
||||
_lazyDialog.Value.PickerClosed += OnPickerClosed;
|
||||
_lazyDialog.Value.Unrealize();
|
||||
}
|
||||
}
|
||||
|
@ -107,9 +112,9 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
if (Element.IsEnabled)
|
||||
{
|
||||
var dialog = _lazyDialog.Value;
|
||||
dialog.Picker.DateTime = Element.Date;
|
||||
dialog.Picker.MaximumDateTime = Element.MaximumDate;
|
||||
dialog.Picker.MinimumDateTime = Element.MinimumDate;
|
||||
dialog.DateTime = Element.Date;
|
||||
dialog.MaximumDateTime = Element.MaximumDate;
|
||||
dialog.MinimumDateTime = Element.MinimumDate;
|
||||
// You need to call Show() after ui thread occupation because of EFL problem.
|
||||
// Otherwise, the content of the popup will not receive focus.
|
||||
Device.BeginInvokeOnMainThread(() => dialog.Show());
|
||||
|
@ -135,6 +140,27 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
}
|
||||
}
|
||||
|
||||
protected virtual void OnPickerOpened(object sender, EventArgs args)
|
||||
{
|
||||
if (Specific.GetUseBezelInteraction(Application.Current))
|
||||
{
|
||||
// picker included in WatchDatePickedDialog has been activated, whenever the dialog is opend.
|
||||
Forms.RotaryFocusObject = Element;
|
||||
Specific.SetActiveBezelInteractionElement(Application.Current, Element);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnPickerClosed(object sender, EventArgs args)
|
||||
{
|
||||
if (Specific.GetUseBezelInteraction(Application.Current))
|
||||
{
|
||||
if (Forms.RotaryFocusObject == Element)
|
||||
Forms.RotaryFocusObject = null;
|
||||
if (Specific.GetActiveBezelInteractionElement(Application.Current) == Element)
|
||||
Specific.SetActiveBezelInteractionElement(Application.Current, null);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateFontSize()
|
||||
{
|
||||
if (Control is IEntry ie)
|
||||
|
|
|
@ -246,14 +246,8 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
if (headerElement != null)
|
||||
{
|
||||
Control.SetHeader(headerElement);
|
||||
}
|
||||
if (footerElement != null)
|
||||
{
|
||||
Control.SetFooter(footerElement);
|
||||
}
|
||||
Control.SetHeader(headerElement);
|
||||
Control.SetFooter(footerElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using ElmSharp;
|
||||
using Xamarin.Forms.Platform.Tizen.Native.Watch;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Tizen
|
||||
{
|
||||
|
@ -18,15 +19,27 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
{
|
||||
if (Control == null)
|
||||
{
|
||||
SetNativeControl(new Spinner(Forms.NativeParent)
|
||||
{
|
||||
IsEditable = false,
|
||||
});
|
||||
SetNativeControl(CreateNativeControl());
|
||||
Control.ValueChanged += OnValueChanged;
|
||||
}
|
||||
base.OnElementChanged(e);
|
||||
}
|
||||
|
||||
protected virtual Spinner CreateNativeControl()
|
||||
{
|
||||
if (Device.Idiom == TargetIdiom.Watch)
|
||||
{
|
||||
return new WatchSpinner(Forms.NativeParent, Forms.CircleSurface);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Spinner(Forms.NativeParent)
|
||||
{
|
||||
IsEditable = false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
|
@ -39,7 +52,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
void OnValueChanged(object sender, EventArgs e)
|
||||
protected virtual void OnValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
double newValue = Control.Value;
|
||||
((IElementController)Element).SetValueFromRenderer(Stepper.ValueProperty, newValue);
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
_itemsRenderer = null;
|
||||
}
|
||||
|
||||
((ISwipeViewController)Element).SendSwipeEnded(new SwipeEndedEventArgs(SwipeDirection));
|
||||
((ISwipeViewController)Element).SendSwipeEnded(new SwipeEndedEventArgs(SwipeDirection, DrawerState == SwipeDrawerState.Opend));
|
||||
DrawerState = SwipeDrawerState.Closed;
|
||||
SwipeDirection = 0;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using ElmSharp;
|
||||
using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
|
||||
using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.VisualElement;
|
||||
using SpecificSwitch = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Switch;
|
||||
using EColor = ElmSharp.Color;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Tizen
|
||||
|
@ -18,6 +19,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
_onColorPart = _isTV ? "slider_on" : Device.Idiom == TargetIdiom.Watch ? "outer_bg_on" : "bg_on";
|
||||
RegisterPropertyHandler(Switch.IsToggledProperty, HandleToggled);
|
||||
RegisterPropertyHandler(Switch.OnColorProperty, UpdateOnColor);
|
||||
RegisterPropertyHandler(SpecificSwitch.ColorProperty, UpdateColor);
|
||||
}
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Switch> e)
|
||||
|
@ -58,6 +60,8 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
case SwitchStyle.Toggle:
|
||||
case SwitchStyle.Favorite:
|
||||
case SwitchStyle.CheckBox:
|
||||
case SwitchStyle.OnOff:
|
||||
case SwitchStyle.Small:
|
||||
Control.Style = style;
|
||||
break;
|
||||
default:
|
||||
|
@ -67,17 +71,16 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
((IVisualElementController)Element).NativeSizeChanged();
|
||||
}
|
||||
|
||||
void OnStateChanged(object sender, EventArgs e)
|
||||
protected virtual void UpdateColor()
|
||||
{
|
||||
Element.SetValueFromRenderer(Switch.IsToggledProperty, Control.IsChecked);
|
||||
var color = SpecificSwitch.GetColor(Element);
|
||||
if (color != Color.Default)
|
||||
{
|
||||
Control.Color = color.ToNative();
|
||||
}
|
||||
}
|
||||
|
||||
void HandleToggled()
|
||||
{
|
||||
Control.IsChecked = Element.IsToggled;
|
||||
}
|
||||
|
||||
void UpdateOnColor(bool initialize)
|
||||
protected void UpdateOnColor(bool initialize)
|
||||
{
|
||||
if (initialize && Element.OnColor.IsDefault)
|
||||
return;
|
||||
|
@ -96,5 +99,16 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
Control.SetPartColor("slider_focused_on", color);
|
||||
}
|
||||
}
|
||||
|
||||
void OnStateChanged(object sender, EventArgs e)
|
||||
{
|
||||
Element.SetValueFromRenderer(Switch.IsToggledProperty, Control.IsChecked);
|
||||
}
|
||||
|
||||
void HandleToggled()
|
||||
{
|
||||
Control.IsChecked = Element.IsToggled;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Forms.Platform.Tizen.Native;
|
||||
using WatchDataTimePickerDialog = Xamarin.Forms.Platform.Tizen.Native.Watch.WatchDataTimePickerDialog;
|
||||
using WatchDateTimePickerDialog = Xamarin.Forms.Platform.Tizen.Native.Watch.WatchDateTimePickerDialog;
|
||||
using EEntry = ElmSharp.Entry;
|
||||
using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Application;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Tizen
|
||||
{
|
||||
|
@ -30,7 +31,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
{
|
||||
if (Device.Idiom == TargetIdiom.Watch)
|
||||
{
|
||||
return new WatchDataTimePickerDialog(Forms.NativeParent);
|
||||
return new WatchDateTimePickerDialog(Forms.NativeParent);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,9 +54,11 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
_lazyDialog = new Lazy<IDateTimeDialog>(() => {
|
||||
var dialog = CreateDialog();
|
||||
dialog.Picker.Mode = DateTimePickerMode.Time;
|
||||
dialog.Mode = DateTimePickerMode.Time;
|
||||
dialog.Title = DialogTitle;
|
||||
dialog.DateTimeChanged += OnDialogTimeChanged;
|
||||
dialog.PickerOpened += OnPickerOpened;
|
||||
dialog.PickerClosed += OnPickerClosed;
|
||||
return dialog;
|
||||
});
|
||||
}
|
||||
|
@ -87,6 +90,8 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
if (_lazyDialog.IsValueCreated)
|
||||
{
|
||||
_lazyDialog.Value.DateTimeChanged -= OnDialogTimeChanged;
|
||||
_lazyDialog.Value.PickerOpened -= OnPickerOpened;
|
||||
_lazyDialog.Value.PickerClosed -= OnPickerClosed;
|
||||
_lazyDialog.Value.Unrealize();
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +118,9 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
if (Element.IsEnabled)
|
||||
{
|
||||
var dialog = _lazyDialog.Value;
|
||||
dialog.Picker.Time = Element.Time;
|
||||
dialog.DateTime -= dialog.DateTime.TimeOfDay;
|
||||
dialog.DateTime += Element.Time;
|
||||
|
||||
// You need to call Show() after ui thread occupation because of EFL problem.
|
||||
// Otherwise, the content of the popup will not receive focus.
|
||||
Device.BeginInvokeOnMainThread(() => dialog.Show());
|
||||
|
@ -130,7 +137,6 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
{
|
||||
UpdateTimeAndFormat();
|
||||
}
|
||||
|
||||
protected virtual void UpdateTextColor()
|
||||
{
|
||||
if (Control is IEntry ie)
|
||||
|
@ -168,6 +174,26 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
ie.FontAttributes = Element.FontAttributes;
|
||||
}
|
||||
}
|
||||
protected virtual void OnPickerOpened(object sender, EventArgs args)
|
||||
{
|
||||
if (Specific.GetUseBezelInteraction(Application.Current))
|
||||
{
|
||||
// picker included in WatchDatePickedDialog has been activated, whenever the dialog is opend.
|
||||
Forms.RotaryFocusObject = Element;
|
||||
Specific.SetActiveBezelInteractionElement(Application.Current, Element);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnPickerClosed(object sender, EventArgs args)
|
||||
{
|
||||
if (Specific.GetUseBezelInteraction(Application.Current))
|
||||
{
|
||||
if (Forms.RotaryFocusObject == Element)
|
||||
Forms.RotaryFocusObject = null;
|
||||
if (Specific.GetActiveBezelInteractionElement(Application.Current) == Element)
|
||||
Specific.SetActiveBezelInteractionElement(Application.Current, null);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateTimeAndFormat()
|
||||
{
|
||||
|
|
|
@ -118,12 +118,15 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
{
|
||||
ri.RotaryWidget?.Activate();
|
||||
Forms.RotaryFocusObject = Element;
|
||||
Specific.SetActiveBezelInteractionElement(Application.Current, Element);
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.RotaryWidget?.Deactivate();
|
||||
if (Forms.RotaryFocusObject == Element)
|
||||
Forms.RotaryFocusObject = null;
|
||||
if (Specific.GetActiveBezelInteractionElement(Application.Current) == Element)
|
||||
Specific.SetActiveBezelInteractionElement(Application.Current, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,6 @@ namespace Xamarin.Forms.Platform.Tizen.Watch
|
|||
data.Icon = (menuItem.IconImageSource as FileImageSource)?.ToAbsPath();
|
||||
}
|
||||
var genitem = _naviMenu.Append(_defaultClass, data, GenListItemType.Normal);
|
||||
genitem.SetPartColor("bg", _backgroundColor);
|
||||
_items.Add(genitem);
|
||||
data.PropertyChanged += OnItemPropertyChanged;
|
||||
}
|
||||
|
@ -223,7 +222,7 @@ namespace Xamarin.Forms.Platform.Tizen.Watch
|
|||
|
||||
_surfaceLayout.StackAbove(_naviMenu);
|
||||
|
||||
_defaultClass = new GenItemClass("1icon_1text")
|
||||
_defaultClass = new GenItemClass("1icon_2text")
|
||||
{
|
||||
GetTextHandler = (obj, part) =>
|
||||
{
|
||||
|
@ -276,10 +275,6 @@ namespace Xamarin.Forms.Platform.Tizen.Watch
|
|||
void UpdateBackgroundColor()
|
||||
{
|
||||
_naviMenu.BackgroundColor = _backgroundColor;
|
||||
foreach (var item in _items)
|
||||
{
|
||||
item.SetPartColor("bg", _backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateForegroundColor()
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace Xamarin.Forms.Platform.Tizen.Watch
|
|||
_lastTop?.Hide();
|
||||
_lastTop = InternalStack.LastOrDefault();
|
||||
_lastTop.Show();
|
||||
(_lastTop as Widget)?.SetFocus(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,6 +135,11 @@ namespace Xamarin.Forms.Platform.Tizen.Watch
|
|||
|
||||
_rootPageRenderer = ShellRendererFactory.Default.CreateItemRenderer(ShellSection);
|
||||
_viewStack.Push(_rootPageRenderer.NativeView);
|
||||
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
(_rootPageRenderer.NativeView as Widget)?.SetFocus(true);
|
||||
});
|
||||
}
|
||||
|
||||
void OnInsertRequest(NavigationRequestedEventArgs request)
|
||||
|
@ -154,6 +160,10 @@ namespace Xamarin.Forms.Platform.Tizen.Watch
|
|||
var renderer = Platform.GetOrCreateRenderer(request.Page);
|
||||
_viewStack.Push(renderer.NativeView);
|
||||
request.Task = Task.FromResult(true);
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
(renderer.NativeView as Widget)?.SetFocus(true);
|
||||
});
|
||||
}
|
||||
|
||||
void OnPopRequest(NavigationRequestedEventArgs request)
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
{
|
||||
public class SwipeViewRenderer : ViewRenderer<SwipeView, UIView>
|
||||
{
|
||||
const float OpenSwipeThresholdPercentage = 0.6f; // 60%
|
||||
const double SwipeThreshold = 250;
|
||||
const double SwipeItemWidth = 100;
|
||||
const double SwipeAnimationDuration = 0.2;
|
||||
|
@ -322,9 +323,10 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
void HandleTap()
|
||||
{
|
||||
if (_tapGestureRecognizer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isSwiping)
|
||||
return;
|
||||
|
||||
var state = _tapGestureRecognizer.State;
|
||||
|
||||
|
@ -1012,7 +1014,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
if (_swipeDirection == null)
|
||||
return;
|
||||
|
||||
var swipeThresholdPercent = 0.6 * GetSwipeThreshold();
|
||||
var swipeThresholdPercent = OpenSwipeThresholdPercentage * GetSwipeThreshold();
|
||||
|
||||
if (Math.Abs(_swipeOffset) >= swipeThresholdPercent)
|
||||
{
|
||||
|
@ -1467,7 +1469,14 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
if (_swipeDirection == null || !ValidateSwipeDirection())
|
||||
return;
|
||||
|
||||
var swipeEndedEventArgs = new SwipeEndedEventArgs(_swipeDirection.Value);
|
||||
bool isOpen = false;
|
||||
|
||||
var swipeThresholdPercent = OpenSwipeThresholdPercentage * GetSwipeThreshold();
|
||||
|
||||
if (Math.Abs(_swipeOffset) >= swipeThresholdPercent)
|
||||
isOpen = true;
|
||||
|
||||
var swipeEndedEventArgs = new SwipeEndedEventArgs(_swipeDirection.Value, isOpen);
|
||||
((ISwipeViewController)Element).SendSwipeEnded(swipeEndedEventArgs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,11 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
{
|
||||
case FlyoutBehavior.Disabled:
|
||||
PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden;
|
||||
PresentsWithGesture = false;
|
||||
TryToUpdatePresentsWithGesture(false);
|
||||
break;
|
||||
case FlyoutBehavior.Flyout:
|
||||
PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden;
|
||||
PresentsWithGesture = true;
|
||||
TryToUpdatePresentsWithGesture(true);
|
||||
_isPresented = false;
|
||||
_context.Shell.SetValueFromRenderer(Shell.FlyoutIsPresentedProperty, false);
|
||||
break;
|
||||
|
@ -145,15 +145,19 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
if (view == null)
|
||||
return;
|
||||
|
||||
var swipeViewTouched = IsSwipeView(view);
|
||||
PresentsWithGesture = !swipeViewTouched;
|
||||
if (_flyoutBehavior == FlyoutBehavior.Flyout)
|
||||
{
|
||||
var swipeViewTouched = IsSwipeView(view);
|
||||
TryToUpdatePresentsWithGesture(!swipeViewTouched);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void TouchesEnded(NSSet touches, UIEvent evt)
|
||||
{
|
||||
base.TouchesEnded(touches, evt);
|
||||
PresentsWithGesture = true;
|
||||
|
||||
TryToUpdatePresentsWithGesture(true);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
@ -177,6 +181,20 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
}
|
||||
}
|
||||
|
||||
bool TryToUpdatePresentsWithGesture(bool value)
|
||||
{
|
||||
if (_flyoutBehavior != FlyoutBehavior.Flyout)
|
||||
{
|
||||
if (PresentsWithGesture)
|
||||
PresentsWithGesture = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
PresentsWithGesture = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSwipeView(UIView view)
|
||||
{
|
||||
if (view == null)
|
||||
|
|
Загрузка…
Ссылка в новой задаче