diff options
author | Kangho Hur <kangho.hur@samsung.com> | 2017-01-20 14:05:56 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:19:00 +0900 |
commit | 11dfadcb346ae12608cfe1c0af393d8e996ef40c (patch) | |
tree | 2d48a96c8dbbee5f017f72e24f62631715abcefa /Xamarin.Forms.Platform.Tizen | |
parent | e9b96c2fd430a89837c8614b98a3950bdef87d57 (diff) | |
download | xamarin-forms-11dfadcb346ae12608cfe1c0af393d8e996ef40c.tar.gz xamarin-forms-11dfadcb346ae12608cfe1c0af393d8e996ef40c.tar.bz2 xamarin-forms-11dfadcb346ae12608cfe1c0af393d8e996ef40c.zip |
Consider TV profile as TargetIdiom
- Currently, We assumed TV as TargetIdiom.Desktop. This is because there is no TargetIdiom.TV in Xamarin.Forms mainstream.
- I'll do a PR to adding TargetIdiom.TV. Also, I'll fix it correctly when TargetIdio.TV is merged.
Change-Id: Idb7b1cd2510f9d4cecb70bd1e9d4dae1c2a61b05
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Forms.cs | 30 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs | 20 |
2 files changed, 44 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Forms.cs b/Xamarin.Forms.Platform.Tizen/Forms.cs index a12d9513..51914250 100644 --- a/Xamarin.Forms.Platform.Tizen/Forms.cs +++ b/Xamarin.Forms.Platform.Tizen/Forms.cs @@ -25,6 +25,8 @@ namespace Xamarin.Forms.Platform.Tizen readonly double scalingFactor; + readonly string profile; + public override Size PixelScreenSize { get @@ -49,6 +51,14 @@ namespace Xamarin.Forms.Platform.Tizen } } + public string Profile + { + get + { + return this.profile; + } + } + public TizenDeviceInfo(FormsApplication formsApplication) { int width = 0; @@ -60,6 +70,9 @@ namespace Xamarin.Forms.Platform.Tizen scalingFactor = 1.0; // scaling is disabled, we're using pixels as Xamarin's geometry units pixelScreenSize = new Size(width, height); scaledScreenSize = new Size(width / scalingFactor, height / scalingFactor); + + //TODO : Fix me if elm_config_profile_get() unavailable + profile = Elementary.GetProfile(); } } @@ -165,8 +178,21 @@ namespace Xamarin.Forms.Platform.Tizen }); } - // FIXME: We should consider TV and Common (Desktop) profiles also. - Device.Idiom = TargetIdiom.Phone; + // TODO: We should consider various tizen profiles such as TV, Wearable and so on. + string profile = ((TizenDeviceInfo)Device.Info).Profile; + if (profile == "mobile") + { + Device.Idiom = TargetIdiom.Phone; + } + else if (profile == "tv" || profile == "desktop") + { + Device.Idiom = TargetIdiom.Desktop; + } + else + { + Device.Idiom = TargetIdiom.Unsupported; + } + ExpressionSearch.Default = new TizenExpressionSearch(); IsInitialized = true; } diff --git a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs index bb7183a9..3fa4e756 100644 --- a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs +++ b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs @@ -79,17 +79,29 @@ namespace Xamarin.Forms.Platform.Tizen public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes) { + 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) + { + // TODO: These valuse should be updated when TV profile UX guideline released. + baseSize = 60; + baseSizeSpan = 5; + } + switch (size) { case NamedSize.Micro: - return 10; + return baseSize; case NamedSize.Small: - return 12; + return baseSize + baseSizeSpan; case NamedSize.Default: case NamedSize.Medium: - return 14; + return baseSize + (baseSizeSpan * 2); case NamedSize.Large: - return 18; + return baseSize + (baseSizeSpan * 4); default: throw new ArgumentOutOfRangeException(); } |