<Compile Include="Utils\AppControlUtils.cs" />
<Compile Include="Utils\ApplicationManagerUtils.cs" />
<Compile Include="Utils\AppShortcutStorage.cs" />
+ <Compile Include="Utils\ISystemSettings.cs" />
<Compile Include="Utils\SizeUtils.cs" />
<Compile Include="Utils\DateUtils.cs" />
<Compile Include="Utils\DebuggingUtils.cs" />
IconPath = "ic_tizen_home_list_mediahub_normal.png",
Action = new AppControlAction
{
- AppID = "org.tizen.mediahub",
+ AppID = "org.tizen.xamediahub",
}
};
AppID = "org.tizen.settings",
});
- pinnedAppsInfo.Add(new AppShortcutInfo()
- {
- AppID = "org.tizen.dpm-toolkit",
- });
-
- pinnedAppsInfo.Add(new AppShortcutInfo()
- {
- AppID = "org.tizen.mediahub",
- });
-
pinnedAppsInfo.Add(new AppShortcutInfo()
{
AppID = "org.tizen.apps",
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace LibTVRefCommonPortable.Utils
+{
+ public interface ISystemSettings
+ {
+ bool GetSystemModelName(out string modelName);
+ }
+}
/// </summary>
public static int ScreenWidth { set; get; }
+ /// <summary>
+ /// Device DPI
+ /// </summary>
+ public static double Dpi { set; get; }
+
/// <summary>
/// Font Scale ratio
/// </summary>
public static double ScaleRatio { set; get; }
+ /// <summary>
+ /// Platform Model enumerations
+ /// </summary>
+ private enum PlatformModel
+ {
+ TV,
+ Emulator,
+ Other,
+ }
+
+ /// <summary>
+ /// Platform Model Name
+ /// </summary>
+ private static PlatformModel ModelName = PlatformModel.TV;
+
+ /// <summary>
+ /// Set model name of running device.
+ /// </summary>
+ /// <param name="modelName">a model name</param>
+ public static void SetModelName(string modelName)
+ {
+ if (modelName == null)
+ {
+ return;
+ }
+
+ DebuggingUtils.Dbg("ModelName is " + modelName);
+ switch (modelName.ToLower()[0])
+ {
+ case 'e':
+ ModelName = PlatformModel.Emulator;
+ break;
+
+ default:
+ case 'x':
+ ModelName = PlatformModel.Other;
+ break;
+ }
+ }
+
/// <summary>
/// A method provides a converted height size.
/// </summary>
/// <returns>A date</returns>
public static int GetFontSize(int fontBaseSize)
{
- return Convert.ToInt32(((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)(ScreenHeight)) * ScaleRatio);
+ switch (ModelName)
+ {
+ case PlatformModel.Emulator:
+ DebuggingUtils.Dbg("Emulator, Font size = " + fontBaseSize + " => " + ((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio);
+ return Convert.ToInt32(((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio);
+
+ default:
+ case PlatformModel.Other:
+ case PlatformModel.TV:
+ // TODO : Remove this if the TV/Other device's dpi is correctly changed.
+ double tempAdjustmentRatio = 0.3D;
+ DebuggingUtils.Dbg("TV/Other, Font size = " + fontBaseSize + " => " + ((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio * tempAdjustmentRatio);
+ return Convert.ToInt32(((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio * tempAdjustmentRatio);
+ }
}
}
}
<Compile Include="Ports\AppControlPort.cs" />
<Compile Include="Ports\ApplicationManagerPort.cs" />
<Compile Include="Ports\DbgPort.cs" />
+ <Compile Include="Ports\SystemSettingsPort.cs" />
<Compile Include="Ports\WindowPort.cs" />
<Compile Include="Ports\FileSystemPort.cs" />
<Compile Include="Ports\FileSystemWatcherPort.cs" />
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using LibTVRefCommonPortable.Utils;
+using Xamarin.Forms.Platform.Tizen.Native;
+
+
+namespace LibTVRefCommonTizen.Ports
+{
+ public class SystemSettingsPort : ISystemSettings
+ {
+ public static readonly int ErrorNone = 0;
+ public static readonly string KeyModelName = "http://tizen.org/system/model_name";
+
+ internal class SystemInfo
+ {
+ [DllImport("libcapi-system-info.so.0", EntryPoint = "system_info_get_platform_string", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern int SystemInfoGetPlatformString(string key, out string value);
+ }
+
+
+ public bool GetSystemModelName(out string modelName)
+ {
+ if (SystemInfo.SystemInfoGetPlatformString(KeyModelName, out modelName) != ErrorNone)
+ {
+ modelName = "";
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
protected override void OnCreate()
{
base.OnCreate();
- var app = new App(MainWindow.ScreenSize.Width, MainWindow.ScreenSize.Height, ElmSharp.Elementary.GetScale());
+ var app = new App(MainWindow.ScreenSize.Width, MainWindow.ScreenSize.Height, MainWindow.ScreenDpi.X, ElmSharp.Elementary.GetScale());
notification = app;
AppResourcePath = DirectoryInfo.Resource;
Xamarin.Forms.DependencyService.Register<FileSystemWatcherPort>();
Xamarin.Forms.DependencyService.Register<ApplicationManagerPort>();
Xamarin.Forms.DependencyService.Register<FileSystemPort>();
+ Xamarin.Forms.DependencyService.Register<SystemSettingsPort>();
Xamarin.Forms.Platform.Tizen.Forms.Init(instance);
TizenFormsExtension.Init();
/// <see cref="MainPage"/>
/// <param name="screenWidth">Screen Width</param>
/// <param name="screenHeight">Screen Height</param>
+ /// <param name="dpi">Screen DPI</param>
/// <param name="scaleRatio">Scale ratio</param>
- public App(int screenWidth, int screenHeight, double scaleRatio)
+ public App(int screenWidth, int screenHeight, int dpi, double scaleRatio)
{
SizeUtils.ScreenWidth = screenWidth;
SizeUtils.ScreenHeight = screenHeight;
+ SizeUtils.Dpi = dpi;
SizeUtils.ScaleRatio = scaleRatio;
+ string modelName;
+ if (DependencyService.Get<ISystemSettings>().GetSystemModelName(out modelName))
+ {
+ SizeUtils.SetModelName(modelName);
+ }
+
MainPage = new MainPage();
}
protected override void OnCreate()
{
base.OnCreate();
- var app = new App(MainWindow.ScreenSize.Width, MainWindow.ScreenSize.Height, ElmSharp.Elementary.GetScale());
+ var app = new App(MainWindow.ScreenSize.Width, MainWindow.ScreenSize.Height, MainWindow.ScreenDpi.X, ElmSharp.Elementary.GetScale());
notification = app;
AppResourcePath = DirectoryInfo.Resource;
global::Xamarin.Forms.DependencyService.Register<ApplicationManagerPort>();
global::Xamarin.Forms.DependencyService.Register<FileSystemPort>();
global::Xamarin.Forms.DependencyService.Register<WindowPort>();
+ global::Xamarin.Forms.DependencyService.Register<SystemSettingsPort>();
TizenFormsExtension.Init();
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
app.Run(args);
/// </summary>
/// <param name="screenWidth">Screen Width</param>
/// <param name="screenHeight">Screen Height</param>
+ /// <param name="dpi">Screen DPI</param>
/// <param name="scaleRatio">Scale ratio</param>
- public App(int screenWidth, int screenHeight, double scaleRatio)
+ public App(int screenWidth, int screenHeight, int dpi, double scaleRatio)
{
SizeUtils.ScreenWidth = screenWidth;
SizeUtils.ScreenHeight = screenHeight;
+ SizeUtils.Dpi = dpi;
SizeUtils.ScaleRatio = scaleRatio;
+ string modelName;
+ if (DependencyService.Get<ISystemSettings>().GetSystemModelName(out modelName))
+ {
+ SizeUtils.SetModelName(modelName);
+ }
+
MainPage = new MainPage();
}