summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-01-20 09:31:55 (GMT)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-01-20 09:31:55 (GMT)
commit20a3a25558ca754165df96d8513724f4e40ce78c (patch)
tree7f2e0aa46f54bd7c00617c9758f9d36e2155bf1f
parente2735ccb533b9fc2d5897dfde148d48132f43ee4 (diff)
parentc2ef6d0d2e21db684b47fb57e8bce40a2372fbd9 (diff)
downloadxamarin-forms-20a3a25558ca754165df96d8513724f4e40ce78c.zip
xamarin-forms-20a3a25558ca754165df96d8513724f4e40ce78c.tar.gz
xamarin-forms-20a3a25558ca754165df96d8513724f4e40ce78c.tar.bz2
* changes: Consider TV profile as TargetIdiom Apply to default layout for the forms application
-rw-r--r--Xamarin.Forms.Platform.Tizen/Forms.cs30
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Window.cs26
-rw-r--r--Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs20
-rw-r--r--packaging/xamarin-forms-tizen.spec2
4 files changed, 70 insertions, 8 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Forms.cs b/Xamarin.Forms.Platform.Tizen/Forms.cs
index a12d951..5191425 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/Native/Window.cs b/Xamarin.Forms.Platform.Tizen/Native/Window.cs
index 87a54cd..7587e17 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Window.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Window.cs
@@ -1,11 +1,13 @@
using System;
using ElmSharp;
using EWindow = ElmSharp.Window;
+using ELayout = ElmSharp.Layout;
namespace Xamarin.Forms.Platform.Tizen.Native
{
public class Window : EWindow
{
+ ELayout _layout;
Conformant _conformant;
/// <summary>
@@ -69,13 +71,26 @@ namespace Xamarin.Forms.Platform.Tizen.Native
}
}
+ public ELayout BaseLayout
+ {
+ get
+ {
+ return _layout;
+ }
+
+ private set
+ {
+ _layout = value;
+ }
+ }
+
/// <summary>
/// Sets the main page of Window.
/// </summary>
/// <param name="content">ElmSharp.EvasObject type page to be set.</param>
public void SetMainPage(EvasObject content)
{
- _conformant.SetContent(content);
+ _layout.SetContent(content);
}
void Initialize()
@@ -112,6 +127,15 @@ namespace Xamarin.Forms.Platform.Tizen.Native
_conformant.SetWeight(1.0, 1.0); // expand
_conformant.Show();
+ // Create the base (default) layout for the application
+ _layout = new ELayout(_conformant);
+ _layout.SetAlignment(-1.0, -1.0); // fill
+ _layout.SetWeight(1.0, 1.0); // expand
+ _layout.SetTheme("layout", "application", "default");
+ _layout.Show();
+
+ _conformant.SetContent(_layout);
+ BaseLayout = _layout;
AvailableOrientations = DisplayOrientations.Portrait | DisplayOrientations.Landscape | DisplayOrientations.PortraitFlipped | DisplayOrientations.LandscapeFlipped;
}
DisplayOrientations GetDisplayOrientation()
diff --git a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs
index bb7183a..3fa4e75 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();
}
diff --git a/packaging/xamarin-forms-tizen.spec b/packaging/xamarin-forms-tizen.spec
index 97b77df..d197860 100644
--- a/packaging/xamarin-forms-tizen.spec
+++ b/packaging/xamarin-forms-tizen.spec
@@ -1,7 +1,7 @@
%define XF_VERSION 2.3.3.175
# Increase this XF_TIZEN_VERSION when any public APIs of Xamarin.Forms.Platform.Tizen are changed.
-%define XF_TIZEN_VERSION beta-004
+%define XF_TIZEN_VERSION beta-005
Name: xamarin-forms-tizen
Summary: Xamarin.Forms for Tizen platform