From 4e7799ba5c0662dcca8fecaaff1979edd3bbda8e Mon Sep 17 00:00:00 2001 From: Kangho Hur Date: Fri, 3 Feb 2017 15:21:16 +0900 Subject: Rebase Forms to upstream lastest (2.3.4-pre2) - Synced with 3c7b291. (https://github.com/xamarin/Xamarin.Forms/commit/3c7b2918b3065a81ecb4040fde09d93aae09f62d) - [Core] Device.Tizen has been added newly. - Package version has updated to 2.3.4-r190-001 Change-Id: I948fd73212744aa8c1941dc6a6d8e46eb29523af --- Xamarin.Forms.Core/Device.cs | 3 +- Xamarin.Forms.Platform.Tizen/Forms.cs | 8 +-- .../TizenPlatformServices.cs | 58 ++++------------------ packaging/xamarin-forms-tizen.spec | 6 +-- 4 files changed, 20 insertions(+), 55 deletions(-) mode change 100755 => 100644 Xamarin.Forms.Core/Device.cs diff --git a/Xamarin.Forms.Core/Device.cs b/Xamarin.Forms.Core/Device.cs old mode 100755 new mode 100644 index e1bbd510..4131b18d --- a/Xamarin.Forms.Core/Device.cs +++ b/Xamarin.Forms.Core/Device.cs @@ -16,6 +16,7 @@ namespace Xamarin.Forms public const string UWP = "UWP"; public const string WinRT = "WinRT"; public const string macOS = "macOS"; + public const string Tizen = "Tizen"; [EditorBrowsable(EditorBrowsableState.Never)] public static DeviceInfo info; @@ -200,4 +201,4 @@ namespace Xamarin.Forms public static readonly Style CaptionStyle = new Style(typeof(Label)) { BaseResourceKey = CaptionStyleKey }; } } -} \ No newline at end of file +} diff --git a/Xamarin.Forms.Platform.Tizen/Forms.cs b/Xamarin.Forms.Platform.Tizen/Forms.cs index 51914250..892faf58 100644 --- a/Xamarin.Forms.Platform.Tizen/Forms.cs +++ b/Xamarin.Forms.Platform.Tizen/Forms.cs @@ -136,8 +136,6 @@ namespace Xamarin.Forms.Platform.Tizen Elementary.ThemeOverlay(); } - Device.OS = TargetPlatform.Tizen; - // In .NETCore, AppDomain feature is not supported. // The list of assemblies returned by AppDomain.GetAssemblies() method should be registered manually. // The assembly of the executing application and referenced assemblies of it are added into the list here. @@ -184,7 +182,11 @@ namespace Xamarin.Forms.Platform.Tizen { Device.Idiom = TargetIdiom.Phone; } - else if (profile == "tv" || profile == "desktop") + else if (profile == "tv") + { + Device.Idiom = TargetIdiom.TV; + } + else if ( profile == "desktop") { Device.Idiom = TargetIdiom.Desktop; } diff --git a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs index 3fa4e756..f3a72d02 100644 --- a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs +++ b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs @@ -6,6 +6,7 @@ using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; using System.Net.Http; +using Xamarin.Forms.Internals; using ElmSharp; namespace Xamarin.Forms.Platform.Tizen @@ -21,42 +22,13 @@ namespace Xamarin.Forms.Platform.Tizen s_context = SynchronizationContext.Current; } - public class _Timer : ITimer + public class TizenTicker : Ticker { - readonly Timer timer; + readonly Timer _timer; - public _Timer(Timer timer) + public TizenTicker() { - this.timer = timer; - } - - #region ITimer implementation - public void Change(int dueTime, int period) - { - timer.Change(dueTime, period); - } - public void Change(long dueTime, long period) - { - timer.Change((int)dueTime, (int)period); - } - public void Change(TimeSpan dueTime, TimeSpan period) - { - timer.Change(dueTime, period); - } - public void Change(uint dueTime, uint period) - { - timer.Change((int)dueTime, (int)period); - } - #endregion - } - - public class Ticker : Xamarin.Forms.Internals.Ticker - { - readonly ITimer _timer; - - public Ticker() - { - _timer = new _Timer(new Timer((object o) => HandleElapsed(o), this, Timeout.Infinite, Timeout.Infinite)); + _timer = new Timer((object o) => HandleElapsed(o), this, Timeout.Infinite, Timeout.Infinite); } protected override void EnableTimer() @@ -74,7 +46,6 @@ namespace Xamarin.Forms.Platform.Tizen s_context.Post((o) => SendSignals(-1), null); } } - #region IPlatformServices implementation public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes) @@ -82,9 +53,8 @@ namespace Xamarin.Forms.Platform.Tizen double baseSize = 10; double baseSizeSpan = 2; - // TODO: Fix me when TargetIdiom.TV avaialbe on mainline // In case of TV profile The base named size sholud be lager than mobile profile - if (Device.Idiom == TargetIdiom.Desktop) + if (Device.Idiom == TargetIdiom.TV) { // TODO: These valuse should be updated when TV profile UX guideline released. baseSize = 60; @@ -124,9 +94,9 @@ namespace Xamarin.Forms.Platform.Tizen } } - public Xamarin.Forms.Internals.Ticker CreateTicker() + public Ticker CreateTicker() { - return new Ticker(); + return new TizenTicker(); } public void StartTimer(TimeSpan interval, Func callback) @@ -166,16 +136,6 @@ namespace Xamarin.Forms.Platform.Tizen return AppDomain.CurrentDomain.GetAssemblies(); } - public ITimer CreateTimer(Action callback, object state, int dueTime, int period) - { - return new _Timer(new Timer((object o) => callback(o), state, dueTime, period)); - } - - public ITimer CreateTimer(Action callback, object state, TimeSpan dueTime, TimeSpan period) - { - return new _Timer(new Timer((object o) => callback(o), state, dueTime, period)); - } - public IIsolatedStorageFile GetUserStoreForApplication() { return new TizenIsolatedStorageFile(); @@ -202,6 +162,8 @@ namespace Xamarin.Forms.Platform.Tizen } } + public string RuntimePlatform => Device.Tizen; + #endregion // In .NETCore, AppDomain is not supported. The list of the assemblies should be generated manually. diff --git a/packaging/xamarin-forms-tizen.spec b/packaging/xamarin-forms-tizen.spec index 968fd92a..0510a4b0 100644 --- a/packaging/xamarin-forms-tizen.spec +++ b/packaging/xamarin-forms-tizen.spec @@ -1,7 +1,7 @@ -%define XF_VERSION 2.3.3.175 +%define XF_VERSION 2.3.4 # Increase this XF_TIZEN_VERSION when any public APIs of Xamarin.Forms.Platform.Tizen are changed. -%define XF_TIZEN_VERSION beta-007 +%define XF_TIZEN_VERSION r190-001 Name: xamarin-forms-tizen Summary: Xamarin.Forms for Tizen platform @@ -12,7 +12,7 @@ Group: Graphics & UI Framework/Libraries Source0: %{name}-%{version}.tar.gz Source1: %{name}.manifest -%define NUPKG_VERSION %{XF_VERSION}%{?XF_PRETAG:-%{XF_PRETAG}}-%{XF_TIZEN_VERSION} +%define NUPKG_VERSION %{XF_VERSION}-%{XF_TIZEN_VERSION} AutoReqProv: no ExcludeArch: aarch64 -- cgit v1.2.3