From: JH Choi Date: Fri, 1 Sep 2017 06:49:35 +0000 (+0900) Subject: TV Home/Apps Migration X-Git-Tag: submit/tizen_4.0/20170911.075016~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5bc9f22ddfafefb021b300afd653279682bbde3a;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git TV Home/Apps Migration Change-Id: If19587d2eb7c777d6a6e4890cbfbbb0acc22275a Signed-off-by: JH Choi --- diff --git a/HomeUnitTest/AppShortcutTestCases.cs b/HomeUnitTest/AppShortcutTestCases.cs deleted file mode 100644 index 0484e2e..0000000 --- a/HomeUnitTest/AppShortcutTestCases.cs +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using LibTVRefCommonPortable.Models; -using System.Threading.Tasks; -using System.Linq; -using LibTVRefCommonPortable.DataModels; - -namespace HomeUnitTest -{ - /// - /// A test cases for AppShortcutController - /// - [TestClass] - public class AppShortcutTestCases - { - /// - /// A instance of AppShortcutController - /// - private AppShortcutController controller; - - /// - /// All Apps app shortcut name - /// - private static readonly string AllApps = "All apps"; - - /// - /// MediaHub app shortcut name - /// - private static readonly string MediaHub = "Media Hub"; - - /// - /// Add pin app shortcut name - /// - private static readonly string AddPin = "Add pin"; - - /// - /// A constructor that initialize AppShortcutController instance. - /// - public AppShortcutTestCases() - { - controller = new AppShortcutController(); - } - - #region 추가 테스트 특성 - // - // 테스트를 작성할 때 다음 추가 특성을 사용할 수 있습니다. - // - // ClassInitialize를 사용하여 클래스의 첫 번째 테스트를 실행하기 전에 코드를 실행합니다. - // [ClassInitialize()] - // public static void MyClassInitialize(TestContext testContext) { } - // - // ClassCleanup을 사용하여 클래스의 테스트를 모두 실행한 후에 코드를 실행합니다. - // [ClassCleanup()] - // public static void MyClassCleanup() { } - // - // TestInitialize를 사용하여 각 테스트를 실행하기 전에 코드를 실행합니다. - // [TestInitialize()] - // public void MyTestInitialize() { } - // - // TestCleanup을 사용하여 각 테스트를 실행한 후에 코드를 실행합니다. - // [TestCleanup()] - // public void MyTestCleanup() { } - // - #endregion - - - [TestMethod] - public async Task AppShortcutGetInstalledAppsTest() - { - var installedApps = await controller.GetInstalledApps(); - - foreach (var app in installedApps) - { - Console.Out.WriteLine("App ID : " + app.AppID); - Console.Out.WriteLine("Installed Date : " + app.Installed); - - Assert.AreNotEqual(app.AppID, null, - "AppID is required!!!"); - - // Err : CurrentStateDescription should not be null - Assert.AreNotEqual(app.CurrentStateDescription, null, - "CurrentStateDescription is null!!!"); - - // Err : type of Action should be the AppControlAction - Assert.IsTrue(app.CurrentStateDescription.Action is AppControlAction, - "AppShortcut's action should be AppControlAction!!!"); - - // Err : Action in CurrentStateDescription should not be null - Assert.AreNotEqual(app.CurrentStateDescription.Action, null, - "StateDescription should have Action!!!"); - - // Err : Label in CurrentStateDescription should not be null - Assert.AreNotEqual(app.CurrentStateDescription.Label, null, - "StateDescription should have Label!!!"); - - // Err : IconPath in CurrentStateDescription should not be null - Assert.AreNotEqual(app.CurrentStateDescription.IconPath, null, - "StateDescription should have App Icon!!!"); - - // Err : removable app property check - if (app.CurrentStateDescription.Label.Contains("removable") && - app.IsRemovable == false) - { - Assert.Fail("Setting Removable flag is wrong"); - } - - // Err : Invalid state description removing. - if (app.CurrentStateDescription.Label.Contains("invalid")) - { - Assert.Fail("Invalid App Shortcut included!!!"); - } - } - } - - [TestMethod] - public void AppShortcutGetDefaultShortcutsTest() - { - var defaultShortcuts = controller.GetDefaultShortcuts(); - - // Req : Order of default shortcuts is All apps > Media Hub > Add pin - Assert.AreNotEqual(defaultShortcuts.ElementAt(0).CurrentStateDescription, - null, "All Apps CurrentStateDescription is invalid!!!"); - Assert.AreEqual(defaultShortcuts.ElementAt(0).CurrentStateDescription.Label, AllApps); - - Assert.AreNotEqual(defaultShortcuts.ElementAt(1).CurrentStateDescription, - null, "Media Hub CurrentStateDescription is invalid!!!"); - Assert.AreEqual(defaultShortcuts.ElementAt(1).CurrentStateDescription.Label, MediaHub); - - Assert.AreNotEqual(defaultShortcuts.ElementAt(2).CurrentStateDescription, - null, "Add pin CurrentStateDescription is invalid!!!"); - Assert.AreEqual(defaultShortcuts.ElementAt(2).CurrentStateDescription.Label, AddPin); - } - - [TestMethod] - public async Task AppShortcutGetPinnedAppsWithDefaultShortcutsTest() - { - var pinnedApps = await controller.GetPinnedAppsWithDefaultShortcuts(); - - // Req : A Maximum number of pinned apps is 10. + All apps, Media Hub, Add pin - Assert.IsTrue(pinnedApps.Count() <= 13, "A Maximum number of pinned apps is 10!!! NOT " + pinnedApps.Count()); - - // Req : Order of default shortcuts is All apps > Media Hub > Add pin - Assert.AreNotEqual(pinnedApps.ElementAt(0).CurrentStateDescription, - null, "All Apps CurrentStateDescription is invalid!!!"); - Assert.AreEqual(pinnedApps.ElementAt(0).CurrentStateDescription.Label, AllApps); - - Assert.AreNotEqual(pinnedApps.ElementAt(1).CurrentStateDescription, - null, "Media Hub CurrentStateDescription is invalid!!!"); - Assert.AreEqual(pinnedApps.ElementAt(1).CurrentStateDescription.Label, MediaHub); - - Assert.AreNotEqual(pinnedApps.ElementAt(pinnedApps.Count() - 1).CurrentStateDescription, - null, "Add pin CurrentStateDescription is invalid!!!"); - Assert.AreEqual(pinnedApps.ElementAt(pinnedApps.Count() - 1).CurrentStateDescription.Label, AddPin); - - foreach (var shortcut in pinnedApps) - { - // Err : shortcut should be AppShortcutInfo - if ((shortcut is AppShortcutInfo) == false) - { - Assert.Fail("Invalid ShortCut type!!!"); - } - - var app = shortcut as AppShortcutInfo; - - Console.Out.WriteLine("ID : " + app.AppID); - Console.Out.WriteLine("Label : " + app.CurrentStateDescription.Label); - Console.Out.WriteLine("Installed : " + app.Installed); - - // Err : CurrentStateDescription should not be null - Assert.AreNotEqual(app.CurrentStateDescription, null, - "StateDescription CurrentStateDescription is null!!!"); - - // Err : Both ID and Label should not be null - Assert.IsFalse((app.AppID == null || app.AppID.Length < 1) && - (app.CurrentStateDescription.Label == null || app.CurrentStateDescription.Label.Length < 1), - "Both ID and Label should not be null!!!"); - - // Err : AppID should be exist - if (app.AppID == null) - { - if (app.CurrentStateDescription.Label.CompareTo(AllApps) != 0 && - app.CurrentStateDescription.Label.CompareTo(MediaHub) != 0 && - app.CurrentStateDescription.Label.CompareTo(AddPin) != 0) - { - Assert.Fail("App ID is missing!!! " + app.CurrentStateDescription.Label); - } - } - else - { - // Req : TVHome, TVApps, MediaHub, Settings should not be pinned. - Assert.IsFalse(app.AppID.Contains("xahome"), "TVHome should not be pinned"); - Assert.IsFalse(app.AppID.Contains("xaapps"), "TVApps should not be pinned"); - Assert.IsFalse(app.AppID.Contains("xamediahub"), "MediaHub should not be pinned"); - Assert.IsFalse(app.AppID.Contains("settings"), "Settings should not be pinned"); - } - - // Err : removable app property check - if (app.CurrentStateDescription.Label.Contains("removable") && - app.IsRemovable == false) - { - Assert.Fail("Removable is failed"); - } - - // Err : Invalid state description removing. - if (app.CurrentStateDescription.Label.Contains("invalid")) - { - Assert.Fail("Invalid App Shortcut included!!!"); - } - } - } - - [TestMethod] - public async Task AppShortcutGetPinnedAppsAppIDsTest() - { - var pinnedAppsIDs = await controller.GetPinnedAppsAppIDs(); - - // Req : A Maximum number of pinned apps is 10. - Assert.IsTrue(pinnedAppsIDs.Count() <= 10, - "A Maximum number of pinned apps is 10!!! NOT " + pinnedAppsIDs.Count()); - - foreach (var appID in pinnedAppsIDs.Keys) - { - // Err : AppID should not be null or empty. - Assert.AreNotEqual(appID, null, "App ID should not be null"); - Assert.IsFalse(appID.Length < 1, "App ID should not be empty"); - - // Req : TVHome, TVApps, MediaHub, Settings should not be pinned. - Assert.IsFalse(appID.Contains("xahome"), "TVHome should not be pinned"); - Assert.IsFalse(appID.Contains("xaapps"), "TVApps should not be pinned"); - Assert.IsFalse(appID.Contains("xamediahub"), "MediaHub should not be pinned"); - Assert.IsFalse(appID.Contains("settings"), "Settings should not be pinned"); - } - } - } -} diff --git a/HomeUnitTest/HomeUnitTest.csproj b/HomeUnitTest/HomeUnitTest.csproj deleted file mode 100755 index 3bba917..0000000 --- a/HomeUnitTest/HomeUnitTest.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - - - Debug - AnyCPU - {1F2DB8A0-7D1E-4BA3-BF27-335D033C572C} - Library - Properties - HomeUnitTest - HomeUnitTest - v4.6.1 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - true - full - false - bin\Debug\ - TRACE;DEBUG - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - 2.3.5-v00015 - - - 2.4.0-r266-001 - - - 1.1.11 - - - 1.1.11 - - - - - - - - - - - {67f9d3a8-f71e-4428-913f-c37ae82cdb24} - LibTVRefCommonPortable - - - - - - - - - - \ No newline at end of file diff --git a/HomeUnitTest/ManagedAppsTestCases.cs b/HomeUnitTest/ManagedAppsTestCases.cs deleted file mode 100644 index 4d12be1..0000000 --- a/HomeUnitTest/ManagedAppsTestCases.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using LibTVRefCommonPortable.Models; - -namespace HomeUnitTest -{ - /// - /// A Test cases for ManagedApps class. - /// - [TestClass] - public class ManagedAppsTestCases - { - /// - /// TVHome package ID - /// - private static readonly string Home = "org.tizen.xahome"; - - /// - /// TVApps package ID - /// - private static readonly string Apps = "org.tizen.xaapps"; - - /// - /// Mediahub package ID - /// - private static readonly string Mediahub = "org.tizen.xamediahub"; - - /// - /// Settings package ID - /// - private static readonly string Settings = "org.tizen.settings"; - - [TestMethod] - public void ManagerAppsIsHiddenRecentAppTest() - { - Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Home), "TVHome should not be hidden in Recents"); - Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Apps), "Apps should not be hidden in Recents"); - Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Mediahub), "Mediahub should not be hidden in Recents"); - Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Settings), "Settings should not be hidden in Recents"); - } - - [TestMethod] - public void ManagerAppsIsNonPinnableAppsTest() - { - Assert.IsTrue(ManagedApps.IsNonPinnableApps(Home), "TVHome should not be pinned"); - Assert.IsTrue(ManagedApps.IsNonPinnableApps(Apps), "Apps should not be pinned"); - Assert.IsTrue(ManagedApps.IsNonPinnableApps(Mediahub), "Mediahub should not be pinned"); - Assert.IsTrue(ManagedApps.IsNonPinnableApps(Settings), "Settings should not be pinned"); - } - } -} diff --git a/HomeUnitTest/Properties/AssemblyInfo.cs b/HomeUnitTest/Properties/AssemblyInfo.cs deleted file mode 100644 index 695ffc8..0000000 --- a/HomeUnitTest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("HomeUnitTest")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("HomeUnitTest")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: Guid("1f2db8a0-7d1e-4ba3-bf27-335d033c572c")] - -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/HomeUnitTest/RecentTestCases.cs b/HomeUnitTest/RecentTestCases.cs deleted file mode 100644 index b0fae05..0000000 --- a/HomeUnitTest/RecentTestCases.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using LibTVRefCommonPortable.Models; -using LibTVRefCommonPortable.DataModels; -using System.Linq; - -namespace HomeUnitTest -{ - /// - /// A test cases for RecentShortcutController - /// - [TestClass] - public class RecentTestCases - { - /// - /// A instance of RecentShortcutController - /// - private RecentShortcutController controller; - - /// - /// A constructor that initializes RecentShortcutController instance. - /// - public RecentTestCases() - { - controller = new RecentShortcutController(); - } - - [TestMethod] - public void RecentGetListTest() - { - var recents = controller.GetList(); - - // Req : MAX number of recent = 10 - if (recents.Count() > 10) - { - Assert.Fail("Too many Recent!!!, Returned = " + recents.Count()); - } - - bool isAllMedias = true; - bool isAllApps = true; - - foreach (var recent in recents) - { - Console.Out.WriteLine("-----------------------------"); - Console.Out.WriteLine("Type : " + recent.Type); - Console.Out.WriteLine("ID : " + recent.Id); - Console.Out.WriteLine("Date : " + recent.Date); - Console.Out.WriteLine("ScreenShot : " + recent.ScreenshotPath); - - switch (recent.Type) - { - case RecentShortcutType.Application: - isAllMedias = false; - break; - case RecentShortcutType.Media: - isAllApps = false; - break; - } - - // Req : Invalid Recent(id, label has 'invalid') should not included!!! - if (recent.CurrentStateDescription == null || - recent.CurrentStateDescription.Label.ToLower().Contains("invalid")) - { - Assert.Fail("Recent including invalid items!!!, " + recent.Id); - } - } - - // Err : Test Sample Recents are consist of App and Media types both. - if (isAllMedias || isAllApps) - { - Assert.Fail("Invalid Recent list, All Media({0}), All Apps({1})", isAllMedias, isAllApps); - } - } - } -} diff --git a/HomeUnitTest/Settings.StyleCop b/HomeUnitTest/Settings.StyleCop deleted file mode 100644 index 837530c..0000000 --- a/HomeUnitTest/Settings.StyleCop +++ /dev/null @@ -1,722 +0,0 @@ - - - NoMerge - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - \ No newline at end of file diff --git a/HomeUnitTest/packages.config b/HomeUnitTest/packages.config deleted file mode 100644 index 46675bd..0000000 --- a/HomeUnitTest/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/LibCommon.Shared/DataModels/AppControlAction.cs b/LibCommon.Shared/DataModels/AppControlAction.cs new file mode 100644 index 0000000..e30afe4 --- /dev/null +++ b/LibCommon.Shared/DataModels/AppControlAction.cs @@ -0,0 +1,65 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using System.Collections.Generic; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// A class defines App Control behavior. + /// + public class AppControlAction : IAction + { + /// + /// A target application ID + /// + public string AppID { get; set; } + + /// + /// A dictionary which has extra data for App Control + /// + protected Dictionary extraData; + + /// + /// A dictionary which has extra data for App Control + /// + public Dictionary ExtraData + { + get + { + if (extraData == null) + { + extraData = new Dictionary(); + } + + return extraData; + } + } + + /// + /// A method which invoke an App Control to the application of the AppID + /// + /// a next state after App Control invocation + public string Execute() + { + // Warn : Do NOT pass 'E'xtraData, it will create a new Dictionary and it might cause unexpected situation. + AppControlUtils.SendLaunchRequest(AppID, extraData); + return "default"; + } + } +} diff --git a/LibCommon.Shared/DataModels/AppShortcutInfo.cs b/LibCommon.Shared/DataModels/AppShortcutInfo.cs new file mode 100644 index 0000000..7aeff96 --- /dev/null +++ b/LibCommon.Shared/DataModels/AppShortcutInfo.cs @@ -0,0 +1,232 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using System; +using System.Xml.Serialization; +using Xamarin.Forms; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// A class defines App Shortcut button + /// + public class AppShortcutInfo : ShortcutInfo + { + /// + /// An application ID of the App Shortcut. + /// + public string AppID { get; set; } + + /// + /// An App Shortcut status. + /// + [XmlIgnore] + public string Status { get; set; } + + /// + /// A flag indicates that a App Shortcut is checked or not. + /// + [XmlIgnore] + private bool isChecked; + + /// + /// A flag indicates that a App Shortcut is checked or not. + /// + [XmlIgnore] + public bool IsChecked + { + get + { + return isChecked; + } + + set + { + if (isChecked != value) + { + isChecked = value; + OnPropertyChanged("IsChecked"); + } + } + } + + /// + /// A flag indicates that a App Shortcut is pinned or not. + /// + [XmlIgnore] + private bool isPinned; + + /// + /// A flag indicates that a App Shortcut is pinned or not. + /// + [XmlIgnore] + public bool IsPinned + { + get + { + return isPinned; + } + + set + { + if (isPinned != value) + { + isPinned = value; + OnPropertyChanged("IsPinned"); + } + } + } + + /// + /// A flag indicates that a App Shortcut can be removed. + /// + [XmlIgnore] + public bool IsRemovable { get; set; } + + /// + /// A flag indicates that a App Shortcut is focused or not. + /// + [XmlIgnore] + private bool isFocused; + + /// + /// A flag indicates that a App Shortcut is focused or not. + /// + [XmlIgnore] + public bool IsFocused + { + get + { + return isFocused; + } + + set + { + if (isFocused != value) + { + isFocused = value; + OnPropertyChanged("IsFocused"); + } + } + } + + /// + /// A flag indicates that a App Shortcut is dimmed or not. + /// + [XmlIgnore] + private bool isDim; + + /// + /// A flag indicates that a App Shortcut is dimmed or not. + /// + [XmlIgnore] + public bool IsDim + { + get + { + return isDim; + } + + set + { + if (isDim != value) + { + isDim = value; + OnPropertyChanged("IsDim"); + } + } + } + + /// + /// A flag indicates that a App Shortcut is showing options or not. + /// + [XmlIgnore] + private bool isShowOptions; + + /// + /// A flag indicates that a App Shortcut is showing options or not. + /// + [XmlIgnore] + public bool IsShowOptions + { + get + { + return isShowOptions; + } + + set + { + if (isShowOptions != value) + { + isShowOptions = value; + OnPropertyChanged("IsShowOptions"); + } + } + } + + /// + /// An app installed time. + /// + [XmlIgnore] + public DateTime Installed { get; set; } + + /// + /// A pin command of the Option menu. + /// + [XmlIgnore] + public Command OptionMenuPinToggleCommand { get; set; } + + /// + /// A deleting app command of the Option menu. + /// + [XmlIgnore] + public Command OptionMenuDeleteCommand { get; set; } + + [XmlIgnore] + public Command ToDefaultCommand { get; set; } + + /// + /// A Constructor. + /// Initializes AppShortcutInfo. + /// + public AppShortcutInfo() + { + OptionMenuPinToggleCommand = new Command(() => + { + MessagingCenter.Send(this, "OptionMenuPinToggle", AppID); + }); + + OptionMenuDeleteCommand = new Command(() => + { + MessagingCenter.Send(this, "OptionMenuDelete", AppID); + }); + + ToDefaultCommand = new Command(() => + { + MessagingCenter.Send(this, "ChangeToDefaultMode"); + }); + } + + /// + /// Update State of a shortcut. + /// + public override void UpdateState() + { + SetCurrentState("default"); + } + } +} diff --git a/LibCommon.Shared/DataModels/CommandAction.cs b/LibCommon.Shared/DataModels/CommandAction.cs new file mode 100644 index 0000000..220c7c5 --- /dev/null +++ b/LibCommon.Shared/DataModels/CommandAction.cs @@ -0,0 +1,51 @@ +/* + * 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; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// A Action class which can invoke a Command + /// + public class CommandAction : IAction + { + /// + /// A next description after invocation of the Command. + /// + public string NextStateDescription { get; set; } + + /// + /// A Command to be executed + /// + public event EventHandler Command; + + /// + /// A Command parameter. + /// + public string CommandParameter { get; set; } + + /// + /// A method execute a action. + /// + /// A next statue of a Shortcut. + public string Execute() + { + Command?.Invoke(this, CommandParameter); + return NextStateDescription; + } + } +} diff --git a/LibCommon.Shared/DataModels/FileSystemEventCustomArgs.cs b/LibCommon.Shared/DataModels/FileSystemEventCustomArgs.cs new file mode 100644 index 0000000..b608ea9 --- /dev/null +++ b/LibCommon.Shared/DataModels/FileSystemEventCustomArgs.cs @@ -0,0 +1,58 @@ +/* + * 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; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// A class contains file system event arguments. + /// + public class FileSystemEventCustomArgs : EventArgs + { + /// + /// Initializes a new instance of the System.IO.FileSystemEventArgs class. + /// + /// One of the System.IO.WatcherChangeTypes values, which represents the kind of change detected in the file system. + /// The root directory of the affected file or directory. + /// The name of the affected file or directory. + public FileSystemEventCustomArgs(WatcherType changeType, string directory, string name) + { + ChangeType = changeType; + FullPath = directory; + Name = name; + } + + /// + /// Gets the type of directory event that occurred. + /// One of the System.IO.WatcherChangeTypes values that represents the kind of change + /// detected in the file system. + /// + public WatcherType ChangeType { set; get; } + + /// + /// Gets the fully qualified path of the affected file or directory. + /// The path of the affected file or directory. + /// + public string FullPath { set; get; } + + /// + /// Gets the name of the affected file or directory. + /// The name of the affected file or directory. + /// + public string Name { set; get; } + } +} \ No newline at end of file diff --git a/LibCommon.Shared/DataModels/HomeMenuAppShortcutInfo.cs b/LibCommon.Shared/DataModels/HomeMenuAppShortcutInfo.cs new file mode 100644 index 0000000..8ede65d --- /dev/null +++ b/LibCommon.Shared/DataModels/HomeMenuAppShortcutInfo.cs @@ -0,0 +1,50 @@ +/* + * 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.DataModels +{ + /// + /// A Home Menu AppShortcut information + /// + /// + public class HomeMenuAppShortcutInfo : ShortcutInfo + { + /// + /// A Shortcut status + /// + public string Status { get; set; } + + /// + /// A method initializes a status of a Shortcut. + /// + public override void UpdateState() + { + SetCurrentState("default"); + } + + /// + /// A method changes current status of a Shortcut. + /// + /// A new status + public void ChangeStatus(string status) + { + Status = status; + OnPropertyChanged("Status"); + SetCurrentState(status); + } + } +} diff --git a/LibCommon.Shared/DataModels/IAction.cs b/LibCommon.Shared/DataModels/IAction.cs new file mode 100644 index 0000000..d4616da --- /dev/null +++ b/LibCommon.Shared/DataModels/IAction.cs @@ -0,0 +1,30 @@ +/* + * 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.DataModels +{ + /// + /// An interface defines behaviors that will be exported by inherited classes. + /// + public interface IAction + { + /// + /// A method execute an action. + /// + /// A next statue of a Shortcut. + string Execute(); + } +} diff --git a/LibCommon.Shared/DataModels/IEnumerableItem.cs b/LibCommon.Shared/DataModels/IEnumerableItem.cs new file mode 100644 index 0000000..efcfd2b --- /dev/null +++ b/LibCommon.Shared/DataModels/IEnumerableItem.cs @@ -0,0 +1,30 @@ +/* + * 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.Collections.Generic; + +namespace TVHome.DataModels +{ + public interface IEnumerableItem + { + IDictionary ItemProperties + { + set; + get; + } + + } +} diff --git a/LibCommon.Shared/DataModels/MediaControlAction.cs b/LibCommon.Shared/DataModels/MediaControlAction.cs new file mode 100644 index 0000000..440fcfb --- /dev/null +++ b/LibCommon.Shared/DataModels/MediaControlAction.cs @@ -0,0 +1,43 @@ +/* + * 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 LibTVRefCommonPortable.Utils; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// A Media ControlAction. + /// + class MediaControlAction : AppControlAction + { + /// + /// A file URI to be open + /// + public string FileUri { get; set; } + + /// + /// A method execute a action. + /// + /// A next statue of a Shortcut. + new public string Execute() + { + // Warn : Do NOT pass 'E'xtraData, it will create a new Dictionary and it might cause unexpected situation. + AppControlUtils.SendLaunchRequest(AppID, extraData, FileUri); + return "default"; + } + } +} diff --git a/LibCommon.Shared/DataModels/RecentShortcutInfo.cs b/LibCommon.Shared/DataModels/RecentShortcutInfo.cs new file mode 100644 index 0000000..3d853ef --- /dev/null +++ b/LibCommon.Shared/DataModels/RecentShortcutInfo.cs @@ -0,0 +1,69 @@ +/* + * 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.Collections; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// Types for recent shortcut + /// + public enum RecentShortcutType + { + Application = 0, + Media = 1, + } + + /// + /// A Recent Shortcut information + /// + public class RecentShortcutInfo : ShortcutInfo, IComparable + { + /// + /// A type for the content of the shortcut + /// + public RecentShortcutType Type { get; set; } + + /// + /// An Id for the content of the shortcut + /// + public string Id { get; set; } + /// + /// A Last used Time + /// + public DateTime Date { get; set; } + + /// + /// A Screenshot image path + /// + public string ScreenshotPath { get; set; } + + /// + /// Initialize State of a shortcut. + /// + public override void UpdateState() + { + SetCurrentState("default"); + } + + int IComparable.CompareTo(object target) + { + var rightShortcutInfo = target as RecentShortcutInfo; + return Date.CompareTo(rightShortcutInfo.Date) * -1; + } + } +} diff --git a/LibCommon.Shared/DataModels/SettingShortcutInfo.cs b/LibCommon.Shared/DataModels/SettingShortcutInfo.cs new file mode 100644 index 0000000..fd355d2 --- /dev/null +++ b/LibCommon.Shared/DataModels/SettingShortcutInfo.cs @@ -0,0 +1,34 @@ +/* + * 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; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// A Setting Shortcut information + /// + public class SettingShortcutInfo : ShortcutInfo + { + /// + /// Initialize State of a shortcut. + /// + public override void UpdateState() + { + SetCurrentState("default"); + } + } +} diff --git a/LibCommon.Shared/DataModels/ShortcutInfo.cs b/LibCommon.Shared/DataModels/ShortcutInfo.cs new file mode 100644 index 0000000..00854f6 --- /dev/null +++ b/LibCommon.Shared/DataModels/ShortcutInfo.cs @@ -0,0 +1,122 @@ +/* + * 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.Collections.Generic; +using System.ComponentModel; +using System.Xml.Serialization; +using LibTVRefCommonPortable.Utils; + +namespace LibTVRefCommonPortable.DataModels +{ + /// + /// TVHome and TVApps has several buttons that represent Apps, Contents, Settings. + /// The ShortcutInfo is a model for those buttons with detail information of the represented object. + /// + public abstract class ShortcutInfo : INotifyPropertyChanged + { + /// + /// An event handler for handing property changed. + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// State descriptions of Shortcut. + [XmlIgnore] + private Dictionary stateDescriptions = new Dictionary(); + + /// + /// State descriptions of Shortcut. + [XmlIgnore] + public Dictionary StateDescriptions + { + get + { + return stateDescriptions; + } + } + + /// + /// A method notifies property changed event. + /// A property name. + protected void OnPropertyChanged(string propertyName) + { + var handler = PropertyChanged; + if (handler != null) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// A current state description of a Shortcut. + [XmlIgnore] + public StateDescription CurrentStateDescription + { + get; + set; + } + + /// + /// A current state description of a Shortcut. + /// A property name. + /// A result of state transition + protected bool SetCurrentState(string state) + { + if (stateDescriptions.ContainsKey(state) == false) + { + DebuggingUtils.Err(state + " is doesn't exists!!!"); + return false; + } + + if (CurrentStateDescription != null && + CurrentStateDescription == stateDescriptions[state]) + { + return true; + } + + CurrentStateDescription = stateDescriptions[state]; + OnPropertyChanged("CurrentStateDescription"); + return true; + } + + /// + /// Initialize State of a shortcut. + /// + abstract public void UpdateState(); + + /// + /// A method executes a action. + /// After execution of the action, status will be changed if returned status is available. + /// A result of action invocation. + public bool DoAction() + { + if (CurrentStateDescription == null) + { + DebuggingUtils.Err("Current state is not set!!!"); + return false; + } + + String newState = CurrentStateDescription.Action.Execute(); + if (newState == null) + { + DebuggingUtils.Err("Invalid State returned!!!"); + return false; + } + + return SetCurrentState(newState); + } + } +} diff --git a/LibCommon.Shared/DataModels/StateDescription.cs b/LibCommon.Shared/DataModels/StateDescription.cs new file mode 100644 index 0000000..b3766c5 --- /dev/null +++ b/LibCommon.Shared/DataModels/StateDescription.cs @@ -0,0 +1,61 @@ +/* + * 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.DataModels +{ + /// + /// A class represents a state of a Shortcut. + /// + public class StateDescription + { + /// + /// Constructor. + /// + public StateDescription() + { + Label = ""; + IconPath = ""; + } + + /// + /// A Shortcut label. + /// + public string Label + { + get; + set; + } + + /// + /// A Shortcut icon path. + /// + public string IconPath + { + get; + set; + } + + /// + /// A Action instance to be called when a Shortcut is pressed. + /// + public IAction Action + { + get; + set; + } + + } +} diff --git a/LibCommon.Shared/DataModels/WatcherType.cs b/LibCommon.Shared/DataModels/WatcherType.cs new file mode 100644 index 0000000..68ce9cc --- /dev/null +++ b/LibCommon.Shared/DataModels/WatcherType.cs @@ -0,0 +1,46 @@ +/* + * 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.DataModels +{ + /// + /// A File Watcher type enumeration. + /// + public enum WatcherType + { + /// + /// The creation of a file or folder. + /// + Created = 1, + /// + /// The deletion of a file or folder. + /// + Deleted = 2, + /// + /// The change of a file or folder. The types of changes include: changes to size, + /// attributes, security settings, last write, and last access time. + /// + Changed = 4, + /// + /// The renaming of a file or folder. + /// + Renamed = 8, + /// + /// The creation, deletion, change, or renaming of a file or folder. + /// + All = 15 + } +} diff --git a/LibCommon.Shared/LibCommon.Shared.csproj b/LibCommon.Shared/LibCommon.Shared.csproj new file mode 100644 index 0000000..21691c0 --- /dev/null +++ b/LibCommon.Shared/LibCommon.Shared.csproj @@ -0,0 +1,12 @@ + + + + netstandard2.0 + + + + + + + + diff --git a/LibCommon.Shared/Models/AppShortcutController.cs b/LibCommon.Shared/Models/AppShortcutController.cs new file mode 100644 index 0000000..7ec06fd --- /dev/null +++ b/LibCommon.Shared/Models/AppShortcutController.cs @@ -0,0 +1,353 @@ +/* + * 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.Collections.Generic; +using LibTVRefCommonPortable.DataModels; +using LibTVRefCommonPortable.Utils; +using System.Threading.Tasks; + +namespace LibTVRefCommonPortable.Models +{ + /// + /// A class provides Application related information to ViewModel. + /// The TVHome shows the Pinned app list when the App Home Menu is pressed, + /// by invoking AppShortcutController's API to retrieve the pinned app list. + /// The TVApps shows the installed the Tizen UI apps in the main screen. + /// To provides the installed apps, the TVApps invokes an AppShortcutController's API. + /// + public class AppShortcutController + { + /// + /// A default app icon for no icon applications. + /// + private static String DefaultAppIcon = "AppIcon.png"; + + /// + /// A method provides installed app list. + /// The returned app list has only Tizen UI apps not the system app or no display apps. + /// + /// An installed app list. + public async Task> GetInstalledApps() + { + List appShortcutInfoList = new List(); + + var installedAppList = await ApplicationManagerUtils.Instance.GetAllInstalledApplication(); + + foreach (var item in installedAppList) + { + if (ManagedApps.IsNonPinnableApps(item.AppID)) + { + continue; + } + + var defaultStateDescription = new StateDescription() + { + Label = item.Applabel ?? "No Name", + IconPath = item.IconPath ?? DefaultAppIcon, + Action = new AppControlAction() + { + AppID = item.AppID, + } + }; + + var appShortcutInfo = new AppShortcutInfo() + { + IsRemovable = ApplicationManagerUtils.Instance.GetAppInfoRemovable(item.AppID), + Installed = item.InstalledTime, + }; + + appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); + appShortcutInfo.CurrentStateDescription = defaultStateDescription; + appShortcutInfo.AppID = item.AppID; + appShortcutInfoList.Add(appShortcutInfo); + } + + return appShortcutInfoList; + } + + /// + /// A method appends an All Apps Shortcut and a MediaHub Shortcut at first in the given App Shortcut list. + /// Actually this method is used for making the Pinned App Shortcut panel of the TVHome + /// + /// + /// + /// An App Shortcut list contains the additional Shortcuts. + private void AddAllAppsAndMediaHubShortcut(ref List returnPinnedAppsInfo) + { + var allAppsShortcutInfo = new AppShortcutInfo() + { + StateDescriptions = + { + { + "default", + new StateDescription + { + Label = "All apps", + IconPath = "ic_home_menu_apps_138.png", + Action = new AppControlAction + { + AppID = ManagedApps.TVAppsAppID, + } + } + }, + { + "focused", + new StateDescription + { + Label = "All apps", + IconPath = "ic_home_menu_apps_182.png", + Action = new AppControlAction + { + AppID = ManagedApps.TVAppsAppID, + } + } + }, + } + }; + + allAppsShortcutInfo.UpdateState(); + returnPinnedAppsInfo.Insert(0, allAppsShortcutInfo); + + var mediaHubShortcutInfo = new AppShortcutInfo() + { + StateDescriptions = + { + { + "default", + new StateDescription + { + Label = "Media Hub", + IconPath = "ic_launcher_mediahub_138.png", + Action = new AppControlAction + { + AppID = ManagedApps.MediaHubAppID, + } + } + }, + { + "focused", + new StateDescription + { + Label = "Media Hub", + IconPath = "ic_launcher_mediahub_182.png", + Action = new AppControlAction + { + AppID = ManagedApps.MediaHubAppID, + } + } + }, + } + }; + + mediaHubShortcutInfo.UpdateState(); + returnPinnedAppsInfo.Insert(1, mediaHubShortcutInfo); + } + + /// + /// A method appends an Add Pin Shortcut in the given App Shortcut list. + /// + /// + /// + /// An App Shortcut list contains the additional Shortcuts. + private void AppendAddPinShortcut(ref List returnPinnedAppsInfo) + { + var addPinCommandAction = new CommandAction() + { + NextStateDescription = "default", + CommandParameter = "", + }; + + addPinCommandAction.Command += new EventHandler((s, e) => + { + AppControlUtils.SendAddAppRequestToApps(); + }); + + var addPinShortcutInfo = new AppShortcutInfo() + { + StateDescriptions = + { + { + "default", + new StateDescription + { + Label = "Add pin", + IconPath = "ic_home_menu_addpin_138.png", + Action = addPinCommandAction, + } + }, + { + "focused", + new StateDescription + { + Label = "Add pin", + IconPath = "ic_home_menu_addpin_182.png", + Action = addPinCommandAction, + } + }, + } + }; + + addPinShortcutInfo.UpdateState(); + returnPinnedAppsInfo.Add(addPinShortcutInfo); + } + + /// + /// A method provides Pinned App Shortcut list by retrieving from the AppShortcutStorage. + /// This method provides only the Pinned App Shortcut list not including any additional Shortcuts + /// such as the All Apps, the Media Hub, and the Add Pin. + /// + /// A Pinned App Shortcut list. + private async Task> GetPinnedApps() + { + IEnumerable pinned_apps_info = await AppShortcutStorage.Read(); + + List returnPinnedAppsInfo = new List(); + + int numberOfPinnedApp = 0; + foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info) + { + if (numberOfPinnedApp >= 10) + { + break; + } + + if (appShortcutInfo.AppID == null || + appShortcutInfo.AppID.Length < 1) + { + continue; + } + + if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID)) + { + continue; + } + + InstalledApp appInfo = ApplicationManagerUtils.Instance.GetInstalledApplication(appShortcutInfo.AppID); + if (appInfo == null) + { + continue; + } + + string appLabel = appInfo.Applabel ?? "No Name"; + string appIconPath = appInfo.IconPath ?? DefaultAppIcon; + + var defaultStateDescription = new StateDescription() + { + Label = appLabel, + IconPath = appIconPath, + Action = new AppControlAction + { + AppID = appShortcutInfo.AppID, + } + }; + + appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); + appShortcutInfo.CurrentStateDescription = defaultStateDescription; + appShortcutInfo.IsPinned = true; + returnPinnedAppsInfo.Add(appShortcutInfo); + + numberOfPinnedApp += 1; + } + + return returnPinnedAppsInfo; + } + + /// + /// A method provides an App Shortcut list which contains default App Shortcuts + /// such as the All Apps, the Media Hub, and the Add Pin. + /// + /// A default App Shortcut list. + public IEnumerable GetDefaultShortcuts() + { + List returnPinnedAppsInfo = new List(); + + AddAllAppsAndMediaHubShortcut(ref returnPinnedAppsInfo); + AppendAddPinShortcut(ref returnPinnedAppsInfo); + + return returnPinnedAppsInfo; + } + + /// + /// A method provides the App Shortcut list with the default App Shortcut icons. + /// The pinned apps, the All Apps, the MediaHub, and the Add Pin are included in the return App Shortcut list. + /// + /// App Shortcut list. + public async Task> GetPinnedAppsWithDefaultShortcuts() + { + List returnPinnedAppsInfo = await GetPinnedApps(); + + AddAllAppsAndMediaHubShortcut(ref returnPinnedAppsInfo); + AppendAddPinShortcut(ref returnPinnedAppsInfo); + + return returnPinnedAppsInfo; + } + + /// + /// A method provides only pinned app's app ID as a hash table. + /// + /// A hash table includes pinned app's app ID. + public async Task> GetPinnedAppsAppIDs() + { + IEnumerable pinned_apps_info = await AppShortcutStorage.Read(); + Dictionary pinnedAppsDictionary = new Dictionary(); + + int numberOfPinnedApp = 0; + foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info) + { + if (numberOfPinnedApp >= 10) + { + break; + } + + if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID)) + { + continue; + } + + pinnedAppsDictionary.Add(appShortcutInfo.AppID, appShortcutInfo.AppID); + numberOfPinnedApp += 1; + } + + return pinnedAppsDictionary; + } + + /// + /// A method updates the pinned App list by using the AppShortcutStorage. + /// + /// A pinned app list. + public void UpdatePinnedApps(IEnumerable pinnedAppsInfo) + { + AppShortcutStorage.Write(pinnedAppsInfo); + } + + /// + /// A listener to get notification of the AppShortcutStorage. + /// + /// A Event Handler for the nonfiction of AppShortutStorage. + public void AddFileSystemChangedListener(EventHandler eventListener) + { + if (AppShortcutStorage.Instance != null) + { + AppShortcutStorage.Instance.AddStorageChangedListener(eventListener); + } + else + { + DebuggingUtils.Err("AppShortcutStorage Instance is NULL"); + } + } + } +} diff --git a/LibCommon.Shared/Models/ManagedApps.cs b/LibCommon.Shared/Models/ManagedApps.cs new file mode 100644 index 0000000..b6b00b1 --- /dev/null +++ b/LibCommon.Shared/Models/ManagedApps.cs @@ -0,0 +1,120 @@ +/* + * 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.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibTVRefCommonPortable.Models +{ + /// + /// A class has some apps have to managed in the TVHome, TVApps by platform policy reason. + /// + public class ManagedApps + { + /// + /// The app ID of TV reference home application + /// + public static string TVHomeAppID + { + get + { + return "org.tizen.xahome"; + } + } + + /// + /// The app ID of TV reference apps-tray application + /// + public static string TVAppsAppID + { + get + { + return "org.tizen.xaapps"; + } + } + + /// + /// The app ID of TV reference apps-tray application + /// + public static string MediaHubAppID + { + get + { + return "org.tizen.xamediahub"; + } + } + + /// + /// The Settings App ID + /// + public static string SettingsAppID + { + get + { + return "org.tizen.settings"; + } + } + + /// + /// Checks application isn't pinnable + /// + /// Application id for checking + /// If the application isn't pinnable return 'true' + public static bool IsNonPinnableApps(string appID) + { + if (appID == null) + { + return true; + } + + if (appID.CompareTo(TVHomeAppID) == 0 || + appID.CompareTo(TVAppsAppID) == 0 || + appID.CompareTo(MediaHubAppID) == 0 || + appID.CompareTo(SettingsAppID) == 0) + { + return true; + } + + return false; + } + + /// + /// Checks application have to be hidden at recently used application + /// + /// Application id for checking + /// If the application have to be hidden, return 'true' + public static bool IsHiddenRecentApp(string appID) + { + if (appID == null) + { + return true; + } + + if (appID.CompareTo(TVHomeAppID) == 0 || + appID.CompareTo(TVAppsAppID) == 0 || + appID.CompareTo(MediaHubAppID) == 0 || + appID.CompareTo(SettingsAppID) == 0) + { + return true; + } + + return false; + } + } +} diff --git a/LibCommon.Shared/Models/RecentShortcutController.cs b/LibCommon.Shared/Models/RecentShortcutController.cs new file mode 100644 index 0000000..4fa5a06 --- /dev/null +++ b/LibCommon.Shared/Models/RecentShortcutController.cs @@ -0,0 +1,57 @@ +/* + * 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.Collections.Generic; +using LibTVRefCommonPortable.DataModels; +using LibTVRefCommonPortable.Utils; + + +namespace LibTVRefCommonPortable.Models +{ + /// + /// A class provides Recent Shortcut information to the ViewModel + /// The Recent Shortcut can be an app which is recently used and + /// a content which is recently consumed in the TV. + /// + public class RecentShortcutController + { + /// + /// A method removes a Recent Shortcut. + /// + /// a Recent Shortcut's appId to be removed. + public void Remove(string appId) + { + RecentShortcutStorage.Delete(appId); + } + + /// + /// A method removes all Recent Shortcuts. + /// + public void RemoveAll() + { + RecentShortcutStorage.DeleteAll(); + } + + /// + /// A method provides a Recent Shortcut list. + /// + /// A Recent Shortcut list. + public IEnumerable GetList() + { + return RecentShortcutStorage.Read(); + } + } +} diff --git a/LibCommon.Shared/Settings.StyleCop b/LibCommon.Shared/Settings.StyleCop new file mode 100644 index 0000000..837530c --- /dev/null +++ b/LibCommon.Shared/Settings.StyleCop @@ -0,0 +1,722 @@ + + + NoMerge + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/LibCommon.Shared/Stubs/ApplicationManagerAPITestStub.cs b/LibCommon.Shared/Stubs/ApplicationManagerAPITestStub.cs new file mode 100644 index 0000000..082dc66 --- /dev/null +++ b/LibCommon.Shared/Stubs/ApplicationManagerAPITestStub.cs @@ -0,0 +1,250 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LibTVRefCommonPortable.Stubs +{ + /// + /// A unit testing stub of IApplicationManagerAPIs. + /// + public class ApplicationManagerAPITestStub : IApplicationManagerAPIs + { + /// + /// A method for removing all recent applications + /// + public void DeleteAllRecentApplication() + { + throw new NotImplementedException(); + } + + /// + /// A method for removing the specified recent application + /// + /// An application ID + public void DeleteRecentApplication(string appId) + { + throw new NotImplementedException(); + } + + /// + /// A method provides installed application list. + /// + /// An installed application list + public Task> GetAllInstalledApplication() + { + return Task.Run(() => + { + List installedApps = new List(); + + installedApps.Add(new InstalledApp + { + Applabel = "app1", + AppID = "app1", + IconPath = "path/app1", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "app2.removable", + AppID = "app2.removable", + IconPath = "path/app2", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "invalid.app3.noid", + IconPath = "path/app3", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "app4.noicon", + AppID = "app4.noicon", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "app5.nolabel", + AppID = "app5.nolabel", + IconPath = "path/app5", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "invalid.org.tizen.xahome", + AppID = "org.tizen.xahome", + IconPath = "path/app3", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "invalid.org.tizen.xaapps", + AppID = "org.tizen.xaapps", + IconPath = "path/app4", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "invalid.org.tizen.xamediahub", + AppID = "org.tizen.xamediahub", + IconPath = "path/app5", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "invalid.org.tizen.settings", + AppID = "org.tizen.settings", + IconPath = "path/app6", + InstalledTime = new DateTime(2017, 05, 02), + }); + + return (IEnumerable)installedApps; + }); + } + + /// + /// Gets the app ID by the app label + /// + /// the app label to get + /// the app ID of the app label + public Task GetAppIDbyAppLabel(string appLabel) + { + throw new NotImplementedException(); + } + + /// + /// Checks whether application is removable + /// + /// The app ID to get + /// If the application is removable, true; otherwise, false + public bool GetAppInfoRemovable(string appID) + { + return appID.Contains("removable"); + } + + /// + /// A method provides application information which is matched with the given app ID. + /// + /// An application ID + /// An installed application information + public InstalledApp GetInstalledApplication(string applicationId) + { + return new InstalledApp + { + AppID = applicationId, + Applabel = applicationId, + IconPath = "path/" + applicationId, + InstalledTime = DateUtils.GetRandomDate(), + }; + } + + /// + /// A method provides a recent application list. + /// + /// A Recent application list. + public IEnumerable GetRecentApplications() + { + IList testData = new List(); + + testData.Add(new RecentApp + { + InstanceID = "recentapp1", + InstanceLabel = "recentapp1", + AppID = "org.tizen.recentapp1", + Applabel = "recentapp1", + IconPath = "/test/recentapp1", + LaunchedTime = new DateTime(2014, 11, 12), + Uri = "uri/recentapp1", + ScreenShot = "screenshot/recentapp1", + }); + testData.Add(new RecentApp + { + InstanceID = "recentapp2.noscreenshot", + InstanceLabel = "recentapp2.noscreenshot", + AppID = "org.tizen.recentapp2.noscreenshot", + Applabel = "recentapp2.noscreenshot", + IconPath = "/test/recentapp2", + LaunchedTime = new DateTime(2014, 11, 12), + Uri = "uri/recentapp2", + }); + testData.Add(new RecentApp + { + InstanceID = "invalid.recentapp3.nolabel", + AppID = "invalid.org.tizen.recentapp3.nolabel", + IconPath = "/test/recentapp3", + LaunchedTime = new DateTime(2014, 11, 12), + Uri = "uri/recentapp3", + ScreenShot = "screenshot/recentapp3", + }); + testData.Add(new RecentApp + { + InstanceID = "invalid.recentapp4.notime", + AppID = "invalid.org.tizen.recentapp4.notime", + Applabel = "recentapp4.notime", + IconPath = "/test/recentapp4", + Uri = "uri/recentapp4", + ScreenShot = "screenshot/recentapp4", + }); + testData.Add(new RecentApp + { + InstanceID = "recentapp5", + InstanceLabel = "recentapp5", + AppID = "org.tizen.recentapp5", + Applabel = "recentapp5", + IconPath = "/test/recentapp5", + LaunchedTime = new DateTime(2017, 05, 02), + Uri = "uri/recentapp5", + ScreenShot = "screenshot/recentapp5", + }); + testData.Add(new RecentApp + { + InstanceID = "recentapp6", + InstanceLabel = "recentapp6", + AppID = "org.tizen.recentapp6", + Applabel = "recentapp6", + IconPath = "/test/recentapp6", + LaunchedTime = new DateTime(2017, 02, 26), + Uri = "uri/recentapp6", + ScreenShot = "screenshot/recentapp6", + }); + testData.Add(new RecentApp + { + InstanceID = "recentapp7", + InstanceLabel = "recentapp7", + AppID = "org.tizen.recentapp7", + Applabel = "recentapp7", + IconPath = "/test/recentapp7", + LaunchedTime = new DateTime(2016, 04, 25), + Uri = "uri/recentapp7", + ScreenShot = "screenshot/recentapp7", + }); + + return testData; + } + } +} diff --git a/LibCommon.Shared/Stubs/FileSystemAPITestStub.cs b/LibCommon.Shared/Stubs/FileSystemAPITestStub.cs new file mode 100644 index 0000000..bc3955e --- /dev/null +++ b/LibCommon.Shared/Stubs/FileSystemAPITestStub.cs @@ -0,0 +1,180 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using System; +using System.IO; +using System.Text; + +namespace LibTVRefCommonPortable.Stubs +{ + /// + /// A unit test stub for FileSystemUtils + /// + public class FileSystemAPITestStub : IFileSystemAPIs + { + /// + /// A directory path which should be used for app data storing. + /// + public string AppDataStorage + { + get + { + return "test_app_data_path/"; + } + } + + /// + /// A directory path which should be used for app resource storing. + /// + public string AppResourceStorage + { + get + { + return "test_app_resource_path/"; + } + } + + /// + /// A directory path which should be used for sharing between apps. + /// + public string PlatformShareStorage + { + get + { + return "test_platform_share_path/"; + } + } + + /// + /// A method closes the file. + /// + /// A file descriptor + public void CloseFile(Stream stream) + { + } + + /// + /// A method flushing the stream to write remains. + /// + /// A file descriptor + public void Flush(Stream stream) + { + } + + /// + /// A method checks if a file existence in the file system. + /// + /// A file path + /// An existence of the file + public bool IsFileExist(string filePath) + { + return true; + } + + /// + /// A method checks if file is read to use. + /// + /// A file path + /// A status of ready + public bool IsFileReady(string filePath) + { + return true; + } + + /// + /// A method opens a file on the given mode. + /// + /// A file path + /// An opening mode + /// A file descriptor + public Stream OpenFile(string filePath, UtilFileMode mode) + { + if (mode != UtilFileMode.Open) + { + throw new NotImplementedException(); + } + + if (filePath.Contains("pinned_apps_info")) + { + StringBuilder pinnedApps = new StringBuilder(); + + pinnedApps.Append(""); + pinnedApps.Append(""); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.xahome"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.xaapps"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.xamediahub"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.settings"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.TocToc.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.YouTube.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Toda.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly4.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly5.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly6.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly7.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly8.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly9.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly10.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" org.tizen.example.Butterfly11.Tizen"); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(" "); + pinnedApps.Append(""); + + MemoryStream stream = new MemoryStream(); + StreamWriter writer = new StreamWriter(stream); + writer.Write(pinnedApps.ToString()); + writer.Flush(); + stream.Position = 0; + return stream; + } + + throw new NotImplementedException(); + } + } +} diff --git a/LibCommon.Shared/Stubs/FileWatcherAPITestStub.cs b/LibCommon.Shared/Stubs/FileWatcherAPITestStub.cs new file mode 100644 index 0000000..24709b5 --- /dev/null +++ b/LibCommon.Shared/Stubs/FileWatcherAPITestStub.cs @@ -0,0 +1,43 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using System; + +namespace LibTVRefCommonPortable.Stubs +{ + /// + /// A unit test stub for FileSystemUtils + /// + public class FileWatcherAPITestStub : IFileSystemWatcherAPIs + { + /// + /// A EventHandler for the file system watcher. + /// + public event EventHandler CustomChanged; + + /// + /// A method starts the file system watcher. + /// + /// Target file path + /// Target file name + public void Run(String path, String fileName) + { + CustomChanged?.Invoke(this, EventArgs.Empty); + + } + } +} diff --git a/LibCommon.Shared/Stubs/MediaContentAPITestStub.cs b/LibCommon.Shared/Stubs/MediaContentAPITestStub.cs new file mode 100644 index 0000000..2eeefb9 --- /dev/null +++ b/LibCommon.Shared/Stubs/MediaContentAPITestStub.cs @@ -0,0 +1,101 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using System; +using System.Collections.Generic; + +namespace LibTVRefCommonPortable.Stubs +{ + /// + /// A unit testing stub for MediaContentUtils + /// + public class MediaContentAPITestStub : IMediaContentAPIs + { + /// + /// A method for getting recently played media content list + /// + /// Maximum count of list + /// The recently played media content list + public IEnumerable GetRecentlyPlayedMedia(int limitation) + { + IList recentlyPlayed = new List(); + + recentlyPlayed.Add(new RecentlyPlayedMedia + { + MediaId = "id/recent_media1", + ThumbnailPath = "thumbnail/recent_media1", + FilePath = "filepath/recent_media1", + DisplayName = "recent_media1", + PlayedAt = new DateTime(2017, 05, 22), + }); + + recentlyPlayed.Add(new RecentlyPlayedMedia + { + MediaId = "invalid.recent_media2.nofilepath", + ThumbnailPath = "invalid.recent_media2.nofilepath", + DisplayName = "invalid.recent_media2.nofilepath", + PlayedAt = new DateTime(2017, 2, 26), + }); + + recentlyPlayed.Add(new RecentlyPlayedMedia + { + MediaId = "id/recent_media3.nothumbnail", + FilePath = "filepath/recent_media3.nothumbnail", + DisplayName = "recent_media3.nothumbnail", + PlayedAt = new DateTime(2016, 4, 25), + }); + + recentlyPlayed.Add(new RecentlyPlayedMedia + { + MediaId = "id/recent_media4", + ThumbnailPath = "thumbnail/recent_media4", + FilePath = "filepath/recent_media4", + DisplayName = "recent_media4", + PlayedAt = new DateTime(2015, 12, 7), + }); + + recentlyPlayed.Add(new RecentlyPlayedMedia + { + MediaId = "id/recent_media5", + ThumbnailPath = "thumbnail/recent_media5", + FilePath = "filepath/recent_media5", + DisplayName = "recent_media5", + PlayedAt = new DateTime(2015, 10, 1), + }); + + recentlyPlayed.Add(new RecentlyPlayedMedia + { + MediaId = "id/recent_media6", + ThumbnailPath = "thumbnail/recent_media6", + FilePath = "filepath/recent_media6", + DisplayName = "recent_media6", + PlayedAt = new DateTime(2015, 3, 3), + }); + + recentlyPlayed.Add(new RecentlyPlayedMedia + { + MediaId = "id/recent_media7", + ThumbnailPath = "thumbnail/recent_media7", + FilePath = "filepath/recent_media7", + DisplayName = "recent_media8", + PlayedAt = new DateTime(2014, 11, 17), + }); + + return recentlyPlayed; + } + } +} diff --git a/LibCommon.Shared/Utils/AppControlUtils.cs b/LibCommon.Shared/Utils/AppControlUtils.cs new file mode 100644 index 0000000..64a8832 --- /dev/null +++ b/LibCommon.Shared/Utils/AppControlUtils.cs @@ -0,0 +1,83 @@ +/* + * 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.Collections.Generic; +using Xamarin.Forms; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class provides App Control utility APIs. + /// + public sealed class AppControlUtils + { + /// + /// A method makes the app to be launched. + /// + /// An application ID of the targeted application. + /// An extra data for App Control invoking. + /// A file Uri to be opened. + public static void SendLaunchRequest(string appID, IDictionary extraData = null, string fileUri = null) + { + if (DependencyService.Get() == null) + { + return; + } + + DependencyService.Get().SendLaunchRequest(appID, extraData, fileUri); + } + + /// + /// A method sends a add pin request App Control to TVApps app. + /// + public static void SendAddAppRequestToApps() + { + if (DependencyService.Get() == null) + { + return; + } + + DependencyService.Get().SendAddAppRequestToApps(); + } + + /// + /// A method sends a pin added notification App control to TVHome app. + /// + /// An app ID of newly added. + public static void SendAppAddedNotificationToHome(string addedAddID) + { + if (DependencyService.Get() == null) + { + return; + } + + DependencyService.Get().SendAppAddedNotificationToHome(addedAddID); + } + + /// + /// A method terminates caller application. + /// + public static void SelfTerminate() + { + if (DependencyService.Get() == null) + { + return; + } + + DependencyService.Get().SelfTerminate(); + } + } +} diff --git a/LibCommon.Shared/Utils/AppShortcutStorage.cs b/LibCommon.Shared/Utils/AppShortcutStorage.cs new file mode 100644 index 0000000..67b5ae1 --- /dev/null +++ b/LibCommon.Shared/Utils/AppShortcutStorage.cs @@ -0,0 +1,144 @@ +/* + * 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.Collections.Generic; +using System.Xml.Serialization; +using System.IO; +using LibTVRefCommonPortable.DataModels; +using System.Threading.Tasks; +using System.Diagnostics; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class manages App Shortcuts by using subsystem. + /// + public class AppShortcutStorage + { + /// + /// A storage path. + /// + private static String StoragePath; + + /// + /// A file system watcher which checks if the targeted storage is changed. + /// + private static IFileSystemWatcherAPIs fileSystemWatcher = FileSystemUtils.Instance.FileSysteamWatcherInstance; + + /// + /// An instance of AppShortcutStorage. + /// + private static AppShortcutStorage instance = new AppShortcutStorage(); + + /// + /// An instance of AppShortcutStorage. + /// + public static AppShortcutStorage Instance + { + get { return instance; } + } + + /// + /// A constructor of AppShortcutStorage. + /// + private AppShortcutStorage() + { + StoragePath = FileSystemUtils.Instance.PlatformShareStorage + "pinned_apps_info.xml"; + + CheckStorage(); + + fileSystemWatcher.Run(FileSystemUtils.Instance.PlatformShareStorage, "pinned_apps_info.xml"); + } + + /// + /// Check if the storage is exist + /// + private static void CheckStorage() + { + if (FileSystemUtils.Instance.IsFileExist(StoragePath) == false) + { + DebuggingUtils.Err("Set Default Pinned Apps" + StoragePath); + List result = new List(); + Write(result); + } + } + + /// + /// A method provides an app Shortcut list. + /// + /// An app Shortcut list. + public static async Task> Read() + { + CheckStorage(); + + for (int i = 0; i <= 6; i++) + { + if (FileSystemUtils.Instance.IsFileReady(StoragePath)) + { + break; + } + else if (i == 6) + { + DebuggingUtils.Err("Can't open storage" + StoragePath); + return new List(); + } + + await Task.Delay(100); + DebuggingUtils.Dbg("[" + i + "] Waiting for Writing" + StoragePath); + } + + using (Stream fileStream = FileSystemUtils.Instance.OpenFile(StoragePath, UtilFileMode.Open)) + { + Debug.Assert(fileStream != null); + + XmlSerializer serializer = new XmlSerializer(typeof(List)); + StreamReader streamReader = new StreamReader(fileStream); + List list = (List)serializer.Deserialize(streamReader); + + return list; + } + } + + /// + /// A method updates App Shortcuts of the storage + /// + /// An app Shortcuts that pinned by a user. + /// A status of storage update. + public static bool Write(IEnumerable pinnedAppInfo) + { + using (Stream fileStream = FileSystemUtils.Instance.OpenFile(StoragePath, UtilFileMode.Create)) + { + Debug.Assert(fileStream != null); + + XmlSerializer serializer = new XmlSerializer(typeof(List)); + StreamWriter streamWriter = new StreamWriter(fileStream); + serializer.Serialize(streamWriter, pinnedAppInfo); + streamWriter.Flush(); + } + + return true; + } + + /// + /// A method sets an event listener for the storage watcher + /// + /// An event handler for the storage event + public void AddStorageChangedListener(EventHandler eventListener) + { + fileSystemWatcher.CustomChanged += eventListener; + } + } +} diff --git a/LibCommon.Shared/Utils/ApplicationManagerUtils.cs b/LibCommon.Shared/Utils/ApplicationManagerUtils.cs new file mode 100644 index 0000000..138d211 --- /dev/null +++ b/LibCommon.Shared/Utils/ApplicationManagerUtils.cs @@ -0,0 +1,137 @@ +/* + * 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 LibTVRefCommonPortable.Stubs; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xamarin.Forms; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class provides application controlling functions + /// + public sealed class ApplicationManagerUtils + { + /// + /// A instance of platform specific application manager port. + /// + private static IApplicationManagerAPIs applicationManagerAPIs; + + /// + /// A instance of ApplicationManagerUtils + /// + private static readonly ApplicationManagerUtils instance = new ApplicationManagerUtils(); + + /// + /// A getter of ApplicationManagerUtils instance + /// + public static ApplicationManagerUtils Instance + { + get + { + return instance; + } + } + + /// + /// A constructor + /// + private ApplicationManagerUtils() + { + applicationManagerAPIs = new ApplicationManagerAPITestStub(); + + try + { + if (DependencyService.Get() != null) + { + applicationManagerAPIs = DependencyService.Get(); + } + } + catch (InvalidOperationException e) + { + DebuggingUtils.Err(e.Message); + } + } + + /// + /// A method for removing all recent applications + /// + public void DeleteAllRecentApplication() + { + applicationManagerAPIs.DeleteAllRecentApplication(); + } + + /// + /// A method for removing the specified recent application + /// + /// An application ID + public void DeleteRecentApplication(string appId) + { + applicationManagerAPIs.DeleteRecentApplication(appId); + } + + + /// + /// Gets the information of the recent applications + /// + /// The list of the recent applications + public IEnumerable GetRecentApplications() + { + return applicationManagerAPIs.GetRecentApplications(); + } + + /// + /// Gets the information of the specified application with the app ID + /// + /// The app Id to get + /// The information of the installed application + public InstalledApp GetInstalledApplication(string appID) + { + return applicationManagerAPIs.GetInstalledApplication(appID); + } + + /// + /// Gets the information of the installed applications asynchronously + /// + /// The list of the installed applications + public Task> GetAllInstalledApplication() + { + return applicationManagerAPIs.GetAllInstalledApplication(); + } + + /// + /// Checks whether application is removable + /// + /// The app ID to get + /// If the application is removable, true; otherwise, false + public bool GetAppInfoRemovable(string appID) + { + return applicationManagerAPIs.GetAppInfoRemovable(appID); + } + + /// + /// Gets the app ID by the app label + /// + /// the app label to get + /// the app ID of the app label + public Task GetAppIDbyAppLabel(string appLabel) + { + return applicationManagerAPIs.GetAppIDbyAppLabel(appLabel); + } + } +} diff --git a/LibCommon.Shared/Utils/DateUtils.cs b/LibCommon.Shared/Utils/DateUtils.cs new file mode 100644 index 0000000..f2e6e14 --- /dev/null +++ b/LibCommon.Shared/Utils/DateUtils.cs @@ -0,0 +1,41 @@ +/* + * 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; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class provides Date, Time related functions + /// + public class DateUtils + { + /// + /// A random seed + /// + private static Random seed = new Random(); + + /// + /// A method provides a random date. + /// + /// A date + public static DateTime GetRandomDate() + { + DateTime baseDate = DateTime.Now.AddYears(-10); + return baseDate.AddDays(seed.Next((DateTime.Now - baseDate).Days)); + } + } +} diff --git a/LibCommon.Shared/Utils/DebuggingUtils.cs b/LibCommon.Shared/Utils/DebuggingUtils.cs new file mode 100644 index 0000000..61418c6 --- /dev/null +++ b/LibCommon.Shared/Utils/DebuggingUtils.cs @@ -0,0 +1,135 @@ +/* + * 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.CompilerServices; +using Xamarin.Forms; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A debugging utility class. + /// + public sealed class DebuggingUtils + { + /// + /// A debugging API interface + /// + private static IDebuggingAPIs ism; + + /// + /// An instance of DebuggingUtils + /// + private static readonly DebuggingUtils instance = new DebuggingUtils(); + + /// + /// A method provides instance of DebuggingUtils. + public static DebuggingUtils Instance + { + get { return instance; } + } + + /// + /// Default implementation of IDebuggingAPIs interface . + /// This is required for the unit testing of the Calculator application. + /// + private class DefaultSM : IDebuggingAPIs + { + /// + /// A method displays an error log. + /// + /// An error message. + /// A file name. + /// A function name. + /// A line number. + public void Dbg(string message, String file, String func, Int32 line) + { + } + + /// + /// A method displays a dialog with a given message. + /// + /// A debugging message. + /// A file name. + /// A function name. + /// A line number. + public void Err(string message, String file, String func, Int32 line) + { + } + + /// + /// A method displays a debugging log. + /// + /// A debugging message. + public void Popup(string message) + { + } + } + + /// + /// DebuggingUtils constructor which set interface instance. + /// + private DebuggingUtils() + { + ism = new DefaultSM(); + + try + { + if (DependencyService.Get() != null) + { + ism = DependencyService.Get(); + } + } + catch (InvalidOperationException e) + { + Err(e.Message); + } + } + + /// + /// A method displays a debugging message + /// + /// A list of command line arguments. + /// A file name. + /// A function name. + /// A line number. + public static void Dbg(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) + { + ism.Dbg(message, file, func, line); + } + + /// + /// A method displays an error message + /// + /// A list of command line arguments. + /// A file name. + /// A function name. + /// A line number. + public static void Err(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) + { + ism.Err(message, file, func, line); + } + + /// + /// A method displays a pop up message + /// + /// A list of command line arguments. + public static void Popup(string message) + { + ism.Popup(message); + } + } +} diff --git a/LibCommon.Shared/Utils/FileSystemUtils.cs b/LibCommon.Shared/Utils/FileSystemUtils.cs new file mode 100644 index 0000000..4ed3434 --- /dev/null +++ b/LibCommon.Shared/Utils/FileSystemUtils.cs @@ -0,0 +1,176 @@ +/* + * 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 LibTVRefCommonPortable.Stubs; +using System; +using System.IO; +using Xamarin.Forms; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class for file system control function. + /// + class FileSystemUtils + { + /// + /// A instance of file system port layer + /// + private static IFileSystemAPIs fileSystemAPIs; + + /// + /// A instance of file system watcher port layer + /// + private static IFileSystemWatcherAPIs fileSystemWatcherAPIs; + + /// + /// A instance of FileSystemUtils + /// + private static readonly FileSystemUtils instance = new FileSystemUtils(); + + /// + /// A property of FileSystemUtils instance + /// + public static FileSystemUtils Instance + { + get + { + return instance; + } + } + + /// + /// A property of file system watcher instance + /// + public IFileSystemWatcherAPIs FileSysteamWatcherInstance + { + get + { + return fileSystemWatcherAPIs; + } + } + + /// + /// A constructor + /// + private FileSystemUtils() + { + fileSystemAPIs = new FileSystemAPITestStub(); + fileSystemWatcherAPIs = new FileWatcherAPITestStub(); + + try + { + if (DependencyService.Get() != null) + { + fileSystemAPIs = DependencyService.Get(); + } + + if (DependencyService.Get() != null) + { + fileSystemWatcherAPIs = DependencyService.Get(); + } + } + catch (InvalidOperationException e) + { + DebuggingUtils.Err(e.Message); + } + } + + /// + /// A directory path which should be used for app data storing. + /// + public string AppDataStorage + { + get + { + return fileSystemAPIs.AppDataStorage; + } + } + + /// + /// A directory path which should be used for app resource storing. + /// + public string AppResourceStorage + { + get + { + return fileSystemAPIs.AppResourceStorage; + } + } + + /// + /// A directory path which should be used for sharing between apps. + /// + public string PlatformShareStorage + { + get + { + return fileSystemAPIs.PlatformShareStorage; + } + } + + /// + /// A method opens a file on the given mode. + /// + /// A file path + /// An opening mode + /// A file descriptor + public Stream OpenFile(string filePath, UtilFileMode mode) + { + return fileSystemAPIs.OpenFile(filePath, mode); + } + + /// + /// A method flushing the stream to write remains. + /// + /// A file descriptor + public void Flush(Stream stream) + { + fileSystemAPIs.Flush(stream); + } + + /// + /// A method closes the file. + /// + /// A file descriptor + public void CloseFile(Stream stream) + { + fileSystemAPIs.CloseFile(stream); + } + + /// + /// A method checks if a file existence in the file system. + /// + /// A file path + /// An existence of the file + public bool IsFileExist(String filePath) + { + return fileSystemAPIs.IsFileExist(filePath); + } + + /// + /// A method checks if file is read to use. + /// + /// A file path + /// A status of ready + public bool IsFileReady(String filePath) + { + return fileSystemAPIs.IsFileReady(filePath); + } + + + } +} diff --git a/LibCommon.Shared/Utils/IAppControl.cs b/LibCommon.Shared/Utils/IAppControl.cs new file mode 100644 index 0000000..9aa4c3f --- /dev/null +++ b/LibCommon.Shared/Utils/IAppControl.cs @@ -0,0 +1,46 @@ +/* + * 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.Collections.Generic; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// An interface for App Control feature + /// + public interface IAppControl + { + /// + /// Sends the launch request + /// + /// The app ID to explicitly launch + /// The extra data for the app control + /// The file uri to be opened + void SendLaunchRequest(string appId, IDictionary extraData, string fileUri); + + /// + /// A method sends add pin request App Control to TVApps app. + /// + void SendAddAppRequestToApps(); + + /// + /// A method sends a pin added notification App control to TVHome app. + /// + /// An app ID of newly added. + void SendAppAddedNotificationToHome(string addedAddID); + } +} diff --git a/LibCommon.Shared/Utils/IAppLifeControl.cs b/LibCommon.Shared/Utils/IAppLifeControl.cs new file mode 100644 index 0000000..ab6e2e7 --- /dev/null +++ b/LibCommon.Shared/Utils/IAppLifeControl.cs @@ -0,0 +1,29 @@ +/* + * 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 +{ + /// + /// An interface for app life management. + /// + public interface IAppLifeControl + { + /// + /// A method terminates the caller app. + /// + void SelfTerminate(); + } +} diff --git a/LibCommon.Shared/Utils/IApplicationManagerAPIs.cs b/LibCommon.Shared/Utils/IApplicationManagerAPIs.cs new file mode 100644 index 0000000..c8521b9 --- /dev/null +++ b/LibCommon.Shared/Utils/IApplicationManagerAPIs.cs @@ -0,0 +1,144 @@ +/* + * 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.Collections.Generic; +using System.Threading.Tasks; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class to store RecentApp information. + /// + public class RecentApp + { + /// + /// A Recent instance ID + /// + public String InstanceID; + + /// + /// A Recent instance label + /// + public String InstanceLabel; + + /// + /// An app ID + /// + public String AppID; + + /// + /// An app label + /// + public String Applabel; + + /// + /// An app icon path + /// + public String IconPath; + + /// + /// A last launched date + /// + public DateTime LaunchedTime; + + /// + /// A URI of accessible content if the Recent is a content. + /// + public String Uri; + + /// + /// A File Path of screenshot of the recent app or recent content. + /// + public String ScreenShot; + } + + /// + /// A class to store installed app information. + /// + public class InstalledApp + { + /// + /// An app ID + /// + public String AppID; + + /// + /// An app label + /// + public String Applabel; + + /// + /// An app icon path + /// + public String IconPath; + + /// + /// A installed date + /// + public DateTime InstalledTime; + } + + /// + /// An interface for Application Manager feature + /// + public interface IApplicationManagerAPIs + { + /// + /// A method provides installed application list. + /// + /// An installed application list + Task> GetAllInstalledApplication(); + + /// + /// A method provides a recent application list. + /// + /// A Recent application list. + IEnumerable GetRecentApplications(); + + /// + /// A method provides application information which is matched with the given app ID. + /// + /// An application ID + /// An installed application information + InstalledApp GetInstalledApplication(string applicationId); + + /// + /// A method for removing all recent applications + /// + void DeleteAllRecentApplication(); + + /// + /// A method for removing the specified recent application + /// + /// An application ID + void DeleteRecentApplication(string appId); + + /// + /// Checks whether application is removable + /// + /// The app ID to get + /// If the application is removable, true; otherwise, false + bool GetAppInfoRemovable(string appID); + + /// + /// Gets the app ID by the app label + /// + /// the app label to get + /// the app ID of the app label + Task GetAppIDbyAppLabel(string appLabel); + } +} diff --git a/LibCommon.Shared/Utils/IDebuggingAPIs.cs b/LibCommon.Shared/Utils/IDebuggingAPIs.cs new file mode 100644 index 0000000..eb46618 --- /dev/null +++ b/LibCommon.Shared/Utils/IDebuggingAPIs.cs @@ -0,0 +1,53 @@ +/* + * 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; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// An interface contains debugging methods which are using platform subsystems. + /// + /// + /// Implementing this class should be occurred in platform project. + /// Also the implementation should be registered to the DependencyService in an app initialization. + /// Please refer to Xamarin Dependency Service + /// https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/ + /// + public interface IDebuggingAPIs + { + /// + /// A method displays a debugging log. + /// A debugging message. + void Popup(string message); + + /// + /// A method displays an error log. + /// An error message. + /// A file name. + /// A function name. + /// A line number. + void Dbg(string message, String file, String func, Int32 line); + + /// + /// A method displays a dialog with a given message. + /// A debugging message. + /// A file name. + /// A function name. + /// A line number. + void Err(string message, String file, String func, Int32 line); + } +} diff --git a/LibCommon.Shared/Utils/IFileSystemAPIs.cs b/LibCommon.Shared/Utils/IFileSystemAPIs.cs new file mode 100644 index 0000000..2f29351 --- /dev/null +++ b/LibCommon.Shared/Utils/IFileSystemAPIs.cs @@ -0,0 +1,98 @@ +/* + * 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.IO; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// An enumeration for the file open mode. + /// + public enum UtilFileMode + { + CreateNew = 1, + Create = 2, + Open = 3, + OpenOrCreate = 4, + Truncate = 5, + Append = 6 + } + + /// + /// An interface for the file operations + /// + public interface IFileSystemAPIs + { + /// + /// A directory path which should be used for app data storing. + /// + string AppDataStorage + { + get; + } + + /// + /// A directory path which should be used for app resource storing. + /// + string AppResourceStorage + { + get; + } + + /// + /// A directory path which should be used for sharing between apps. + /// + string PlatformShareStorage + { + get; + } + + /// + /// A method opens a file on the given mode. + /// + /// A file path + /// An opening mode + /// A file descriptor + Stream OpenFile(string filePath, UtilFileMode mode); + + /// + /// A method flushing the stream to write remains. + /// + /// A file descriptor + void Flush(Stream stream); + + /// + /// A method closes the file. + /// + /// A file descriptor + void CloseFile(Stream stream); + + /// + /// A method checks if a file existence in the file system. + /// + /// A file path + /// An existence of the file + bool IsFileExist(String filePath); + + /// + /// A method checks if file is read to use. + /// + /// A file path + /// A status of ready + bool IsFileReady(String filePath); + } +} diff --git a/LibCommon.Shared/Utils/IFileSystemWatcherAPIs.cs b/LibCommon.Shared/Utils/IFileSystemWatcherAPIs.cs new file mode 100644 index 0000000..43ecb20 --- /dev/null +++ b/LibCommon.Shared/Utils/IFileSystemWatcherAPIs.cs @@ -0,0 +1,38 @@ +/* + * 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; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// An interface for the file system watcher. + /// + public interface IFileSystemWatcherAPIs + { + /// + /// A EventHandler for the file system watcher. + /// + event EventHandler CustomChanged; + + /// + /// A method starts the file system watcher. + /// + /// Target file path + /// Target file name + void Run(String path, String fileName); + } +} diff --git a/LibCommon.Shared/Utils/IMediaContentAPIs.cs b/LibCommon.Shared/Utils/IMediaContentAPIs.cs new file mode 100644 index 0000000..a0b26a9 --- /dev/null +++ b/LibCommon.Shared/Utils/IMediaContentAPIs.cs @@ -0,0 +1,66 @@ +/* + * 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.Collections.Generic; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// An information of recently played media content + /// + public struct RecentlyPlayedMedia + { + /// + /// An ID of media content + /// + public string MediaId; + + /// + /// A path of media content thumbnail + /// + public string ThumbnailPath; + + /// + /// A path of media content + /// + public string FilePath; + + /// + /// A title of media content + /// + public string DisplayName; + + /// + /// Last played time of media content + /// + public DateTime PlayedAt; + } + + /// + /// An interface for getting recently played media contents. + /// + public interface IMediaContentAPIs + { + /// + /// A method for getting recently played media content list + /// + /// Maximum count of list + /// The recently played media content list + IEnumerable GetRecentlyPlayedMedia(int limitation); + } +} diff --git a/LibCommon.Shared/Utils/IPackageManager.cs b/LibCommon.Shared/Utils/IPackageManager.cs new file mode 100644 index 0000000..a449672 --- /dev/null +++ b/LibCommon.Shared/Utils/IPackageManager.cs @@ -0,0 +1,67 @@ +/* + * 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.Collections.Generic; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// An interface for package manager subsystem. + /// + public interface IPackageManager + { + /// + /// A method provides installed package list. + /// + /// A package list + Dictionary GetPackageList(); + + /// + /// A method provides a detail information (TBD) + /// + /// A package ID + /// A package label + string GetPackageLabel(string pkgID); + + /// + /// Gets the package ID by the app ID + /// + /// The app ID to get + /// The package ID that contains given app ID + string GetPackageIDByAppID(string appID); + + /// + /// A method removes the package. + /// + /// A package ID + /// A status of uninstall + bool UninstallPackage(string pkgID); + + /// + /// A method remove the package by using an app ID. + /// + /// an app ID + /// A status of uninstall + bool UninstallPackageByAppID(string appID); + + /// + /// Gets applications list by the package ID + /// + /// The package ID to get applications + /// The list of applications + List GetApplicationsByPkgID(string pkgID); + } +} diff --git a/LibCommon.Shared/Utils/IPlatformNotification.cs b/LibCommon.Shared/Utils/IPlatformNotification.cs new file mode 100644 index 0000000..b5664e2 --- /dev/null +++ b/LibCommon.Shared/Utils/IPlatformNotification.cs @@ -0,0 +1,64 @@ +/* + * 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 +{ + /// + /// An interface for the platform notification. + /// + public interface IPlatformNotification + { + /// + /// A method will be called when the Home remote control key is pressed. + /// + void OnHomeKeyPressed(); + + /// + /// A method will be called when the Menu remote control key is pressed. + /// + void OnMenuKeyPressed(); + + /// + /// A method will be called if an app is installed. + /// + /// A package ID of newly installed. + void OnAppInstalled(string pkgID); + + /// + /// A method will be called if an app is uninstalled. + /// + /// A package ID of uninstalled. + void OnAppUninstalled(string pkgID); + + /// + /// A method will be called if the app gets a App Control request for pinning a app. + /// + void OnPinAppRequestReceived(); + + /// + /// A method will be called if the app gets an app pinned notification App Control request. + /// + /// A pinned app ID + void OnAppPinnedNotificationReceived(string appID); + + /// + /// A method will be called when the Navigation remote control key is pressed. + /// + /// A pressed remote control key name + void OnNavigationKeyPressed(string keyName); + } +} diff --git a/LibCommon.Shared/Utils/IStatePublisher.cs b/LibCommon.Shared/Utils/IStatePublisher.cs new file mode 100644 index 0000000..0c3605d --- /dev/null +++ b/LibCommon.Shared/Utils/IStatePublisher.cs @@ -0,0 +1,47 @@ +/* + * 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.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibTVRefCommonPortable.Utils +{ + public enum AppState + { + HomeMainPanelRecentFocused, + HomeMainPanelAppsFocused, + HomeMainPanelSettingsFocused, + HomeSubPanelRecentFocused, + HomeSubPanelAppsFocused, + HomeSubPanelSettingsFocused, + HomeShowOptions, + HomeMove, + HomeIconified, + } + + public interface IStatePublisher + { + AppState CurrentState + { + get; + set; + } + + } +} diff --git a/LibCommon.Shared/Utils/IStateSubscriber.cs b/LibCommon.Shared/Utils/IStateSubscriber.cs new file mode 100644 index 0000000..bb59eb7 --- /dev/null +++ b/LibCommon.Shared/Utils/IStateSubscriber.cs @@ -0,0 +1,29 @@ +/* + * 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.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibTVRefCommonPortable.Utils +{ + public interface IStateSubscriber + { + void OnStateChanged(AppState state); + } +} diff --git a/LibCommon.Shared/Utils/ISystemSettings.cs b/LibCommon.Shared/Utils/ISystemSettings.cs new file mode 100644 index 0000000..97c369e --- /dev/null +++ b/LibCommon.Shared/Utils/ISystemSettings.cs @@ -0,0 +1,31 @@ +/* + * 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 +{ + /// + /// An interface for getting system setting informations. + /// + public interface ISystemSettings + { + /// + /// A method for getting system model name. + /// + /// The system model name + /// The result whether getting the modelName is done + bool GetSystemModelName(out string modelName); + } +} diff --git a/LibCommon.Shared/Utils/ITVHome.cs b/LibCommon.Shared/Utils/ITVHome.cs new file mode 100644 index 0000000..c7c6f69 --- /dev/null +++ b/LibCommon.Shared/Utils/ITVHome.cs @@ -0,0 +1,48 @@ +/* + * 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 LibTVRefCommonPortable.Models; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// An interface for the TVHomeImpl class + /// The Models' instances in the TVHomeImpl class, + /// so to use the Models from other files, it should access the instance of the TVHomeImpl. + /// To reduce dependency between the TVHome and any other file, + /// the instance of the TVHomeImpl will be provided as a ITVHome interface. + /// + public interface ITVHome + { + /// + /// An instance of the AppShortcutController + /// + /// + AppShortcutController AppShortcutControllerInstance + { + get; + } + + /// + /// An instance of the RecentShortcutController + /// + /// + RecentShortcutController RecentShortcutControllerInstance + { + get; + } + } +} diff --git a/LibCommon.Shared/Utils/IWindowAPIs.cs b/LibCommon.Shared/Utils/IWindowAPIs.cs new file mode 100644 index 0000000..98de5ef --- /dev/null +++ b/LibCommon.Shared/Utils/IWindowAPIs.cs @@ -0,0 +1,36 @@ +/* + * 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 +{ + /// + /// An interface for the Window management. + /// + public interface IWindowAPIs + { + /// + /// A method minimizes the app's window. + /// + /// A minimize status + void SetIconified(bool iconified); + + /// + /// A method provides a minimized status of the App. + /// + /// A status of minimized of app. + bool GetIconified(); + } +} diff --git a/LibCommon.Shared/Utils/MediaContentUtils.cs b/LibCommon.Shared/Utils/MediaContentUtils.cs new file mode 100644 index 0000000..9d56eb2 --- /dev/null +++ b/LibCommon.Shared/Utils/MediaContentUtils.cs @@ -0,0 +1,81 @@ +/* + * 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 LibTVRefCommonPortable.Stubs; +using System; +using System.Collections.Generic; +using Xamarin.Forms; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class provides media contents and related functions. + /// + public class MediaContentUtils + { + /// + /// A instance of IMediaContentAPIs port. + /// + private static IMediaContentAPIs mediaContentAPIs; + + /// + /// A instance of MediaContentUtils + /// + private static readonly MediaContentUtils instance = new MediaContentUtils(); + + /// + /// A property of MediaContentUtils instance. + /// + public static MediaContentUtils Instance + { + get + { + return instance; + } + } + + /// + /// A Constructor + /// + private MediaContentUtils() + { + mediaContentAPIs = new MediaContentAPITestStub(); + + try + { + if (DependencyService.Get() != null) + { + mediaContentAPIs = DependencyService.Get(); + } + } + catch (InvalidOperationException e) + { + DebuggingUtils.Err(e.Message); + } + } + + /// + /// A method provides media playing history. + /// + /// A number of getting media playing history + /// A list of played medias. + public IEnumerable GetRecentlyPlayedMedia(int limitation) + { + return mediaContentAPIs.GetRecentlyPlayedMedia(limitation); + } + + } +} diff --git a/LibCommon.Shared/Utils/PackageManagerUtils.cs b/LibCommon.Shared/Utils/PackageManagerUtils.cs new file mode 100644 index 0000000..50cd961 --- /dev/null +++ b/LibCommon.Shared/Utils/PackageManagerUtils.cs @@ -0,0 +1,116 @@ +/* + * 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.Collections.Generic; +using Xamarin.Forms; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class for package manager function. + /// + public sealed class PackageManagerUtils + { + /// + /// A method provides installed package list. + /// + /// A package list + public static Dictionary GetPackageList() + { + if (DependencyService.Get() == null) + { + return new Dictionary(); + } + + return DependencyService.Get().GetPackageList(); + } + + /// + /// A method provides a detail information (TBD) + /// + /// A package ID + /// A package label + public static string GetPackageLabel(string pkgID) + { + if (DependencyService.Get() == null) + { + return null; + } + + return DependencyService.Get().GetPackageLabel(pkgID); + } + + /// + /// Gets the pacakge ID by the app ID + /// + /// The app ID to get + /// The pacakge ID that contains given app ID + public static string GetPackageIDByAppID(string appID) + { + if (DependencyService.Get() == null) + { + return null; + } + + return DependencyService.Get().GetPackageIDByAppID(appID); + } + + /// + /// A method removes the package. + /// + /// A package ID + /// A status of uninstall + public static bool UninstallPackage(string pkgID) + { + if (DependencyService.Get() == null) + { + return false; + } + + return DependencyService.Get().UninstallPackage(pkgID); + } + + /// + /// A method remove the package by using an app ID. + /// + /// An app ID + /// A status of uninstallation + public static bool UninstallPackageByAppID(string appID) + { + if (DependencyService.Get() == null) + { + return false; + } + + return DependencyService.Get().UninstallPackageByAppID(appID); + } + + /// + /// Gets applications list by the package ID + /// + /// The package ID to get applications + /// The list of applications + public static List GetApplicationsByPkgID(string pkgID) + { + if (DependencyService.Get() == null) + { + return null; + } + + return DependencyService.Get().GetApplicationsByPkgID(pkgID); + } + } +} diff --git a/LibCommon.Shared/Utils/RecentShortcutStorage.cs b/LibCommon.Shared/Utils/RecentShortcutStorage.cs new file mode 100644 index 0000000..6d9dedd --- /dev/null +++ b/LibCommon.Shared/Utils/RecentShortcutStorage.cs @@ -0,0 +1,181 @@ +/* + * 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.Collections.Generic; +using LibTVRefCommonPortable.DataModels; +using System; +using LibTVRefCommonPortable.Models; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class to manage the Recent Shortcuts. + /// + public sealed class RecentShortcutStorage + { + /// + /// A maximum number of recent apps and contents + /// + private static readonly int MaxRecents = 10; + + /// + /// A method provides all Recent Shortcuts' information list. + /// + /// a Recent Shortcut information list. + public static IEnumerable Read() + { + List recentShortcutInfoList = new List(); + IEnumerable recentApps = null; + + try + { + recentApps = ApplicationManagerUtils.Instance.GetRecentApplications(); + } + catch (Exception e) + { + DebuggingUtils.Err("GetRecentApplications failed. " + e.Message); + } + + if (recentApps != null) + { + foreach (var item in recentApps) + { + if (ManagedApps.IsHiddenRecentApp(item.AppID)) + { + continue; + } + + if (item.Applabel == null || item.Applabel.Length == 0 || + item.LaunchedTime.CompareTo(new DateTime()) == 0) + { + continue; + } + + var defaultStateDescription = new StateDescription() + { + Label = item.Applabel, + IconPath = item.IconPath, + Action = new AppControlAction() + { + AppID = item.AppID, + } + }; + var recentShortcutInfo = new RecentShortcutInfo(); + + if (item.ScreenShot == null) + { + recentShortcutInfo.ScreenshotPath = "screenshot.png"; + + string capturedAppScreen = FileSystemUtils.Instance.PlatformShareStorage + item.AppID + ".jpg"; + if (FileSystemUtils.Instance.IsFileExist(capturedAppScreen)) + { + recentShortcutInfo.ScreenshotPath = capturedAppScreen; + } + else + { + string testScreenShot = FileSystemUtils.Instance.AppResourceStorage + item.AppID + ".png"; + if (FileSystemUtils.Instance.IsFileExist(testScreenShot)) + { + recentShortcutInfo.ScreenshotPath = testScreenShot; + } + } + } + else + { + recentShortcutInfo.ScreenshotPath = item.ScreenShot; + } + + recentShortcutInfo.Type = RecentShortcutType.Application; + recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); + recentShortcutInfo.CurrentStateDescription = defaultStateDescription; + recentShortcutInfo.Id = item.AppID; + recentShortcutInfo.Date = item.LaunchedTime; + recentShortcutInfoList.Add(recentShortcutInfo); + } + } + + IEnumerable recentMedias = MediaContentUtils.Instance.GetRecentlyPlayedMedia(MaxRecents); + foreach (var item in recentMedias) + { + if (item.FilePath == null || item.FilePath.Length == 0) + { + continue; + } + + // DebuggingUtils.Dbg("media :" + item.DisplayName + ", PlayedAt : " + item.PlayedAt.ToString()); + var defaultStateDescription = new StateDescription() + { + Label = item.DisplayName, + IconPath = "ic_launcher_mediahub_138.png", + Action = new MediaControlAction() + { + AppID = "org.tizen.xamediahub", + FileUri = "file://" + item.FilePath, + } + }; + var mediaControlAction = defaultStateDescription.Action as MediaControlAction; + + mediaControlAction?.ExtraData.Add("View By", "All"); + mediaControlAction?.ExtraData.Add("Media type", "Video"); + mediaControlAction?.ExtraData.Add("Media Id", item.MediaId); + + var recentShortcutInfo = new RecentShortcutInfo(); + + recentShortcutInfo.ScreenshotPath = item.FilePath + ".tn"; + + if (item.ThumbnailPath != null) + { + if (FileSystemUtils.Instance.IsFileExist(item.ThumbnailPath)) + { + recentShortcutInfo.ScreenshotPath = item.ThumbnailPath; + } + } + + recentShortcutInfo.Type = RecentShortcutType.Media; + recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); + recentShortcutInfo.CurrentStateDescription = defaultStateDescription; + recentShortcutInfo.Id = "org.tizen.xamediahub"; + recentShortcutInfo.Date = item.PlayedAt.ToUniversalTime(); + recentShortcutInfoList.Add(recentShortcutInfo); + } + + recentShortcutInfoList.Sort(); + if (recentShortcutInfoList.Count > MaxRecents) + { + recentShortcutInfoList.RemoveRange(MaxRecents, recentShortcutInfoList.Count - MaxRecents); + } + + return recentShortcutInfoList; + } + + /// + /// A method deletes a Recent Shortcut. + /// + /// An application ID + public static void Delete(string appId) + { + ApplicationManagerUtils.Instance.DeleteRecentApplication(appId); + } + + /// + /// A method deletes all Recent Shortcuts. + /// + public static void DeleteAll() + { + ApplicationManagerUtils.Instance.DeleteAllRecentApplication(); + } + } +} diff --git a/LibCommon.Shared/Utils/SizeUtils.cs b/LibCommon.Shared/Utils/SizeUtils.cs new file mode 100644 index 0000000..4ac601d --- /dev/null +++ b/LibCommon.Shared/Utils/SizeUtils.cs @@ -0,0 +1,171 @@ +/* + * 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; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A class provides Size metric related functions + /// + public class SizeUtils + { + /// + /// Base Screen Height + /// + private static int baseScreenWidth = 1920; + + /// + /// Base Screen Height + /// + public static int BaseScreenWidth + { + get + { + return baseScreenWidth; + } + } + + /// + /// Base Screen Height + /// + private static int baseScreenHeight = 1080; + + /// + /// Base Screen Height + /// + public static int BaseScreenHeight + { + get + { + return baseScreenHeight; + } + } + + + /// + /// Screen Height + /// + public static int ScreenHeight { set; get; } + + /// + /// Screen Width + /// + public static int ScreenWidth { set; get; } + + /// + /// Device DPI + /// + public static double Dpi { set; get; } + + /// + /// Font Scale ratio + /// + public static double ScaleRatio { set; get; } + + /// + /// Platform Model enumerations + /// + private enum PlatformModel + { + TV, + Emulator, + Other, + } + + /// + /// Platform Model Name + /// + private static PlatformModel ModelName = PlatformModel.TV; + + /// + /// Set model name of running device. + /// + /// a model name + 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; + } + } + + /// + /// A method provides a converted height size. + /// + /// A height value in BaseScreen ratio + /// A converted height size + public static int GetHeightSize(int heightBaseSize) + { + return Convert.ToInt32((double)((double)heightBaseSize / (double)BaseScreenHeight) * (double)(ScreenHeight)); + } + + /// + /// A method provides a converted width size. + /// + /// A width value in BaseScreen ratio + /// A converted width size + public static int GetWidthSize(int widthBaseSize) + { + return Convert.ToInt32((double)((double)widthBaseSize / (double)BaseScreenWidth) * (double)(ScreenWidth)); + } + + /// + /// A method provides a converted width size by double type. + /// + /// A width value in BaseScreen ratio + /// A converted width size + public static double GetWidthSizeDouble(double widthBaseSize) + { + return (double)(widthBaseSize / (double)BaseScreenWidth) * (double)(ScreenWidth); + } + + /// + /// A method provides a converted font size. + /// + /// A base font size value in BaseScreen ratio + /// A converted font size + public static int GetFontSize(int fontBaseSize) + { + 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: + //DebuggingUtils.Dbg(String.Format("TV/Other, fontBaseSize = {0}, BaseScreenHeight = {1}, ScreenHeight = {2}, ScaleRatio = {3}", fontBaseSize, BaseScreenHeight, ScreenHeight, ScaleRatio)); + double tempAdjustmentRatio = 1D; + return Convert.ToInt32(((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio * tempAdjustmentRatio); + } + } + } +} diff --git a/LibCommon.Shared/Utils/TVHomeImpl.cs b/LibCommon.Shared/Utils/TVHomeImpl.cs new file mode 100644 index 0000000..01cd0f2 --- /dev/null +++ b/LibCommon.Shared/Utils/TVHomeImpl.cs @@ -0,0 +1,81 @@ +/* + * 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 LibTVRefCommonPortable.Models; + +namespace LibTVRefCommonPortable.Utils +{ + /// + /// A main instance class of the TVHome, TVApps to providing the Model functions. + /// This class is a kind of the Singleton class and includes major Model classes + /// such as the AppShortcutController, the RecentShortcutController, and the SettingShortcutcontroller + /// that are providing major functions related with TVHome, TVApps using scenarios. + /// + /// + /// + /// + public class TVHomeImpl : ITVHome + { + /// + /// An instance of the TVHomeImpl + /// + private static readonly TVHomeImpl instance = new TVHomeImpl(); + + /// + /// An instance of the TVHomeImpl + /// + public static ITVHome GetInstance + { + get + { + return instance; + } + } + + /// + /// A constructor of TVHomeImpl + /// Initializes Model implementations. + /// + private TVHomeImpl() + { + + } + + /// + /// An instance of the AppShortcutController + /// + private static readonly AppShortcutController appShortcutController = new AppShortcutController(); + public AppShortcutController AppShortcutControllerInstance + { + get + { + return appShortcutController; + } + } + + /// + /// An instance of the RecentShortcutController + /// + private static readonly RecentShortcutController recentShortcutController = new RecentShortcutController(); + public RecentShortcutController RecentShortcutControllerInstance + { + get + { + return recentShortcutController; + } + } + } +} diff --git a/LibCommon.Shared/bin/Debug/netstandard2.0/LibCommon.Shared.deps.json b/LibCommon.Shared/bin/Debug/netstandard2.0/LibCommon.Shared.deps.json new file mode 100644 index 0000000..6dfbe97 --- /dev/null +++ b/LibCommon.Shared/bin/Debug/netstandard2.0/LibCommon.Shared.deps.json @@ -0,0 +1,78 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "cf5149bdff09bd8db6df7773b79e5a86c601ccd4" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "LibCommon.Shared/1.0.0": { + "dependencies": { + "NETStandard.Library": "2.0.0", + "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005", + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "LibCommon.Shared.dll": {} + } + }, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "NETStandard.Library/2.0.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": { + "dependencies": { + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "lib/netstandard1.0/Tizen.Xamarin.Forms.Extension.dll": {} + } + }, + "Xamarin.Forms/2.4.0.266-pre1": { + "runtime": { + "lib/netstandard1.0/Xamarin.Forms.Core.dll": {}, + "lib/netstandard1.0/Xamarin.Forms.Platform.dll": {}, + "lib/netstandard1.0/Xamarin.Forms.Xaml.dll": {} + } + } + } + }, + "libraries": { + "LibCommon.Shared/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7jnbRU+L08FXKMxqUflxEXtVymWvNOrS8yHgu9s6EM8Anr6T/wIX4nZ08j/u3Asz+tCufp3YVwFSEvFTPYmBPA==", + "path": "netstandard.library/2.0.0", + "hashPath": "netstandard.library.2.0.0.nupkg.sha512" + }, + "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MKUamVt5XloZ/JziyOXLdbahn7T0LDQDJGUt3ynt0iSia4aLpZLOua6/iypBhnC79FgMaNfUA7APjVfjh3NLTg==", + "path": "tizen.xamarin.forms.extension/2.4.0-v00005", + "hashPath": "tizen.xamarin.forms.extension.2.4.0-v00005.nupkg.sha512" + }, + "Xamarin.Forms/2.4.0.266-pre1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pMu+b01vdH1ul5EJo1opQjEcwisWT35DdZO6EuR9HNKfY1dWyKmAlWgRdGUtjtdbhjOAtCOQUxI7F3x4hvV8KA==", + "path": "xamarin.forms/2.4.0.266-pre1", + "hashPath": "xamarin.forms.2.4.0.266-pre1.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/LibCommon.Tizen/LibCommon.Tizen.csproj b/LibCommon.Tizen/LibCommon.Tizen.csproj new file mode 100644 index 0000000..a57be02 --- /dev/null +++ b/LibCommon.Tizen/LibCommon.Tizen.csproj @@ -0,0 +1,18 @@ + + + + netstandard2.0 + + + + + + + + + + + + + + diff --git a/LibCommon.Tizen/Ports/AppControlPort.cs b/LibCommon.Tizen/Ports/AppControlPort.cs new file mode 100644 index 0000000..45dad8f --- /dev/null +++ b/LibCommon.Tizen/Ports/AppControlPort.cs @@ -0,0 +1,131 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using Tizen.Applications; +using System.Collections.Generic; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Handles the AppControl APIs + /// + public class AppControlPort : IAppControl + { + /// + /// The app ID of TV reference home application + /// + public static string TVHomeAppID = "org.tizen.xahome"; + + /// + /// The app ID of TV reference apps-tray application + /// + public static string TVAppsAppID = "org.tizen.xaapps"; + + /// + /// Represents the operation to be performed between TVHome and TVApps + /// This operation is sent from TVHomes to TVApps + /// + public static string AddAppOperation = "http://xahome.tizen.org/appcontrol/operation/add_app"; + + /// + /// Represents the operation to be performed between TVHome and TVApps + /// This operation is sent from TVApps to TVHome + /// + public static string AppAddedNotifyOperation = "http://xahome.tizen.org/appcontrol/operation/app_added"; + + public static string KeyAddedAppID = "AddedAppID"; + + /// + /// Sends the launch request + /// + /// The app ID to explicitly launch + /// The extra data for the app control + /// The file URI to be opened + public void SendLaunchRequest(string appId, IDictionary extraData = null, string fileUri = null) + { + try + { + AppControl appControl = new AppControl(); + + if (appId == null || appId.Length <= 0) + { + DbgPort.E("The AppID is null or blank"); + return; + } + + string value; + + appControl.ApplicationId = appId; + + if (extraData != null) + { + foreach (var key in extraData.Keys) + { + if (extraData.TryGetValue(key, out value)) + { + appControl.ExtraData.Add(key, value); + } + } + } + + if (fileUri != null && fileUri.Length != 0) + { + appControl.Uri = fileUri; + appControl.LaunchMode = AppControlLaunchMode.Group; + appControl.Mime = "video/*"; + appControl.Operation = AppControlOperations.View; + } + + AppControl.SendLaunchRequest(appControl); + } + catch (InvalidOperationException) + { + DbgPort.E("Failed to create AppControl"); + } + } + + /// + /// Sends the 'Add PIN apps' operation to TV Apps + /// + public void SendAddAppRequestToApps() + { + AppControl appControl = new AppControl() + { + ApplicationId = TVAppsAppID, + Operation = AddAppOperation, + }; + AppControl.SendLaunchRequest(appControl); + } + + /// + /// Sends the pinned app ID to TV Home + /// + /// The app ID to add PIN list int the TV Home + public void SendAppAddedNotificationToHome(string addedAddID) + { + AppControl appControl = new AppControl() + { + ApplicationId = TVHomeAppID, + Operation = AppAddedNotifyOperation, + }; + appControl.ExtraData.Add(KeyAddedAppID, addedAddID); + AppControl.SendLaunchRequest(appControl); + } + } +} diff --git a/LibCommon.Tizen/Ports/ApplicationManagerPort.cs b/LibCommon.Tizen/Ports/ApplicationManagerPort.cs new file mode 100644 index 0000000..29511ef --- /dev/null +++ b/LibCommon.Tizen/Ports/ApplicationManagerPort.cs @@ -0,0 +1,270 @@ +/* + * 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.Collections.Generic; +using System.Threading.Tasks; +using Tizen.Applications; +using LibTVRefCommonPortable.Utils; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Handles the ApplicationsManager APIs + /// + public class ApplicationManagerPort : IApplicationManagerAPIs + { + /// + /// Defines the default app icon + /// If the app icon is not exist, shows the default app icon + /// + private static String DefaultAppIcon = "AppIcon.png"; + + /// + /// The constructor of this class + /// Adds the EventHandler for ApplicationLaunched + /// + public ApplicationManagerPort() + { + ApplicationManager.ApplicationLaunched += new EventHandler(OnApplicationLaunched); + } + + /// + /// Arguments for the event that is raised when the application is launched + /// + /// The source of the event + /// An object that contains no event data + /// + /// https://msdn.microsoft.com/en-us/library/system.eventhandler(v=vs.110).aspx + /// + void OnApplicationLaunched(object sender, EventArgs args) + { + ApplicationLaunchedEventArgs launchedEventArgs = args as ApplicationLaunchedEventArgs; + DbgPort.D(launchedEventArgs.ApplicationRunningContext.ApplicationId + " launched"); + } + + /// + /// Clears all recent applications + /// + public void DeleteAllRecentApplication() + { + RecentApplicationControl.DeleteAll(); + } + + /// + /// Removes the specified application with the app ID + /// + /// An application ID that is removed + public void DeleteRecentApplication(string appId) + { + IEnumerable recentApps = ApplicationManager.GetRecentApplications(); + string pkgId = PackageManager.GetPackageIdByApplicationId(appId); + + foreach (var item in recentApps) + { + if (item.PackageId.Equals(pkgId)) + { + RecentApplicationControl controller = item.Controller; + controller.Delete(); + } + } + } + + /// + /// Gets the information of the recent applications + /// + /// The list of the recent applications + public IEnumerable GetRecentApplications() + { + bool isNoRecentApps = true; + List resultList = new List(); + + try + { + IEnumerable recentApps = ApplicationManager.GetRecentApplications(); + + foreach (var app in recentApps) + { + if (app.IsNoDisplay || + app.ApplicationId == null || + app.ApplicationId.Length < 1) + { + continue; + } + + DbgPort.D("Recent App (" + app.Label + "): " + app.ApplicationId); + + resultList.Add(new RecentApp() + { + InstanceID = app.InstanceId, + InstanceLabel = app.InstanceName, + AppID = app.ApplicationId, + Applabel = (app.Label == null || app.Label.Length < 1) ? "No Name" : app.Label, + IconPath = app.IconPath, + LaunchedTime = app.LaunchTime, + Uri = app.Uri, + }); + isNoRecentApps = false; + } + } + catch (InvalidOperationException) + { + DbgPort.E("Failed to get the information of the recent applications"); + return null; + } + + if (isNoRecentApps) + { + DbgPort.E("No Recent Apps!!!"); + } + + return resultList; + } + + /// + /// Gets the information of the specified application with the app ID + /// + /// The app Id to get + /// The information of the installed application + public InstalledApp GetInstalledApplication(string appID) + { + InstalledApp result = null; + ApplicationInfo appInfo = null; + + try + { + appInfo = ApplicationManager.GetInstalledApplication(appID); + if (appInfo == null) + { + DbgPort.D("GetInstalledApplication failed"); + return null; + } + + result = new InstalledApp() + { + AppID = appInfo.ApplicationId, + Applabel = appInfo.Label, + IconPath = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon, + }; + } + catch (Exception exception) + { + DbgPort.E("Failed to get the installed application(" + appID + ") :" + exception.Message); + return null; + } + + return result; + } + + /// + /// Gets the information of the installed applications asynchronously + /// + /// The list of the installed applications + public async Task> GetAllInstalledApplication() + { + try + { + IList resultList = new List(); + Task> task = ApplicationManager.GetInstalledApplicationsAsync(); + + IEnumerable installedList = await task; + + foreach (var appInfo in installedList) + { + if (appInfo.Label == null || + appInfo.ApplicationId == null || + appInfo.IsNoDisplay) + { + continue; + } + + Package pkgInfo = PackageManager.GetPackage(appInfo.PackageId); + if (pkgInfo == null) + { + continue; + } + + if (pkgInfo.IsSystemPackage) + { + continue; + } + + resultList.Add(new InstalledApp + { + AppID = appInfo.ApplicationId, + Applabel = appInfo.Label, + IconPath = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon, + InstalledTime = new DateTime(pkgInfo.InstalledTime), + }); + } + + return resultList; + } + catch (Exception exception) + { + DbgPort.E("Failed to get the all installed applications : " + exception.Message); + return null; + } + } + + /// + /// Checks whether application is removable + /// + /// The app ID to get + /// If the application is removable, true; otherwise, false + public bool GetAppInfoRemovable(string appID) + { + ApplicationInfo appInfo = null; + + try + { + appInfo = ApplicationManager.GetInstalledApplication(appID); + if (appInfo == null) + { + DbgPort.D("Failed to get the installed application(" + appID + ")"); + return false; + } + + return !appInfo.IsPreload; + } + catch (Exception exception) + { + DbgPort.E("Failed to get the installed application(" + appID + ") :" + exception.Message); + return false; + } + } + + /// + /// Gets the app ID by the app label + /// + /// the app label to get + /// the app ID of the app label + public async Task GetAppIDbyAppLabel(string appLabel) + { + IEnumerable installedList = await ApplicationManager.GetInstalledApplicationsAsync(); + + foreach (var app in installedList) + { + if (app != null && app.Label.Equals(appLabel)) + { + return app.ApplicationId; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/LibCommon.Tizen/Ports/DbgPort.cs b/LibCommon.Tizen/Ports/DbgPort.cs new file mode 100644 index 0000000..682f4c0 --- /dev/null +++ b/LibCommon.Tizen/Ports/DbgPort.cs @@ -0,0 +1,141 @@ +/* + * 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 Xamarin.Forms.Platform.Tizen.Native; +using Tizen; +using LibTVRefCommonPortable.Utils; +using System.Runtime.CompilerServices; +using System; +using ElmSharp; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Platform dependent implementation for the Logging and the Popup displaying + /// DbgPort is implementing IDebuggingAPIs which is defined in Calculator shared project + /// + /// + /// Please refer to Xamarin Dependency Service + /// https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/ + /// + public class DbgPort : IDebuggingAPIs + { + /// + /// A TV Home Windows reference + /// This is used to display a Dialog + /// + public static Window MainWindow + { + set; + get; + } + + /// + /// A Logging Tag + /// + public static string TAG = "home"; + + + /// + /// A flag which enables console log writting + /// + private static readonly bool IsNeedToShowInConsole = true; + + public static string Prefix + { + set; + get; + } + + /// + /// Displays a log message which developer want to check + /// + /// A debugging message + /// A file name that debugging message is exist + /// A function name that debugging message is exist + /// A line number that debugging message is exist + public void Dbg(string message, String file, String func, Int32 line) + { + D(message, file, func, line); + } + + /// + /// + /// A debugging message + /// A file name that debugging message is exist + /// A function name that debugging message is exist + /// A line number that debugging message is exist + public void Err(string message, String file, String func, Int32 line) + { + E(message, file, func, line); + } + + /// + /// Displays a dialog with a given message + /// + /// A debugging message + public void Popup(string message) + { + if (MainWindow == null) + { + return; + } + //bool result = await Xamarin.Forms.Page.DisplayAlert("Calculator", message, "OK"); + + Dialog toast = new Dialog(MainWindow); + toast.Title = message; + toast.Timeout = 2.3; + toast.BackButtonPressed += (s, e) => + { + toast.Dismiss(); + }; + toast.Show(); + } + + /// + /// Displays a log message which developer want to check + /// + /// A debugging message + /// A file name that debugging message is exist + /// A function name that debugging message is exist + /// A line number that debugging message is exist + public static void D(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) + { + Log.Debug(TAG, Prefix + ", " + message, file, func, line); + if (IsNeedToShowInConsole) + { + Console.WriteLine(String.Format("{0}, {1}:{2},{3}", message, file.Substring(file.LastIndexOf("\\")), line, func)); + } + + } + + /// + /// Displays an error log message + /// + /// A debugging message + /// A file name that debugging message is exist + /// A function name that debugging message is exist + /// A line number that debugging message is exist + public static void E(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) + { + Log.Error(TAG, Prefix + ", " + message, file, func, line); + if (IsNeedToShowInConsole) + { + Console.WriteLine(String.Format("{0}, {1}:{2},{3}", message, file.Substring(file.LastIndexOf("\\")), line, func)); + } + } + } +} \ No newline at end of file diff --git a/LibCommon.Tizen/Ports/FileSystemPort.cs b/LibCommon.Tizen/Ports/FileSystemPort.cs new file mode 100644 index 0000000..3479317 --- /dev/null +++ b/LibCommon.Tizen/Ports/FileSystemPort.cs @@ -0,0 +1,152 @@ +/* + * 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.IO; +using LibTVRefCommonPortable.Utils; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Handles FileSystem APIs + /// + public class FileSystemPort : IFileSystemAPIs + { + /// + /// A directory path which should be used for app data storing. + /// + public static string AppDataStroagePath { private get; set; } + + /// + /// A property of AppDataStroagePath to be exported to PCL. + /// + public string AppDataStorage + { + get + { + return AppDataStroagePath ?? ""; + } + } + + public static string AppResourceStoragePath { private get; set; } + + public string AppResourceStorage + { + get + { + return AppResourceStoragePath ?? ""; + } + } + + /// + /// A directory path which should be used for sharing between apps. + /// + public static string PlatformShareStroagePath { private get; set; } + + /// + /// A property of PlatformShareStroagePath to be exported to PCL. + /// + public string PlatformShareStorage + { + get + { + return PlatformShareStroagePath ?? ""; + } + } + + /// + /// Opens the given file + /// + /// A relative or absolute path for the file that the current FileStream object will encapsulate + /// A constant that determines how to open or create the file + /// A generic view of a sequence of bytes + public Stream OpenFile(string filePath, UtilFileMode mode) + { + Stream fileStream = null; + DbgPort.D("[" + mode.ToString() + "] Opening the file, " + filePath); + try + { + fileStream = new FileStream(filePath, (FileMode)mode); + } + catch (Exception exception) + { + DbgPort.E("Exception!! " + exception.Message); + } + + return fileStream; + } + + /// + /// Flushes the given steam + /// + /// The stream to flush + public void Flush(Stream stream) + { + var fileStream = stream as FileStream; + fileStream.Flush(); + } + + /// + /// Closes the given stream + /// + /// The stream to close + public void CloseFile(Stream stream) + { + var fileStream = stream as FileStream; + fileStream.Dispose(); + } + + /// + /// Checks whether the given file exist + /// + /// The file to check + /// + /// true if the caller has the required permissions and path contains the name of an existing file, otherwise, false + /// + /// + /// https://msdn.microsoft.com/en-us/library/system.io.file.exists(v=vs.110).aspx + /// + public bool IsFileExist(String fileName) + { + return File.Exists(fileName); + } + + /// + /// Checks whether the given file ready + /// + /// The file to check + /// + /// true if the file is ready to open, otherwise, false + /// + /// + /// https://msdn.microsoft.com/en-us/library/y973b725(v=vs.110).aspx + /// + public bool IsFileReady(String fileName) + { + try + { + using (FileStream inputStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.None)) + { + return (inputStream.Length > 0) ? true : false; + } + } + catch (Exception) + { + return false; + } + } + } +} diff --git a/LibCommon.Tizen/Ports/FileSystemWatcherPort.cs b/LibCommon.Tizen/Ports/FileSystemWatcherPort.cs new file mode 100644 index 0000000..731690a --- /dev/null +++ b/LibCommon.Tizen/Ports/FileSystemWatcherPort.cs @@ -0,0 +1,81 @@ +/* + * 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.IO; +using LibTVRefCommonPortable.Utils; +using LibTVRefCommonPortable.DataModels; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Handles FileSystemWatcher APIs + /// + public class FileSystemWatcherPort : IFileSystemWatcherAPIs + { + static FileSystemWatcher watcher; + public event EventHandler CustomChanged; + private FileSystemEventCustomArgs args; + + /// + /// Listens to the file system change notifications and raises events when a directory, or file in a directory, changes + /// If the 'pinned_apps_info.xml' is created, changed, or deleted, invokes event handler method + /// + /// A file path which has the target file + /// A file name to be watching + /// + /// https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx + /// + public void Run(String path, String fileName) + { + if (File.Exists(path + fileName) == false) + { + DbgPort.E("Watching File is not exist!!!" + path + fileName); + } + + watcher = new FileSystemWatcher(); + watcher.Path = path; + watcher.NotifyFilter = NotifyFilters.LastWrite; + watcher.Filter = fileName; + + watcher.Created += new FileSystemEventHandler(WatcherChanged); + watcher.Changed += new FileSystemEventHandler(WatcherChanged); + watcher.Deleted += new FileSystemEventHandler(WatcherChanged); + watcher.IncludeSubdirectories = true; + watcher.EnableRaisingEvents = true; + } + + /// + /// Represents the method that will handle the Changed, Created, or Deleted event of a FileSystemWatcher class + /// + /// The source of the event + /// The FileSystemEventArgs that contains the event data + /// + /// https://msdn.microsoft.com/en-us/library/system.io.filesystemeventhandler(v=vs.110).aspx + /// + private void WatcherChanged(object sender, FileSystemEventArgs e) + { + args = new FileSystemEventCustomArgs((WatcherType)e.ChangeType, e.FullPath, e.Name); + if (e.ChangeType.Equals(WatcherChangeTypes.Changed)) + { + CustomChanged.Invoke(this, args); + } + + DbgPort.D(e.ChangeType + ", " + e.Name); + } + } +} diff --git a/LibCommon.Tizen/Ports/MediaContentPort.cs b/LibCommon.Tizen/Ports/MediaContentPort.cs new file mode 100644 index 0000000..ccc610b --- /dev/null +++ b/LibCommon.Tizen/Ports/MediaContentPort.cs @@ -0,0 +1,88 @@ +/* + * 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.Collections.Generic; +using Tizen.Content.MediaContent; +using LibTVRefCommonPortable.Utils; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Handles the MediaContent APIs + /// + public class MediaContentPort : IMediaContentAPIs + { + private MediaDatabase mediaDatabase; + private MediaInfoCommand mediaInfoCommand; + /// + /// The constructor of this class + /// Connects content database + /// + public MediaContentPort() + { + DbgPort.D("MediaContentPort"); + mediaDatabase = new MediaDatabase(); + mediaDatabase.Connect(); + mediaInfoCommand = new MediaInfoCommand(mediaDatabase); + } + + /// + /// A method for getting recently played media content list + /// + /// Maximum count of list + /// The recently played media content list + public IEnumerable GetRecentlyPlayedMedia(int limitation) + { + var recentlyPlayedVideos = new List(); + var selectArguments = new SelectArguments(); + + selectArguments.SortOrder = "MEDIA_LAST_PLAYED_TIME"; + //contentFilter.OrderKey = "MEDIA_LAST_PLAYED_TIME"; + //contentFilter.Order = ContentOrder.Desc; + selectArguments.FilterExpression = "MEDIA_TYPE=1 AND MEDIA_LAST_PLAYED_TIME!=0"; + selectArguments.StartRowIndex = 0; + selectArguments.TotalRowCount = limitation; + + IEnumerable mediaInformations = new List(); + + try + { + var reader = mediaInfoCommand.SelectMedia(selectArguments); + while (reader.Read()) + { + var videoInfo = reader.Current as VideoInfo; + recentlyPlayedVideos.Add( + new RecentlyPlayedMedia() + { + MediaId = videoInfo.Id, + ThumbnailPath = videoInfo.ThumbnailPath, + DisplayName = videoInfo.DisplayName, + //videoInfo. + //PlayedAt = videoInfo.PlayedAt, + FilePath = videoInfo.Path, + }); + } + } + catch (Exception exception) + { + DbgPort.E(exception.Message); + } + + return recentlyPlayedVideos; + } + } +} diff --git a/LibCommon.Tizen/Ports/PackageManagerPort.cs b/LibCommon.Tizen/Ports/PackageManagerPort.cs new file mode 100644 index 0000000..4004d1d --- /dev/null +++ b/LibCommon.Tizen/Ports/PackageManagerPort.cs @@ -0,0 +1,273 @@ +/* + * 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.Collections.Generic; +using Tizen.Applications; + +using LibTVRefCommonPortable.Utils; +using System; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Handles PackageManager APIs + /// + public class PackageManagerPort : IPackageManager + { + /// + /// An interface for platform notification + /// + private static IPlatformNotification Notification + { + get; + set; + } + + /// + /// The constructor for this class + /// + public PackageManagerPort() + { + + } + + /// + /// Registers a callback function to be invoked when the package is installed or uninstalled + /// + /// The instance of TVApps + public static void RegisterCallbacks(IPlatformNotification app) + { + Notification = app; + PackageManager.InstallProgressChanged += PackageManager_InstallProgressChanged; + PackageManager.UninstallProgressChanged += PackageManager_UninstallProgressChanged; + } + + /// + /// Unregisters the callback function + /// + public static void UnregisterCallbacks() + { + Notification = null; + PackageManager.InstallProgressChanged -= PackageManager_InstallProgressChanged; + PackageManager.UninstallProgressChanged -= PackageManager_UninstallProgressChanged; + } + + /// + /// UninstallProgressChanged event + /// This event is occurred when a package is getting uninstalled and the progress of the request to the package manager changes + /// + /// The source of the event + /// An object that contains no event data + private static void PackageManager_UninstallProgressChanged(object sender, PackageManagerEventArgs e) + { + if (e.State == PackageEventState.Completed) + { + if (Notification != null) + { + Notification.OnAppUninstalled(e.PackageId); + } + } + } + + /// + /// InstallProgressChanged event + /// This event is occurred when a package is getting installed and the progress of the request to the package manager changes + /// + /// The source of the event + /// An object that contains no event data + private static void PackageManager_InstallProgressChanged(object sender, PackageManagerEventArgs e) + { + if (e.State == PackageEventState.Completed) + { + Notification?.OnAppInstalled(e.PackageId); + } + } + + /// + /// Retrieves package information of all installed packages + /// + /// The list of packages + public Dictionary GetPackageList() + { + Dictionary pkgList = new Dictionary(); + IEnumerable packages = PackageManager.GetPackages(); + + string[] result; + + foreach (var item in packages) + { + if (item.Id == null) + { + continue; + } + + result = new string[3]; + var itemLabel = "No Name"; + + if (!string.IsNullOrEmpty(item.Label)) + { + itemLabel = item.Label; + } + + result[0] = itemLabel; + result[1] = item.Id; + result[2] = (System.IO.File.Exists(item.IconPath)) ? item.IconPath : "AppIcon.png"; + + pkgList.Add(itemLabel, result); + } + + return pkgList; + } + + /// + /// Gets the package label for the given package + /// + /// The ID of the package + /// The package label for the given package ID + public string GetPackageLabel(string pkgID) + { + try + { + Package tempItem = PackageManager.GetPackage(pkgID); + + if(tempItem == null) + { + return null; + } + else + { + return tempItem.Label; + } + } + catch (Exception e) + { + DbgPort.E("Failed to get package information(" + pkgID + ") : " + e.Message); + + return null; + } + } + + /// + /// Gets the pacakge ID by the app ID + /// + /// The app ID to get + /// The pacakge ID that contains given app ID + public string GetPackageIDByAppID(string appID) + { + try + { + return PackageManager.GetPackageIdByApplicationId(appID); + } + catch (Exception e) + { + DbgPort.E("Failed to get the package ID by app ID(" + appID + ") : " + e.Message); + + return null; + } + } + + /// + /// Uninstalls package with the given package + /// + /// The ID of the package to be uninstalled + /// Returns true if uninstalltion request is successful, false otherwise + public bool UninstallPackage(string pkgID) + { + try + { + Package tempItem = PackageManager.GetPackage(pkgID); + if(tempItem == null) + { + return false; + } + else + { + return PackageManager.Uninstall(tempItem.Id, tempItem.PackageType); + } + } + catch (Exception e) + { + DbgPort.E("Failed to get package information(" + pkgID + ") : " + e.Message); + + return false; + } + + } + + /// + /// Uninstalls package with the given app ID + /// + /// The app ID to be uninstalled< + /// Returns true if uninstallation request is successful, false otherwise + public bool UninstallPackageByAppID(string appID) + { + try + { + string pkgID = PackageManager.GetPackageIdByApplicationId(appID); + + return UninstallPackage(pkgID); + } + catch (Exception e) + { + DbgPort.E("Failed to uninstall by AppID(" + appID + ") : " + e.Message); + + return false; + } + } + + /// + /// Gets applications list by the package ID + /// + /// The package ID to get applications + /// The list of applications + public List GetApplicationsByPkgID(string pkgID) + { + try + { + int index = 0; + List apps = new List(); + Package pkg = PackageManager.GetPackage(pkgID); + if(pkg == null) + { + return null; + } + IEnumerable appsList = pkg.GetApplications(); + if (appsList == null) + { + DbgPort.E("Failed to get apps list(" + pkgID + ")"); + + return null; + } + + foreach (var app in appsList) + { + apps.Add(app.ApplicationId); + DbgPort.D("[" + index + "] " + app.ApplicationId); + index++; + } + + return apps; + } + catch (Exception e) + { + DbgPort.E("Failed to get the package information(" + pkgID + ") : " + e.Message); + + return new List(); + } + + } + } +} \ No newline at end of file diff --git a/LibCommon.Tizen/Ports/SystemSettingsPort.cs b/LibCommon.Tizen/Ports/SystemSettingsPort.cs new file mode 100644 index 0000000..8bba7c7 --- /dev/null +++ b/LibCommon.Tizen/Ports/SystemSettingsPort.cs @@ -0,0 +1,55 @@ +/* + * 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 +{ + /// + /// Handles the SystemSettings APIs + /// + 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); + } + + /// + /// A method for getting system model name. + /// + /// The system model name + /// The result whether getting the modelName is done + public bool GetSystemModelName(out string modelName) + { + if (SystemInfo.SystemInfoGetPlatformString(KeyModelName, out modelName) != ErrorNone) + { + modelName = ""; + return false; + } + + return true; + } + } +} diff --git a/LibCommon.Tizen/Ports/WindowPort.cs b/LibCommon.Tizen/Ports/WindowPort.cs new file mode 100644 index 0000000..2c45c91 --- /dev/null +++ b/LibCommon.Tizen/Ports/WindowPort.cs @@ -0,0 +1,103 @@ +/* + * 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 ElmSharp; + +namespace LibTVRefCommonTizen.Ports +{ + /// + /// Handles Window APIs + /// + public class WindowPort : IWindowAPIs + { + internal class ElmWindow + { + [DllImport("libelementary.so.1", EntryPoint = "elm_win_keygrab_set", CallingConvention = CallingConvention.Cdecl)] + internal static extern IntPtr ElmWinKeygrabSet(IntPtr obj, string key, ulong modifiers, ulong not_modifiers, int proirity, int grab_mode); + + [DllImport("libelementary.so.1", EntryPoint = "elm_win_iconified_set", CallingConvention = CallingConvention.Cdecl)] + internal static extern void ElmWinIconfiedSet(IntPtr obj, bool iconified); + + [DllImport("libelementary.so.1", EntryPoint = "elm_win_iconified_get", CallingConvention = CallingConvention.Cdecl)] + internal static extern bool ElmWinIconifiedGet(IntPtr obj); + } + + /// + /// The main window of the App + /// + static private Window mainWindow; + public Window MainWindow + { + set + { + mainWindow = value; + } + } + + /// + /// Sets the keygrab of the Elm_Win object + /// + /// + /// keyname string to set keygrab + /// + public void SetKeyGrabExclusively(string key) + { + if (mainWindow != null) + { + ElmWindow.ElmWinKeygrabSet((IntPtr)mainWindow, key, 0, 0, 0, 1024); + } + } + + /// + /// Sets the iconified state of a window + /// + /// + /// If true the window is iconified, otherwise false + /// + public void SetIconified(bool iconified) + { + if (mainWindow != null) + { + ElmWindow.ElmWinIconfiedSet((IntPtr)mainWindow, iconified); + } + } + + /// + /// Gets the iconified state of a window + /// + /// + /// true if the window is iconified, otherwise false + /// + public bool GetIconified() + { + return (mainWindow != null) ? ElmWindow.ElmWinIconifiedGet((IntPtr)mainWindow) : false; + } + + /// + /// Activates the window object + /// + /// + /// This is just a request that a Window Manager may ignore, so calling this function does not ensure in any way that the window is going to be the active one after it + /// + public void Active() + { + mainWindow?.Active(); + } + } +} diff --git a/LibCommon.Tizen/Settings.StyleCop b/LibCommon.Tizen/Settings.StyleCop new file mode 100644 index 0000000..837530c --- /dev/null +++ b/LibCommon.Tizen/Settings.StyleCop @@ -0,0 +1,722 @@ + + + NoMerge + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/LibCommon.Tizen/bin/Debug/netstandard2.0/LibCommon.Tizen.deps.json b/LibCommon.Tizen/bin/Debug/netstandard2.0/LibCommon.Tizen.deps.json new file mode 100644 index 0000000..35e1d9f --- /dev/null +++ b/LibCommon.Tizen/bin/Debug/netstandard2.0/LibCommon.Tizen.deps.json @@ -0,0 +1,199 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "2a93253ff39d191d9ba22d2151167c179fe82d97" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "LibCommon.Tizen/1.0.0": { + "dependencies": { + "LibCommon.Shared": "1.0.0", + "NETStandard.Library": "2.0.0", + "Tizen.NET": "4.0.0-preview1-00143", + "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005", + "Xamarin.Forms": "2.4.0.266-pre1", + "Xamarin.Forms.Platform.Tizen": "2.4.0-r266-006" + }, + "runtime": { + "LibCommon.Tizen.dll": {} + } + }, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "NETStandard.Library/2.0.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "Tizen.NET/4.0.0-preview1-00143": { + "runtime": { + "lib/netstandard1.6/ElmSharp.Wearable.dll": {}, + "lib/netstandard1.6/ElmSharp.dll": {}, + "lib/netstandard1.6/Tizen.Account.AccountManager.dll": {}, + "lib/netstandard1.6/Tizen.Account.FidoClient.dll": {}, + "lib/netstandard1.6/Tizen.Account.OAuth2.dll": {}, + "lib/netstandard1.6/Tizen.Account.SyncManager.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Alarm.dll": {}, + "lib/netstandard1.6/Tizen.Applications.AttachPanel.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Badge.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Common.dll": {}, + "lib/netstandard1.6/Tizen.Applications.DataControl.dll": {}, + "lib/netstandard1.6/Tizen.Applications.MessagePort.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Notification.dll": {}, + "lib/netstandard1.6/Tizen.Applications.NotificationEventListener.dll": {}, + "lib/netstandard1.6/Tizen.Applications.PackageManager.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Preference.dll": {}, + "lib/netstandard1.6/Tizen.Applications.RemoteView.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Service.dll": {}, + "lib/netstandard1.6/Tizen.Applications.ToastMessage.dll": {}, + "lib/netstandard1.6/Tizen.Applications.UI.dll": {}, + "lib/netstandard1.6/Tizen.Applications.WatchApplication.dll": {}, + "lib/netstandard1.6/Tizen.Applications.WidgetApplication.dll": {}, + "lib/netstandard1.6/Tizen.Applications.WidgetControl.dll": {}, + "lib/netstandard1.6/Tizen.Content.Download.dll": {}, + "lib/netstandard1.6/Tizen.Content.MediaContent.dll": {}, + "lib/netstandard1.6/Tizen.Content.MimeType.dll": {}, + "lib/netstandard1.6/Tizen.Context.dll": {}, + "lib/netstandard1.6/Tizen.Location.Geofence.dll": {}, + "lib/netstandard1.6/Tizen.Location.dll": {}, + "lib/netstandard1.6/Tizen.Log.dll": {}, + "lib/netstandard1.6/Tizen.Maps.dll": {}, + "lib/netstandard1.6/Tizen.Messaging.Push.dll": {}, + "lib/netstandard1.6/Tizen.Messaging.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.AudioIO.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Camera.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.MediaCodec.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.MediaPlayer.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Metadata.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Radio.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Recorder.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Remoting.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.StreamRecorder.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Util.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Vision.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.dll": {}, + "lib/netstandard1.6/Tizen.NUI.dll": {}, + "lib/netstandard1.6/Tizen.Network.Bluetooth.dll": {}, + "lib/netstandard1.6/Tizen.Network.Connection.dll": {}, + "lib/netstandard1.6/Tizen.Network.IoTConnectivity.dll": {}, + "lib/netstandard1.6/Tizen.Network.Nfc.dll": {}, + "lib/netstandard1.6/Tizen.Network.Nsd.dll": {}, + "lib/netstandard1.6/Tizen.Network.Smartcard.dll": {}, + "lib/netstandard1.6/Tizen.Network.WiFi.dll": {}, + "lib/netstandard1.6/Tizen.Network.WiFiDirect.dll": {}, + "lib/netstandard1.6/Tizen.PhonenumberUtils.dll": {}, + "lib/netstandard1.6/Tizen.Pims.Calendar.dll": {}, + "lib/netstandard1.6/Tizen.Pims.Contacts.dll": {}, + "lib/netstandard1.6/Tizen.Security.SecureRepository.dll": {}, + "lib/netstandard1.6/Tizen.Security.TEEC.dll": {}, + "lib/netstandard1.6/Tizen.Security.dll": {}, + "lib/netstandard1.6/Tizen.Sensor.dll": {}, + "lib/netstandard1.6/Tizen.System.Feedback.dll": {}, + "lib/netstandard1.6/Tizen.System.Information.dll": {}, + "lib/netstandard1.6/Tizen.System.MediaKey.dll": {}, + "lib/netstandard1.6/Tizen.System.PlatformConfig.dll": {}, + "lib/netstandard1.6/Tizen.System.Storage.dll": {}, + "lib/netstandard1.6/Tizen.System.SystemSettings.dll": {}, + "lib/netstandard1.6/Tizen.System.dll": {}, + "lib/netstandard1.6/Tizen.Telephony.dll": {}, + "lib/netstandard1.6/Tizen.Tracer.dll": {}, + "lib/netstandard1.6/Tizen.Uix.InputMethod.dll": {}, + "lib/netstandard1.6/Tizen.Uix.InputMethodManager.dll": {}, + "lib/netstandard1.6/Tizen.Uix.Stt.dll": {}, + "lib/netstandard1.6/Tizen.Uix.Tts.dll": {}, + "lib/netstandard1.6/Tizen.Uix.VoiceControl.dll": {}, + "lib/netstandard1.6/Tizen.WebView.dll": {}, + "lib/netstandard1.6/Tizen.dll": {} + } + }, + "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": { + "dependencies": { + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "lib/netstandard1.0/Tizen.Xamarin.Forms.Extension.dll": {} + } + }, + "Xamarin.Forms/2.4.0.266-pre1": { + "runtime": { + "lib/netstandard1.0/Xamarin.Forms.Core.dll": {}, + "lib/netstandard1.0/Xamarin.Forms.Platform.dll": {}, + "lib/netstandard1.0/Xamarin.Forms.Xaml.dll": {} + } + }, + "Xamarin.Forms.Platform.Tizen/2.4.0-r266-006": { + "dependencies": { + "Tizen.NET": "4.0.0-preview1-00143", + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "lib/netstandard1.6/Xamarin.Forms.Platform.Tizen.dll": {} + } + }, + "LibCommon.Shared/1.0.0": { + "dependencies": { + "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005", + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "LibCommon.Shared.dll": {} + } + } + } + }, + "libraries": { + "LibCommon.Tizen/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7jnbRU+L08FXKMxqUflxEXtVymWvNOrS8yHgu9s6EM8Anr6T/wIX4nZ08j/u3Asz+tCufp3YVwFSEvFTPYmBPA==", + "path": "netstandard.library/2.0.0", + "hashPath": "netstandard.library.2.0.0.nupkg.sha512" + }, + "Tizen.NET/4.0.0-preview1-00143": { + "type": "package", + "serviceable": true, + "sha512": "sha512-woW6D9FsWZD2lJRwbND2hzMIi9l7QYwUqfpCxrMT3+Mh3+8UdFM86skDdw3mAgpLIqfC1plUfbISksQ9G2Gcgg==", + "path": "tizen.net/4.0.0-preview1-00143", + "hashPath": "tizen.net.4.0.0-preview1-00143.nupkg.sha512" + }, + "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MKUamVt5XloZ/JziyOXLdbahn7T0LDQDJGUt3ynt0iSia4aLpZLOua6/iypBhnC79FgMaNfUA7APjVfjh3NLTg==", + "path": "tizen.xamarin.forms.extension/2.4.0-v00005", + "hashPath": "tizen.xamarin.forms.extension.2.4.0-v00005.nupkg.sha512" + }, + "Xamarin.Forms/2.4.0.266-pre1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pMu+b01vdH1ul5EJo1opQjEcwisWT35DdZO6EuR9HNKfY1dWyKmAlWgRdGUtjtdbhjOAtCOQUxI7F3x4hvV8KA==", + "path": "xamarin.forms/2.4.0.266-pre1", + "hashPath": "xamarin.forms.2.4.0.266-pre1.nupkg.sha512" + }, + "Xamarin.Forms.Platform.Tizen/2.4.0-r266-006": { + "type": "package", + "serviceable": true, + "sha512": "sha512-xDEcJnKerroXtMLLUVssB9+f2mZMB5ngulNB09OsIp0gRqP7GnpqJEyWQsISFRCk272lNVd57UhXGCUFl9/aRg==", + "path": "xamarin.forms.platform.tizen/2.4.0-r266-006", + "hashPath": "xamarin.forms.platform.tizen.2.4.0-r266-006.nupkg.sha512" + }, + "LibCommon.Shared/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/LibTVRefCommonPortable/DataModels/AppControlAction.cs b/LibTVRefCommonPortable/DataModels/AppControlAction.cs deleted file mode 100644 index e30afe4..0000000 --- a/LibTVRefCommonPortable/DataModels/AppControlAction.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using System.Collections.Generic; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// A class defines App Control behavior. - /// - public class AppControlAction : IAction - { - /// - /// A target application ID - /// - public string AppID { get; set; } - - /// - /// A dictionary which has extra data for App Control - /// - protected Dictionary extraData; - - /// - /// A dictionary which has extra data for App Control - /// - public Dictionary ExtraData - { - get - { - if (extraData == null) - { - extraData = new Dictionary(); - } - - return extraData; - } - } - - /// - /// A method which invoke an App Control to the application of the AppID - /// - /// a next state after App Control invocation - public string Execute() - { - // Warn : Do NOT pass 'E'xtraData, it will create a new Dictionary and it might cause unexpected situation. - AppControlUtils.SendLaunchRequest(AppID, extraData); - return "default"; - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs deleted file mode 100755 index 7aeff96..0000000 --- a/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs +++ /dev/null @@ -1,232 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using System; -using System.Xml.Serialization; -using Xamarin.Forms; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// A class defines App Shortcut button - /// - public class AppShortcutInfo : ShortcutInfo - { - /// - /// An application ID of the App Shortcut. - /// - public string AppID { get; set; } - - /// - /// An App Shortcut status. - /// - [XmlIgnore] - public string Status { get; set; } - - /// - /// A flag indicates that a App Shortcut is checked or not. - /// - [XmlIgnore] - private bool isChecked; - - /// - /// A flag indicates that a App Shortcut is checked or not. - /// - [XmlIgnore] - public bool IsChecked - { - get - { - return isChecked; - } - - set - { - if (isChecked != value) - { - isChecked = value; - OnPropertyChanged("IsChecked"); - } - } - } - - /// - /// A flag indicates that a App Shortcut is pinned or not. - /// - [XmlIgnore] - private bool isPinned; - - /// - /// A flag indicates that a App Shortcut is pinned or not. - /// - [XmlIgnore] - public bool IsPinned - { - get - { - return isPinned; - } - - set - { - if (isPinned != value) - { - isPinned = value; - OnPropertyChanged("IsPinned"); - } - } - } - - /// - /// A flag indicates that a App Shortcut can be removed. - /// - [XmlIgnore] - public bool IsRemovable { get; set; } - - /// - /// A flag indicates that a App Shortcut is focused or not. - /// - [XmlIgnore] - private bool isFocused; - - /// - /// A flag indicates that a App Shortcut is focused or not. - /// - [XmlIgnore] - public bool IsFocused - { - get - { - return isFocused; - } - - set - { - if (isFocused != value) - { - isFocused = value; - OnPropertyChanged("IsFocused"); - } - } - } - - /// - /// A flag indicates that a App Shortcut is dimmed or not. - /// - [XmlIgnore] - private bool isDim; - - /// - /// A flag indicates that a App Shortcut is dimmed or not. - /// - [XmlIgnore] - public bool IsDim - { - get - { - return isDim; - } - - set - { - if (isDim != value) - { - isDim = value; - OnPropertyChanged("IsDim"); - } - } - } - - /// - /// A flag indicates that a App Shortcut is showing options or not. - /// - [XmlIgnore] - private bool isShowOptions; - - /// - /// A flag indicates that a App Shortcut is showing options or not. - /// - [XmlIgnore] - public bool IsShowOptions - { - get - { - return isShowOptions; - } - - set - { - if (isShowOptions != value) - { - isShowOptions = value; - OnPropertyChanged("IsShowOptions"); - } - } - } - - /// - /// An app installed time. - /// - [XmlIgnore] - public DateTime Installed { get; set; } - - /// - /// A pin command of the Option menu. - /// - [XmlIgnore] - public Command OptionMenuPinToggleCommand { get; set; } - - /// - /// A deleting app command of the Option menu. - /// - [XmlIgnore] - public Command OptionMenuDeleteCommand { get; set; } - - [XmlIgnore] - public Command ToDefaultCommand { get; set; } - - /// - /// A Constructor. - /// Initializes AppShortcutInfo. - /// - public AppShortcutInfo() - { - OptionMenuPinToggleCommand = new Command(() => - { - MessagingCenter.Send(this, "OptionMenuPinToggle", AppID); - }); - - OptionMenuDeleteCommand = new Command(() => - { - MessagingCenter.Send(this, "OptionMenuDelete", AppID); - }); - - ToDefaultCommand = new Command(() => - { - MessagingCenter.Send(this, "ChangeToDefaultMode"); - }); - } - - /// - /// Update State of a shortcut. - /// - public override void UpdateState() - { - SetCurrentState("default"); - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/CommandAction.cs b/LibTVRefCommonPortable/DataModels/CommandAction.cs deleted file mode 100644 index 220c7c5..0000000 --- a/LibTVRefCommonPortable/DataModels/CommandAction.cs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// A Action class which can invoke a Command - /// - public class CommandAction : IAction - { - /// - /// A next description after invocation of the Command. - /// - public string NextStateDescription { get; set; } - - /// - /// A Command to be executed - /// - public event EventHandler Command; - - /// - /// A Command parameter. - /// - public string CommandParameter { get; set; } - - /// - /// A method execute a action. - /// - /// A next statue of a Shortcut. - public string Execute() - { - Command?.Invoke(this, CommandParameter); - return NextStateDescription; - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/FileSystemEventCustomArgs.cs b/LibTVRefCommonPortable/DataModels/FileSystemEventCustomArgs.cs deleted file mode 100644 index b608ea9..0000000 --- a/LibTVRefCommonPortable/DataModels/FileSystemEventCustomArgs.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// A class contains file system event arguments. - /// - public class FileSystemEventCustomArgs : EventArgs - { - /// - /// Initializes a new instance of the System.IO.FileSystemEventArgs class. - /// - /// One of the System.IO.WatcherChangeTypes values, which represents the kind of change detected in the file system. - /// The root directory of the affected file or directory. - /// The name of the affected file or directory. - public FileSystemEventCustomArgs(WatcherType changeType, string directory, string name) - { - ChangeType = changeType; - FullPath = directory; - Name = name; - } - - /// - /// Gets the type of directory event that occurred. - /// One of the System.IO.WatcherChangeTypes values that represents the kind of change - /// detected in the file system. - /// - public WatcherType ChangeType { set; get; } - - /// - /// Gets the fully qualified path of the affected file or directory. - /// The path of the affected file or directory. - /// - public string FullPath { set; get; } - - /// - /// Gets the name of the affected file or directory. - /// The name of the affected file or directory. - /// - public string Name { set; get; } - } -} \ No newline at end of file diff --git a/LibTVRefCommonPortable/DataModels/HomeMenuAppShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/HomeMenuAppShortcutInfo.cs deleted file mode 100644 index 8ede65d..0000000 --- a/LibTVRefCommonPortable/DataModels/HomeMenuAppShortcutInfo.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.DataModels -{ - /// - /// A Home Menu AppShortcut information - /// - /// - public class HomeMenuAppShortcutInfo : ShortcutInfo - { - /// - /// A Shortcut status - /// - public string Status { get; set; } - - /// - /// A method initializes a status of a Shortcut. - /// - public override void UpdateState() - { - SetCurrentState("default"); - } - - /// - /// A method changes current status of a Shortcut. - /// - /// A new status - public void ChangeStatus(string status) - { - Status = status; - OnPropertyChanged("Status"); - SetCurrentState(status); - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/IAction.cs b/LibTVRefCommonPortable/DataModels/IAction.cs deleted file mode 100644 index d4616da..0000000 --- a/LibTVRefCommonPortable/DataModels/IAction.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.DataModels -{ - /// - /// An interface defines behaviors that will be exported by inherited classes. - /// - public interface IAction - { - /// - /// A method execute an action. - /// - /// A next statue of a Shortcut. - string Execute(); - } -} diff --git a/LibTVRefCommonPortable/DataModels/IEnumerableItem.cs b/LibTVRefCommonPortable/DataModels/IEnumerableItem.cs deleted file mode 100644 index efcfd2b..0000000 --- a/LibTVRefCommonPortable/DataModels/IEnumerableItem.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.Collections.Generic; - -namespace TVHome.DataModels -{ - public interface IEnumerableItem - { - IDictionary ItemProperties - { - set; - get; - } - - } -} diff --git a/LibTVRefCommonPortable/DataModels/MediaControlAction.cs b/LibTVRefCommonPortable/DataModels/MediaControlAction.cs deleted file mode 100644 index 440fcfb..0000000 --- a/LibTVRefCommonPortable/DataModels/MediaControlAction.cs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// A Media ControlAction. - /// - class MediaControlAction : AppControlAction - { - /// - /// A file URI to be open - /// - public string FileUri { get; set; } - - /// - /// A method execute a action. - /// - /// A next statue of a Shortcut. - new public string Execute() - { - // Warn : Do NOT pass 'E'xtraData, it will create a new Dictionary and it might cause unexpected situation. - AppControlUtils.SendLaunchRequest(AppID, extraData, FileUri); - return "default"; - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs deleted file mode 100755 index 3d853ef..0000000 --- a/LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.Collections; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// Types for recent shortcut - /// - public enum RecentShortcutType - { - Application = 0, - Media = 1, - } - - /// - /// A Recent Shortcut information - /// - public class RecentShortcutInfo : ShortcutInfo, IComparable - { - /// - /// A type for the content of the shortcut - /// - public RecentShortcutType Type { get; set; } - - /// - /// An Id for the content of the shortcut - /// - public string Id { get; set; } - /// - /// A Last used Time - /// - public DateTime Date { get; set; } - - /// - /// A Screenshot image path - /// - public string ScreenshotPath { get; set; } - - /// - /// Initialize State of a shortcut. - /// - public override void UpdateState() - { - SetCurrentState("default"); - } - - int IComparable.CompareTo(object target) - { - var rightShortcutInfo = target as RecentShortcutInfo; - return Date.CompareTo(rightShortcutInfo.Date) * -1; - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/SettingShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/SettingShortcutInfo.cs deleted file mode 100755 index fd355d2..0000000 --- a/LibTVRefCommonPortable/DataModels/SettingShortcutInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// A Setting Shortcut information - /// - public class SettingShortcutInfo : ShortcutInfo - { - /// - /// Initialize State of a shortcut. - /// - public override void UpdateState() - { - SetCurrentState("default"); - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/ShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/ShortcutInfo.cs deleted file mode 100644 index 00854f6..0000000 --- a/LibTVRefCommonPortable/DataModels/ShortcutInfo.cs +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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.Collections.Generic; -using System.ComponentModel; -using System.Xml.Serialization; -using LibTVRefCommonPortable.Utils; - -namespace LibTVRefCommonPortable.DataModels -{ - /// - /// TVHome and TVApps has several buttons that represent Apps, Contents, Settings. - /// The ShortcutInfo is a model for those buttons with detail information of the represented object. - /// - public abstract class ShortcutInfo : INotifyPropertyChanged - { - /// - /// An event handler for handing property changed. - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// State descriptions of Shortcut. - [XmlIgnore] - private Dictionary stateDescriptions = new Dictionary(); - - /// - /// State descriptions of Shortcut. - [XmlIgnore] - public Dictionary StateDescriptions - { - get - { - return stateDescriptions; - } - } - - /// - /// A method notifies property changed event. - /// A property name. - protected void OnPropertyChanged(string propertyName) - { - var handler = PropertyChanged; - if (handler != null) - { - handler(this, new PropertyChangedEventArgs(propertyName)); - } - } - - /// - /// A current state description of a Shortcut. - [XmlIgnore] - public StateDescription CurrentStateDescription - { - get; - set; - } - - /// - /// A current state description of a Shortcut. - /// A property name. - /// A result of state transition - protected bool SetCurrentState(string state) - { - if (stateDescriptions.ContainsKey(state) == false) - { - DebuggingUtils.Err(state + " is doesn't exists!!!"); - return false; - } - - if (CurrentStateDescription != null && - CurrentStateDescription == stateDescriptions[state]) - { - return true; - } - - CurrentStateDescription = stateDescriptions[state]; - OnPropertyChanged("CurrentStateDescription"); - return true; - } - - /// - /// Initialize State of a shortcut. - /// - abstract public void UpdateState(); - - /// - /// A method executes a action. - /// After execution of the action, status will be changed if returned status is available. - /// A result of action invocation. - public bool DoAction() - { - if (CurrentStateDescription == null) - { - DebuggingUtils.Err("Current state is not set!!!"); - return false; - } - - String newState = CurrentStateDescription.Action.Execute(); - if (newState == null) - { - DebuggingUtils.Err("Invalid State returned!!!"); - return false; - } - - return SetCurrentState(newState); - } - } -} diff --git a/LibTVRefCommonPortable/DataModels/StateDescription.cs b/LibTVRefCommonPortable/DataModels/StateDescription.cs deleted file mode 100644 index b3766c5..0000000 --- a/LibTVRefCommonPortable/DataModels/StateDescription.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.DataModels -{ - /// - /// A class represents a state of a Shortcut. - /// - public class StateDescription - { - /// - /// Constructor. - /// - public StateDescription() - { - Label = ""; - IconPath = ""; - } - - /// - /// A Shortcut label. - /// - public string Label - { - get; - set; - } - - /// - /// A Shortcut icon path. - /// - public string IconPath - { - get; - set; - } - - /// - /// A Action instance to be called when a Shortcut is pressed. - /// - public IAction Action - { - get; - set; - } - - } -} diff --git a/LibTVRefCommonPortable/DataModels/WatcherType.cs b/LibTVRefCommonPortable/DataModels/WatcherType.cs deleted file mode 100644 index 68ce9cc..0000000 --- a/LibTVRefCommonPortable/DataModels/WatcherType.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.DataModels -{ - /// - /// A File Watcher type enumeration. - /// - public enum WatcherType - { - /// - /// The creation of a file or folder. - /// - Created = 1, - /// - /// The deletion of a file or folder. - /// - Deleted = 2, - /// - /// The change of a file or folder. The types of changes include: changes to size, - /// attributes, security settings, last write, and last access time. - /// - Changed = 4, - /// - /// The renaming of a file or folder. - /// - Renamed = 8, - /// - /// The creation, deletion, change, or renaming of a file or folder. - /// - All = 15 - } -} diff --git a/LibTVRefCommonPortable/LibTVRefCommonPortable.csproj b/LibTVRefCommonPortable/LibTVRefCommonPortable.csproj deleted file mode 100755 index a5a92f2..0000000 --- a/LibTVRefCommonPortable/LibTVRefCommonPortable.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - - - 10.0 - Debug - AnyCPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24} - Library - Properties - LibTVRefCommonPortable - LibTVRefCommonPortable - v4.5 - Profile259 - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2.3.5-v00015 - - - 2.4.0-r266-001 - - - - - - - - - - \ No newline at end of file diff --git a/LibTVRefCommonPortable/Models/AppShortcutController.cs b/LibTVRefCommonPortable/Models/AppShortcutController.cs deleted file mode 100755 index 7ec06fd..0000000 --- a/LibTVRefCommonPortable/Models/AppShortcutController.cs +++ /dev/null @@ -1,353 +0,0 @@ -/* - * 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.Collections.Generic; -using LibTVRefCommonPortable.DataModels; -using LibTVRefCommonPortable.Utils; -using System.Threading.Tasks; - -namespace LibTVRefCommonPortable.Models -{ - /// - /// A class provides Application related information to ViewModel. - /// The TVHome shows the Pinned app list when the App Home Menu is pressed, - /// by invoking AppShortcutController's API to retrieve the pinned app list. - /// The TVApps shows the installed the Tizen UI apps in the main screen. - /// To provides the installed apps, the TVApps invokes an AppShortcutController's API. - /// - public class AppShortcutController - { - /// - /// A default app icon for no icon applications. - /// - private static String DefaultAppIcon = "AppIcon.png"; - - /// - /// A method provides installed app list. - /// The returned app list has only Tizen UI apps not the system app or no display apps. - /// - /// An installed app list. - public async Task> GetInstalledApps() - { - List appShortcutInfoList = new List(); - - var installedAppList = await ApplicationManagerUtils.Instance.GetAllInstalledApplication(); - - foreach (var item in installedAppList) - { - if (ManagedApps.IsNonPinnableApps(item.AppID)) - { - continue; - } - - var defaultStateDescription = new StateDescription() - { - Label = item.Applabel ?? "No Name", - IconPath = item.IconPath ?? DefaultAppIcon, - Action = new AppControlAction() - { - AppID = item.AppID, - } - }; - - var appShortcutInfo = new AppShortcutInfo() - { - IsRemovable = ApplicationManagerUtils.Instance.GetAppInfoRemovable(item.AppID), - Installed = item.InstalledTime, - }; - - appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); - appShortcutInfo.CurrentStateDescription = defaultStateDescription; - appShortcutInfo.AppID = item.AppID; - appShortcutInfoList.Add(appShortcutInfo); - } - - return appShortcutInfoList; - } - - /// - /// A method appends an All Apps Shortcut and a MediaHub Shortcut at first in the given App Shortcut list. - /// Actually this method is used for making the Pinned App Shortcut panel of the TVHome - /// - /// - /// - /// An App Shortcut list contains the additional Shortcuts. - private void AddAllAppsAndMediaHubShortcut(ref List returnPinnedAppsInfo) - { - var allAppsShortcutInfo = new AppShortcutInfo() - { - StateDescriptions = - { - { - "default", - new StateDescription - { - Label = "All apps", - IconPath = "ic_home_menu_apps_138.png", - Action = new AppControlAction - { - AppID = ManagedApps.TVAppsAppID, - } - } - }, - { - "focused", - new StateDescription - { - Label = "All apps", - IconPath = "ic_home_menu_apps_182.png", - Action = new AppControlAction - { - AppID = ManagedApps.TVAppsAppID, - } - } - }, - } - }; - - allAppsShortcutInfo.UpdateState(); - returnPinnedAppsInfo.Insert(0, allAppsShortcutInfo); - - var mediaHubShortcutInfo = new AppShortcutInfo() - { - StateDescriptions = - { - { - "default", - new StateDescription - { - Label = "Media Hub", - IconPath = "ic_launcher_mediahub_138.png", - Action = new AppControlAction - { - AppID = ManagedApps.MediaHubAppID, - } - } - }, - { - "focused", - new StateDescription - { - Label = "Media Hub", - IconPath = "ic_launcher_mediahub_182.png", - Action = new AppControlAction - { - AppID = ManagedApps.MediaHubAppID, - } - } - }, - } - }; - - mediaHubShortcutInfo.UpdateState(); - returnPinnedAppsInfo.Insert(1, mediaHubShortcutInfo); - } - - /// - /// A method appends an Add Pin Shortcut in the given App Shortcut list. - /// - /// - /// - /// An App Shortcut list contains the additional Shortcuts. - private void AppendAddPinShortcut(ref List returnPinnedAppsInfo) - { - var addPinCommandAction = new CommandAction() - { - NextStateDescription = "default", - CommandParameter = "", - }; - - addPinCommandAction.Command += new EventHandler((s, e) => - { - AppControlUtils.SendAddAppRequestToApps(); - }); - - var addPinShortcutInfo = new AppShortcutInfo() - { - StateDescriptions = - { - { - "default", - new StateDescription - { - Label = "Add pin", - IconPath = "ic_home_menu_addpin_138.png", - Action = addPinCommandAction, - } - }, - { - "focused", - new StateDescription - { - Label = "Add pin", - IconPath = "ic_home_menu_addpin_182.png", - Action = addPinCommandAction, - } - }, - } - }; - - addPinShortcutInfo.UpdateState(); - returnPinnedAppsInfo.Add(addPinShortcutInfo); - } - - /// - /// A method provides Pinned App Shortcut list by retrieving from the AppShortcutStorage. - /// This method provides only the Pinned App Shortcut list not including any additional Shortcuts - /// such as the All Apps, the Media Hub, and the Add Pin. - /// - /// A Pinned App Shortcut list. - private async Task> GetPinnedApps() - { - IEnumerable pinned_apps_info = await AppShortcutStorage.Read(); - - List returnPinnedAppsInfo = new List(); - - int numberOfPinnedApp = 0; - foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info) - { - if (numberOfPinnedApp >= 10) - { - break; - } - - if (appShortcutInfo.AppID == null || - appShortcutInfo.AppID.Length < 1) - { - continue; - } - - if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID)) - { - continue; - } - - InstalledApp appInfo = ApplicationManagerUtils.Instance.GetInstalledApplication(appShortcutInfo.AppID); - if (appInfo == null) - { - continue; - } - - string appLabel = appInfo.Applabel ?? "No Name"; - string appIconPath = appInfo.IconPath ?? DefaultAppIcon; - - var defaultStateDescription = new StateDescription() - { - Label = appLabel, - IconPath = appIconPath, - Action = new AppControlAction - { - AppID = appShortcutInfo.AppID, - } - }; - - appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); - appShortcutInfo.CurrentStateDescription = defaultStateDescription; - appShortcutInfo.IsPinned = true; - returnPinnedAppsInfo.Add(appShortcutInfo); - - numberOfPinnedApp += 1; - } - - return returnPinnedAppsInfo; - } - - /// - /// A method provides an App Shortcut list which contains default App Shortcuts - /// such as the All Apps, the Media Hub, and the Add Pin. - /// - /// A default App Shortcut list. - public IEnumerable GetDefaultShortcuts() - { - List returnPinnedAppsInfo = new List(); - - AddAllAppsAndMediaHubShortcut(ref returnPinnedAppsInfo); - AppendAddPinShortcut(ref returnPinnedAppsInfo); - - return returnPinnedAppsInfo; - } - - /// - /// A method provides the App Shortcut list with the default App Shortcut icons. - /// The pinned apps, the All Apps, the MediaHub, and the Add Pin are included in the return App Shortcut list. - /// - /// App Shortcut list. - public async Task> GetPinnedAppsWithDefaultShortcuts() - { - List returnPinnedAppsInfo = await GetPinnedApps(); - - AddAllAppsAndMediaHubShortcut(ref returnPinnedAppsInfo); - AppendAddPinShortcut(ref returnPinnedAppsInfo); - - return returnPinnedAppsInfo; - } - - /// - /// A method provides only pinned app's app ID as a hash table. - /// - /// A hash table includes pinned app's app ID. - public async Task> GetPinnedAppsAppIDs() - { - IEnumerable pinned_apps_info = await AppShortcutStorage.Read(); - Dictionary pinnedAppsDictionary = new Dictionary(); - - int numberOfPinnedApp = 0; - foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info) - { - if (numberOfPinnedApp >= 10) - { - break; - } - - if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID)) - { - continue; - } - - pinnedAppsDictionary.Add(appShortcutInfo.AppID, appShortcutInfo.AppID); - numberOfPinnedApp += 1; - } - - return pinnedAppsDictionary; - } - - /// - /// A method updates the pinned App list by using the AppShortcutStorage. - /// - /// A pinned app list. - public void UpdatePinnedApps(IEnumerable pinnedAppsInfo) - { - AppShortcutStorage.Write(pinnedAppsInfo); - } - - /// - /// A listener to get notification of the AppShortcutStorage. - /// - /// A Event Handler for the nonfiction of AppShortutStorage. - public void AddFileSystemChangedListener(EventHandler eventListener) - { - if (AppShortcutStorage.Instance != null) - { - AppShortcutStorage.Instance.AddStorageChangedListener(eventListener); - } - else - { - DebuggingUtils.Err("AppShortcutStorage Instance is NULL"); - } - } - } -} diff --git a/LibTVRefCommonPortable/Models/ManagedApps.cs b/LibTVRefCommonPortable/Models/ManagedApps.cs deleted file mode 100644 index b6b00b1..0000000 --- a/LibTVRefCommonPortable/Models/ManagedApps.cs +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LibTVRefCommonPortable.Models -{ - /// - /// A class has some apps have to managed in the TVHome, TVApps by platform policy reason. - /// - public class ManagedApps - { - /// - /// The app ID of TV reference home application - /// - public static string TVHomeAppID - { - get - { - return "org.tizen.xahome"; - } - } - - /// - /// The app ID of TV reference apps-tray application - /// - public static string TVAppsAppID - { - get - { - return "org.tizen.xaapps"; - } - } - - /// - /// The app ID of TV reference apps-tray application - /// - public static string MediaHubAppID - { - get - { - return "org.tizen.xamediahub"; - } - } - - /// - /// The Settings App ID - /// - public static string SettingsAppID - { - get - { - return "org.tizen.settings"; - } - } - - /// - /// Checks application isn't pinnable - /// - /// Application id for checking - /// If the application isn't pinnable return 'true' - public static bool IsNonPinnableApps(string appID) - { - if (appID == null) - { - return true; - } - - if (appID.CompareTo(TVHomeAppID) == 0 || - appID.CompareTo(TVAppsAppID) == 0 || - appID.CompareTo(MediaHubAppID) == 0 || - appID.CompareTo(SettingsAppID) == 0) - { - return true; - } - - return false; - } - - /// - /// Checks application have to be hidden at recently used application - /// - /// Application id for checking - /// If the application have to be hidden, return 'true' - public static bool IsHiddenRecentApp(string appID) - { - if (appID == null) - { - return true; - } - - if (appID.CompareTo(TVHomeAppID) == 0 || - appID.CompareTo(TVAppsAppID) == 0 || - appID.CompareTo(MediaHubAppID) == 0 || - appID.CompareTo(SettingsAppID) == 0) - { - return true; - } - - return false; - } - } -} diff --git a/LibTVRefCommonPortable/Models/RecentShortcutController.cs b/LibTVRefCommonPortable/Models/RecentShortcutController.cs deleted file mode 100755 index 4fa5a06..0000000 --- a/LibTVRefCommonPortable/Models/RecentShortcutController.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.Collections.Generic; -using LibTVRefCommonPortable.DataModels; -using LibTVRefCommonPortable.Utils; - - -namespace LibTVRefCommonPortable.Models -{ - /// - /// A class provides Recent Shortcut information to the ViewModel - /// The Recent Shortcut can be an app which is recently used and - /// a content which is recently consumed in the TV. - /// - public class RecentShortcutController - { - /// - /// A method removes a Recent Shortcut. - /// - /// a Recent Shortcut's appId to be removed. - public void Remove(string appId) - { - RecentShortcutStorage.Delete(appId); - } - - /// - /// A method removes all Recent Shortcuts. - /// - public void RemoveAll() - { - RecentShortcutStorage.DeleteAll(); - } - - /// - /// A method provides a Recent Shortcut list. - /// - /// A Recent Shortcut list. - public IEnumerable GetList() - { - return RecentShortcutStorage.Read(); - } - } -} diff --git a/LibTVRefCommonPortable/Properties/AssemblyInfo.cs b/LibTVRefCommonPortable/Properties/AssemblyInfo.cs deleted file mode 100644 index b75f38f..0000000 --- a/LibTVRefCommonPortable/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Resources; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LibTVRefCommonPortable")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LibTVRefCommonPortable")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LibTVRefCommonPortable/Settings.StyleCop b/LibTVRefCommonPortable/Settings.StyleCop deleted file mode 100644 index 837530c..0000000 --- a/LibTVRefCommonPortable/Settings.StyleCop +++ /dev/null @@ -1,722 +0,0 @@ - - - NoMerge - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - \ No newline at end of file diff --git a/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs b/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs deleted file mode 100644 index 082dc66..0000000 --- a/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace LibTVRefCommonPortable.Stubs -{ - /// - /// A unit testing stub of IApplicationManagerAPIs. - /// - public class ApplicationManagerAPITestStub : IApplicationManagerAPIs - { - /// - /// A method for removing all recent applications - /// - public void DeleteAllRecentApplication() - { - throw new NotImplementedException(); - } - - /// - /// A method for removing the specified recent application - /// - /// An application ID - public void DeleteRecentApplication(string appId) - { - throw new NotImplementedException(); - } - - /// - /// A method provides installed application list. - /// - /// An installed application list - public Task> GetAllInstalledApplication() - { - return Task.Run(() => - { - List installedApps = new List(); - - installedApps.Add(new InstalledApp - { - Applabel = "app1", - AppID = "app1", - IconPath = "path/app1", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "app2.removable", - AppID = "app2.removable", - IconPath = "path/app2", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "invalid.app3.noid", - IconPath = "path/app3", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "app4.noicon", - AppID = "app4.noicon", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "app5.nolabel", - AppID = "app5.nolabel", - IconPath = "path/app5", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "invalid.org.tizen.xahome", - AppID = "org.tizen.xahome", - IconPath = "path/app3", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "invalid.org.tizen.xaapps", - AppID = "org.tizen.xaapps", - IconPath = "path/app4", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "invalid.org.tizen.xamediahub", - AppID = "org.tizen.xamediahub", - IconPath = "path/app5", - InstalledTime = new DateTime(2017, 05, 02), - }); - - installedApps.Add(new InstalledApp - { - Applabel = "invalid.org.tizen.settings", - AppID = "org.tizen.settings", - IconPath = "path/app6", - InstalledTime = new DateTime(2017, 05, 02), - }); - - return (IEnumerable)installedApps; - }); - } - - /// - /// Gets the app ID by the app label - /// - /// the app label to get - /// the app ID of the app label - public Task GetAppIDbyAppLabel(string appLabel) - { - throw new NotImplementedException(); - } - - /// - /// Checks whether application is removable - /// - /// The app ID to get - /// If the application is removable, true; otherwise, false - public bool GetAppInfoRemovable(string appID) - { - return appID.Contains("removable"); - } - - /// - /// A method provides application information which is matched with the given app ID. - /// - /// An application ID - /// An installed application information - public InstalledApp GetInstalledApplication(string applicationId) - { - return new InstalledApp - { - AppID = applicationId, - Applabel = applicationId, - IconPath = "path/" + applicationId, - InstalledTime = DateUtils.GetRandomDate(), - }; - } - - /// - /// A method provides a recent application list. - /// - /// A Recent application list. - public IEnumerable GetRecentApplications() - { - IList testData = new List(); - - testData.Add(new RecentApp - { - InstanceID = "recentapp1", - InstanceLabel = "recentapp1", - AppID = "org.tizen.recentapp1", - Applabel = "recentapp1", - IconPath = "/test/recentapp1", - LaunchedTime = new DateTime(2014, 11, 12), - Uri = "uri/recentapp1", - ScreenShot = "screenshot/recentapp1", - }); - testData.Add(new RecentApp - { - InstanceID = "recentapp2.noscreenshot", - InstanceLabel = "recentapp2.noscreenshot", - AppID = "org.tizen.recentapp2.noscreenshot", - Applabel = "recentapp2.noscreenshot", - IconPath = "/test/recentapp2", - LaunchedTime = new DateTime(2014, 11, 12), - Uri = "uri/recentapp2", - }); - testData.Add(new RecentApp - { - InstanceID = "invalid.recentapp3.nolabel", - AppID = "invalid.org.tizen.recentapp3.nolabel", - IconPath = "/test/recentapp3", - LaunchedTime = new DateTime(2014, 11, 12), - Uri = "uri/recentapp3", - ScreenShot = "screenshot/recentapp3", - }); - testData.Add(new RecentApp - { - InstanceID = "invalid.recentapp4.notime", - AppID = "invalid.org.tizen.recentapp4.notime", - Applabel = "recentapp4.notime", - IconPath = "/test/recentapp4", - Uri = "uri/recentapp4", - ScreenShot = "screenshot/recentapp4", - }); - testData.Add(new RecentApp - { - InstanceID = "recentapp5", - InstanceLabel = "recentapp5", - AppID = "org.tizen.recentapp5", - Applabel = "recentapp5", - IconPath = "/test/recentapp5", - LaunchedTime = new DateTime(2017, 05, 02), - Uri = "uri/recentapp5", - ScreenShot = "screenshot/recentapp5", - }); - testData.Add(new RecentApp - { - InstanceID = "recentapp6", - InstanceLabel = "recentapp6", - AppID = "org.tizen.recentapp6", - Applabel = "recentapp6", - IconPath = "/test/recentapp6", - LaunchedTime = new DateTime(2017, 02, 26), - Uri = "uri/recentapp6", - ScreenShot = "screenshot/recentapp6", - }); - testData.Add(new RecentApp - { - InstanceID = "recentapp7", - InstanceLabel = "recentapp7", - AppID = "org.tizen.recentapp7", - Applabel = "recentapp7", - IconPath = "/test/recentapp7", - LaunchedTime = new DateTime(2016, 04, 25), - Uri = "uri/recentapp7", - ScreenShot = "screenshot/recentapp7", - }); - - return testData; - } - } -} diff --git a/LibTVRefCommonPortable/Stubs/FileSystemAPITestStub.cs b/LibTVRefCommonPortable/Stubs/FileSystemAPITestStub.cs deleted file mode 100644 index bc3955e..0000000 --- a/LibTVRefCommonPortable/Stubs/FileSystemAPITestStub.cs +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using System; -using System.IO; -using System.Text; - -namespace LibTVRefCommonPortable.Stubs -{ - /// - /// A unit test stub for FileSystemUtils - /// - public class FileSystemAPITestStub : IFileSystemAPIs - { - /// - /// A directory path which should be used for app data storing. - /// - public string AppDataStorage - { - get - { - return "test_app_data_path/"; - } - } - - /// - /// A directory path which should be used for app resource storing. - /// - public string AppResourceStorage - { - get - { - return "test_app_resource_path/"; - } - } - - /// - /// A directory path which should be used for sharing between apps. - /// - public string PlatformShareStorage - { - get - { - return "test_platform_share_path/"; - } - } - - /// - /// A method closes the file. - /// - /// A file descriptor - public void CloseFile(Stream stream) - { - } - - /// - /// A method flushing the stream to write remains. - /// - /// A file descriptor - public void Flush(Stream stream) - { - } - - /// - /// A method checks if a file existence in the file system. - /// - /// A file path - /// An existence of the file - public bool IsFileExist(string filePath) - { - return true; - } - - /// - /// A method checks if file is read to use. - /// - /// A file path - /// A status of ready - public bool IsFileReady(string filePath) - { - return true; - } - - /// - /// A method opens a file on the given mode. - /// - /// A file path - /// An opening mode - /// A file descriptor - public Stream OpenFile(string filePath, UtilFileMode mode) - { - if (mode != UtilFileMode.Open) - { - throw new NotImplementedException(); - } - - if (filePath.Contains("pinned_apps_info")) - { - StringBuilder pinnedApps = new StringBuilder(); - - pinnedApps.Append(""); - pinnedApps.Append(""); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.xahome"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.xaapps"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.xamediahub"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.settings"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.TocToc.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.YouTube.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Toda.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly4.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly5.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly6.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly7.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly8.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly9.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly10.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" org.tizen.example.Butterfly11.Tizen"); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(" "); - pinnedApps.Append(""); - - MemoryStream stream = new MemoryStream(); - StreamWriter writer = new StreamWriter(stream); - writer.Write(pinnedApps.ToString()); - writer.Flush(); - stream.Position = 0; - return stream; - } - - throw new NotImplementedException(); - } - } -} diff --git a/LibTVRefCommonPortable/Stubs/FileWatcherAPITestStub.cs b/LibTVRefCommonPortable/Stubs/FileWatcherAPITestStub.cs deleted file mode 100644 index 24709b5..0000000 --- a/LibTVRefCommonPortable/Stubs/FileWatcherAPITestStub.cs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using System; - -namespace LibTVRefCommonPortable.Stubs -{ - /// - /// A unit test stub for FileSystemUtils - /// - public class FileWatcherAPITestStub : IFileSystemWatcherAPIs - { - /// - /// A EventHandler for the file system watcher. - /// - public event EventHandler CustomChanged; - - /// - /// A method starts the file system watcher. - /// - /// Target file path - /// Target file name - public void Run(String path, String fileName) - { - CustomChanged?.Invoke(this, EventArgs.Empty); - - } - } -} diff --git a/LibTVRefCommonPortable/Stubs/MediaContentAPITestStub.cs b/LibTVRefCommonPortable/Stubs/MediaContentAPITestStub.cs deleted file mode 100644 index 2eeefb9..0000000 --- a/LibTVRefCommonPortable/Stubs/MediaContentAPITestStub.cs +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using System; -using System.Collections.Generic; - -namespace LibTVRefCommonPortable.Stubs -{ - /// - /// A unit testing stub for MediaContentUtils - /// - public class MediaContentAPITestStub : IMediaContentAPIs - { - /// - /// A method for getting recently played media content list - /// - /// Maximum count of list - /// The recently played media content list - public IEnumerable GetRecentlyPlayedMedia(int limitation) - { - IList recentlyPlayed = new List(); - - recentlyPlayed.Add(new RecentlyPlayedMedia - { - MediaId = "id/recent_media1", - ThumbnailPath = "thumbnail/recent_media1", - FilePath = "filepath/recent_media1", - DisplayName = "recent_media1", - PlayedAt = new DateTime(2017, 05, 22), - }); - - recentlyPlayed.Add(new RecentlyPlayedMedia - { - MediaId = "invalid.recent_media2.nofilepath", - ThumbnailPath = "invalid.recent_media2.nofilepath", - DisplayName = "invalid.recent_media2.nofilepath", - PlayedAt = new DateTime(2017, 2, 26), - }); - - recentlyPlayed.Add(new RecentlyPlayedMedia - { - MediaId = "id/recent_media3.nothumbnail", - FilePath = "filepath/recent_media3.nothumbnail", - DisplayName = "recent_media3.nothumbnail", - PlayedAt = new DateTime(2016, 4, 25), - }); - - recentlyPlayed.Add(new RecentlyPlayedMedia - { - MediaId = "id/recent_media4", - ThumbnailPath = "thumbnail/recent_media4", - FilePath = "filepath/recent_media4", - DisplayName = "recent_media4", - PlayedAt = new DateTime(2015, 12, 7), - }); - - recentlyPlayed.Add(new RecentlyPlayedMedia - { - MediaId = "id/recent_media5", - ThumbnailPath = "thumbnail/recent_media5", - FilePath = "filepath/recent_media5", - DisplayName = "recent_media5", - PlayedAt = new DateTime(2015, 10, 1), - }); - - recentlyPlayed.Add(new RecentlyPlayedMedia - { - MediaId = "id/recent_media6", - ThumbnailPath = "thumbnail/recent_media6", - FilePath = "filepath/recent_media6", - DisplayName = "recent_media6", - PlayedAt = new DateTime(2015, 3, 3), - }); - - recentlyPlayed.Add(new RecentlyPlayedMedia - { - MediaId = "id/recent_media7", - ThumbnailPath = "thumbnail/recent_media7", - FilePath = "filepath/recent_media7", - DisplayName = "recent_media8", - PlayedAt = new DateTime(2014, 11, 17), - }); - - return recentlyPlayed; - } - } -} diff --git a/LibTVRefCommonPortable/Utils/AppControlUtils.cs b/LibTVRefCommonPortable/Utils/AppControlUtils.cs deleted file mode 100644 index 64a8832..0000000 --- a/LibTVRefCommonPortable/Utils/AppControlUtils.cs +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.Collections.Generic; -using Xamarin.Forms; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class provides App Control utility APIs. - /// - public sealed class AppControlUtils - { - /// - /// A method makes the app to be launched. - /// - /// An application ID of the targeted application. - /// An extra data for App Control invoking. - /// A file Uri to be opened. - public static void SendLaunchRequest(string appID, IDictionary extraData = null, string fileUri = null) - { - if (DependencyService.Get() == null) - { - return; - } - - DependencyService.Get().SendLaunchRequest(appID, extraData, fileUri); - } - - /// - /// A method sends a add pin request App Control to TVApps app. - /// - public static void SendAddAppRequestToApps() - { - if (DependencyService.Get() == null) - { - return; - } - - DependencyService.Get().SendAddAppRequestToApps(); - } - - /// - /// A method sends a pin added notification App control to TVHome app. - /// - /// An app ID of newly added. - public static void SendAppAddedNotificationToHome(string addedAddID) - { - if (DependencyService.Get() == null) - { - return; - } - - DependencyService.Get().SendAppAddedNotificationToHome(addedAddID); - } - - /// - /// A method terminates caller application. - /// - public static void SelfTerminate() - { - if (DependencyService.Get() == null) - { - return; - } - - DependencyService.Get().SelfTerminate(); - } - } -} diff --git a/LibTVRefCommonPortable/Utils/AppShortcutStorage.cs b/LibTVRefCommonPortable/Utils/AppShortcutStorage.cs deleted file mode 100644 index 67b5ae1..0000000 --- a/LibTVRefCommonPortable/Utils/AppShortcutStorage.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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.Collections.Generic; -using System.Xml.Serialization; -using System.IO; -using LibTVRefCommonPortable.DataModels; -using System.Threading.Tasks; -using System.Diagnostics; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class manages App Shortcuts by using subsystem. - /// - public class AppShortcutStorage - { - /// - /// A storage path. - /// - private static String StoragePath; - - /// - /// A file system watcher which checks if the targeted storage is changed. - /// - private static IFileSystemWatcherAPIs fileSystemWatcher = FileSystemUtils.Instance.FileSysteamWatcherInstance; - - /// - /// An instance of AppShortcutStorage. - /// - private static AppShortcutStorage instance = new AppShortcutStorage(); - - /// - /// An instance of AppShortcutStorage. - /// - public static AppShortcutStorage Instance - { - get { return instance; } - } - - /// - /// A constructor of AppShortcutStorage. - /// - private AppShortcutStorage() - { - StoragePath = FileSystemUtils.Instance.PlatformShareStorage + "pinned_apps_info.xml"; - - CheckStorage(); - - fileSystemWatcher.Run(FileSystemUtils.Instance.PlatformShareStorage, "pinned_apps_info.xml"); - } - - /// - /// Check if the storage is exist - /// - private static void CheckStorage() - { - if (FileSystemUtils.Instance.IsFileExist(StoragePath) == false) - { - DebuggingUtils.Err("Set Default Pinned Apps" + StoragePath); - List result = new List(); - Write(result); - } - } - - /// - /// A method provides an app Shortcut list. - /// - /// An app Shortcut list. - public static async Task> Read() - { - CheckStorage(); - - for (int i = 0; i <= 6; i++) - { - if (FileSystemUtils.Instance.IsFileReady(StoragePath)) - { - break; - } - else if (i == 6) - { - DebuggingUtils.Err("Can't open storage" + StoragePath); - return new List(); - } - - await Task.Delay(100); - DebuggingUtils.Dbg("[" + i + "] Waiting for Writing" + StoragePath); - } - - using (Stream fileStream = FileSystemUtils.Instance.OpenFile(StoragePath, UtilFileMode.Open)) - { - Debug.Assert(fileStream != null); - - XmlSerializer serializer = new XmlSerializer(typeof(List)); - StreamReader streamReader = new StreamReader(fileStream); - List list = (List)serializer.Deserialize(streamReader); - - return list; - } - } - - /// - /// A method updates App Shortcuts of the storage - /// - /// An app Shortcuts that pinned by a user. - /// A status of storage update. - public static bool Write(IEnumerable pinnedAppInfo) - { - using (Stream fileStream = FileSystemUtils.Instance.OpenFile(StoragePath, UtilFileMode.Create)) - { - Debug.Assert(fileStream != null); - - XmlSerializer serializer = new XmlSerializer(typeof(List)); - StreamWriter streamWriter = new StreamWriter(fileStream); - serializer.Serialize(streamWriter, pinnedAppInfo); - streamWriter.Flush(); - } - - return true; - } - - /// - /// A method sets an event listener for the storage watcher - /// - /// An event handler for the storage event - public void AddStorageChangedListener(EventHandler eventListener) - { - fileSystemWatcher.CustomChanged += eventListener; - } - } -} diff --git a/LibTVRefCommonPortable/Utils/ApplicationManagerUtils.cs b/LibTVRefCommonPortable/Utils/ApplicationManagerUtils.cs deleted file mode 100644 index 138d211..0000000 --- a/LibTVRefCommonPortable/Utils/ApplicationManagerUtils.cs +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Stubs; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Xamarin.Forms; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class provides application controlling functions - /// - public sealed class ApplicationManagerUtils - { - /// - /// A instance of platform specific application manager port. - /// - private static IApplicationManagerAPIs applicationManagerAPIs; - - /// - /// A instance of ApplicationManagerUtils - /// - private static readonly ApplicationManagerUtils instance = new ApplicationManagerUtils(); - - /// - /// A getter of ApplicationManagerUtils instance - /// - public static ApplicationManagerUtils Instance - { - get - { - return instance; - } - } - - /// - /// A constructor - /// - private ApplicationManagerUtils() - { - applicationManagerAPIs = new ApplicationManagerAPITestStub(); - - try - { - if (DependencyService.Get() != null) - { - applicationManagerAPIs = DependencyService.Get(); - } - } - catch (InvalidOperationException e) - { - DebuggingUtils.Err(e.Message); - } - } - - /// - /// A method for removing all recent applications - /// - public void DeleteAllRecentApplication() - { - applicationManagerAPIs.DeleteAllRecentApplication(); - } - - /// - /// A method for removing the specified recent application - /// - /// An application ID - public void DeleteRecentApplication(string appId) - { - applicationManagerAPIs.DeleteRecentApplication(appId); - } - - - /// - /// Gets the information of the recent applications - /// - /// The list of the recent applications - public IEnumerable GetRecentApplications() - { - return applicationManagerAPIs.GetRecentApplications(); - } - - /// - /// Gets the information of the specified application with the app ID - /// - /// The app Id to get - /// The information of the installed application - public InstalledApp GetInstalledApplication(string appID) - { - return applicationManagerAPIs.GetInstalledApplication(appID); - } - - /// - /// Gets the information of the installed applications asynchronously - /// - /// The list of the installed applications - public Task> GetAllInstalledApplication() - { - return applicationManagerAPIs.GetAllInstalledApplication(); - } - - /// - /// Checks whether application is removable - /// - /// The app ID to get - /// If the application is removable, true; otherwise, false - public bool GetAppInfoRemovable(string appID) - { - return applicationManagerAPIs.GetAppInfoRemovable(appID); - } - - /// - /// Gets the app ID by the app label - /// - /// the app label to get - /// the app ID of the app label - public Task GetAppIDbyAppLabel(string appLabel) - { - return applicationManagerAPIs.GetAppIDbyAppLabel(appLabel); - } - } -} diff --git a/LibTVRefCommonPortable/Utils/DateUtils.cs b/LibTVRefCommonPortable/Utils/DateUtils.cs deleted file mode 100644 index f2e6e14..0000000 --- a/LibTVRefCommonPortable/Utils/DateUtils.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class provides Date, Time related functions - /// - public class DateUtils - { - /// - /// A random seed - /// - private static Random seed = new Random(); - - /// - /// A method provides a random date. - /// - /// A date - public static DateTime GetRandomDate() - { - DateTime baseDate = DateTime.Now.AddYears(-10); - return baseDate.AddDays(seed.Next((DateTime.Now - baseDate).Days)); - } - } -} diff --git a/LibTVRefCommonPortable/Utils/DebuggingUtils.cs b/LibTVRefCommonPortable/Utils/DebuggingUtils.cs deleted file mode 100644 index 61418c6..0000000 --- a/LibTVRefCommonPortable/Utils/DebuggingUtils.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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.CompilerServices; -using Xamarin.Forms; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A debugging utility class. - /// - public sealed class DebuggingUtils - { - /// - /// A debugging API interface - /// - private static IDebuggingAPIs ism; - - /// - /// An instance of DebuggingUtils - /// - private static readonly DebuggingUtils instance = new DebuggingUtils(); - - /// - /// A method provides instance of DebuggingUtils. - public static DebuggingUtils Instance - { - get { return instance; } - } - - /// - /// Default implementation of IDebuggingAPIs interface . - /// This is required for the unit testing of the Calculator application. - /// - private class DefaultSM : IDebuggingAPIs - { - /// - /// A method displays an error log. - /// - /// An error message. - /// A file name. - /// A function name. - /// A line number. - public void Dbg(string message, String file, String func, Int32 line) - { - } - - /// - /// A method displays a dialog with a given message. - /// - /// A debugging message. - /// A file name. - /// A function name. - /// A line number. - public void Err(string message, String file, String func, Int32 line) - { - } - - /// - /// A method displays a debugging log. - /// - /// A debugging message. - public void Popup(string message) - { - } - } - - /// - /// DebuggingUtils constructor which set interface instance. - /// - private DebuggingUtils() - { - ism = new DefaultSM(); - - try - { - if (DependencyService.Get() != null) - { - ism = DependencyService.Get(); - } - } - catch (InvalidOperationException e) - { - Err(e.Message); - } - } - - /// - /// A method displays a debugging message - /// - /// A list of command line arguments. - /// A file name. - /// A function name. - /// A line number. - public static void Dbg(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) - { - ism.Dbg(message, file, func, line); - } - - /// - /// A method displays an error message - /// - /// A list of command line arguments. - /// A file name. - /// A function name. - /// A line number. - public static void Err(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) - { - ism.Err(message, file, func, line); - } - - /// - /// A method displays a pop up message - /// - /// A list of command line arguments. - public static void Popup(string message) - { - ism.Popup(message); - } - } -} diff --git a/LibTVRefCommonPortable/Utils/FileSystemUtils.cs b/LibTVRefCommonPortable/Utils/FileSystemUtils.cs deleted file mode 100644 index 4ed3434..0000000 --- a/LibTVRefCommonPortable/Utils/FileSystemUtils.cs +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Stubs; -using System; -using System.IO; -using Xamarin.Forms; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class for file system control function. - /// - class FileSystemUtils - { - /// - /// A instance of file system port layer - /// - private static IFileSystemAPIs fileSystemAPIs; - - /// - /// A instance of file system watcher port layer - /// - private static IFileSystemWatcherAPIs fileSystemWatcherAPIs; - - /// - /// A instance of FileSystemUtils - /// - private static readonly FileSystemUtils instance = new FileSystemUtils(); - - /// - /// A property of FileSystemUtils instance - /// - public static FileSystemUtils Instance - { - get - { - return instance; - } - } - - /// - /// A property of file system watcher instance - /// - public IFileSystemWatcherAPIs FileSysteamWatcherInstance - { - get - { - return fileSystemWatcherAPIs; - } - } - - /// - /// A constructor - /// - private FileSystemUtils() - { - fileSystemAPIs = new FileSystemAPITestStub(); - fileSystemWatcherAPIs = new FileWatcherAPITestStub(); - - try - { - if (DependencyService.Get() != null) - { - fileSystemAPIs = DependencyService.Get(); - } - - if (DependencyService.Get() != null) - { - fileSystemWatcherAPIs = DependencyService.Get(); - } - } - catch (InvalidOperationException e) - { - DebuggingUtils.Err(e.Message); - } - } - - /// - /// A directory path which should be used for app data storing. - /// - public string AppDataStorage - { - get - { - return fileSystemAPIs.AppDataStorage; - } - } - - /// - /// A directory path which should be used for app resource storing. - /// - public string AppResourceStorage - { - get - { - return fileSystemAPIs.AppResourceStorage; - } - } - - /// - /// A directory path which should be used for sharing between apps. - /// - public string PlatformShareStorage - { - get - { - return fileSystemAPIs.PlatformShareStorage; - } - } - - /// - /// A method opens a file on the given mode. - /// - /// A file path - /// An opening mode - /// A file descriptor - public Stream OpenFile(string filePath, UtilFileMode mode) - { - return fileSystemAPIs.OpenFile(filePath, mode); - } - - /// - /// A method flushing the stream to write remains. - /// - /// A file descriptor - public void Flush(Stream stream) - { - fileSystemAPIs.Flush(stream); - } - - /// - /// A method closes the file. - /// - /// A file descriptor - public void CloseFile(Stream stream) - { - fileSystemAPIs.CloseFile(stream); - } - - /// - /// A method checks if a file existence in the file system. - /// - /// A file path - /// An existence of the file - public bool IsFileExist(String filePath) - { - return fileSystemAPIs.IsFileExist(filePath); - } - - /// - /// A method checks if file is read to use. - /// - /// A file path - /// A status of ready - public bool IsFileReady(String filePath) - { - return fileSystemAPIs.IsFileReady(filePath); - } - - - } -} diff --git a/LibTVRefCommonPortable/Utils/IAppControl.cs b/LibTVRefCommonPortable/Utils/IAppControl.cs deleted file mode 100644 index 9aa4c3f..0000000 --- a/LibTVRefCommonPortable/Utils/IAppControl.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.Collections.Generic; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// An interface for App Control feature - /// - public interface IAppControl - { - /// - /// Sends the launch request - /// - /// The app ID to explicitly launch - /// The extra data for the app control - /// The file uri to be opened - void SendLaunchRequest(string appId, IDictionary extraData, string fileUri); - - /// - /// A method sends add pin request App Control to TVApps app. - /// - void SendAddAppRequestToApps(); - - /// - /// A method sends a pin added notification App control to TVHome app. - /// - /// An app ID of newly added. - void SendAppAddedNotificationToHome(string addedAddID); - } -} diff --git a/LibTVRefCommonPortable/Utils/IAppLifeControl.cs b/LibTVRefCommonPortable/Utils/IAppLifeControl.cs deleted file mode 100644 index ab6e2e7..0000000 --- a/LibTVRefCommonPortable/Utils/IAppLifeControl.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 -{ - /// - /// An interface for app life management. - /// - public interface IAppLifeControl - { - /// - /// A method terminates the caller app. - /// - void SelfTerminate(); - } -} diff --git a/LibTVRefCommonPortable/Utils/IApplicationManagerAPIs.cs b/LibTVRefCommonPortable/Utils/IApplicationManagerAPIs.cs deleted file mode 100755 index c8521b9..0000000 --- a/LibTVRefCommonPortable/Utils/IApplicationManagerAPIs.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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.Collections.Generic; -using System.Threading.Tasks; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class to store RecentApp information. - /// - public class RecentApp - { - /// - /// A Recent instance ID - /// - public String InstanceID; - - /// - /// A Recent instance label - /// - public String InstanceLabel; - - /// - /// An app ID - /// - public String AppID; - - /// - /// An app label - /// - public String Applabel; - - /// - /// An app icon path - /// - public String IconPath; - - /// - /// A last launched date - /// - public DateTime LaunchedTime; - - /// - /// A URI of accessible content if the Recent is a content. - /// - public String Uri; - - /// - /// A File Path of screenshot of the recent app or recent content. - /// - public String ScreenShot; - } - - /// - /// A class to store installed app information. - /// - public class InstalledApp - { - /// - /// An app ID - /// - public String AppID; - - /// - /// An app label - /// - public String Applabel; - - /// - /// An app icon path - /// - public String IconPath; - - /// - /// A installed date - /// - public DateTime InstalledTime; - } - - /// - /// An interface for Application Manager feature - /// - public interface IApplicationManagerAPIs - { - /// - /// A method provides installed application list. - /// - /// An installed application list - Task> GetAllInstalledApplication(); - - /// - /// A method provides a recent application list. - /// - /// A Recent application list. - IEnumerable GetRecentApplications(); - - /// - /// A method provides application information which is matched with the given app ID. - /// - /// An application ID - /// An installed application information - InstalledApp GetInstalledApplication(string applicationId); - - /// - /// A method for removing all recent applications - /// - void DeleteAllRecentApplication(); - - /// - /// A method for removing the specified recent application - /// - /// An application ID - void DeleteRecentApplication(string appId); - - /// - /// Checks whether application is removable - /// - /// The app ID to get - /// If the application is removable, true; otherwise, false - bool GetAppInfoRemovable(string appID); - - /// - /// Gets the app ID by the app label - /// - /// the app label to get - /// the app ID of the app label - Task GetAppIDbyAppLabel(string appLabel); - } -} diff --git a/LibTVRefCommonPortable/Utils/IDebuggingAPIs.cs b/LibTVRefCommonPortable/Utils/IDebuggingAPIs.cs deleted file mode 100644 index eb46618..0000000 --- a/LibTVRefCommonPortable/Utils/IDebuggingAPIs.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// An interface contains debugging methods which are using platform subsystems. - /// - /// - /// Implementing this class should be occurred in platform project. - /// Also the implementation should be registered to the DependencyService in an app initialization. - /// Please refer to Xamarin Dependency Service - /// https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/ - /// - public interface IDebuggingAPIs - { - /// - /// A method displays a debugging log. - /// A debugging message. - void Popup(string message); - - /// - /// A method displays an error log. - /// An error message. - /// A file name. - /// A function name. - /// A line number. - void Dbg(string message, String file, String func, Int32 line); - - /// - /// A method displays a dialog with a given message. - /// A debugging message. - /// A file name. - /// A function name. - /// A line number. - void Err(string message, String file, String func, Int32 line); - } -} diff --git a/LibTVRefCommonPortable/Utils/IFileSystemAPIs.cs b/LibTVRefCommonPortable/Utils/IFileSystemAPIs.cs deleted file mode 100644 index 2f29351..0000000 --- a/LibTVRefCommonPortable/Utils/IFileSystemAPIs.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.IO; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// An enumeration for the file open mode. - /// - public enum UtilFileMode - { - CreateNew = 1, - Create = 2, - Open = 3, - OpenOrCreate = 4, - Truncate = 5, - Append = 6 - } - - /// - /// An interface for the file operations - /// - public interface IFileSystemAPIs - { - /// - /// A directory path which should be used for app data storing. - /// - string AppDataStorage - { - get; - } - - /// - /// A directory path which should be used for app resource storing. - /// - string AppResourceStorage - { - get; - } - - /// - /// A directory path which should be used for sharing between apps. - /// - string PlatformShareStorage - { - get; - } - - /// - /// A method opens a file on the given mode. - /// - /// A file path - /// An opening mode - /// A file descriptor - Stream OpenFile(string filePath, UtilFileMode mode); - - /// - /// A method flushing the stream to write remains. - /// - /// A file descriptor - void Flush(Stream stream); - - /// - /// A method closes the file. - /// - /// A file descriptor - void CloseFile(Stream stream); - - /// - /// A method checks if a file existence in the file system. - /// - /// A file path - /// An existence of the file - bool IsFileExist(String filePath); - - /// - /// A method checks if file is read to use. - /// - /// A file path - /// A status of ready - bool IsFileReady(String filePath); - } -} diff --git a/LibTVRefCommonPortable/Utils/IFileSystemWatcherAPIs.cs b/LibTVRefCommonPortable/Utils/IFileSystemWatcherAPIs.cs deleted file mode 100644 index 43ecb20..0000000 --- a/LibTVRefCommonPortable/Utils/IFileSystemWatcherAPIs.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// An interface for the file system watcher. - /// - public interface IFileSystemWatcherAPIs - { - /// - /// A EventHandler for the file system watcher. - /// - event EventHandler CustomChanged; - - /// - /// A method starts the file system watcher. - /// - /// Target file path - /// Target file name - void Run(String path, String fileName); - } -} diff --git a/LibTVRefCommonPortable/Utils/IMediaContentAPIs.cs b/LibTVRefCommonPortable/Utils/IMediaContentAPIs.cs deleted file mode 100644 index a0b26a9..0000000 --- a/LibTVRefCommonPortable/Utils/IMediaContentAPIs.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.Collections.Generic; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// An information of recently played media content - /// - public struct RecentlyPlayedMedia - { - /// - /// An ID of media content - /// - public string MediaId; - - /// - /// A path of media content thumbnail - /// - public string ThumbnailPath; - - /// - /// A path of media content - /// - public string FilePath; - - /// - /// A title of media content - /// - public string DisplayName; - - /// - /// Last played time of media content - /// - public DateTime PlayedAt; - } - - /// - /// An interface for getting recently played media contents. - /// - public interface IMediaContentAPIs - { - /// - /// A method for getting recently played media content list - /// - /// Maximum count of list - /// The recently played media content list - IEnumerable GetRecentlyPlayedMedia(int limitation); - } -} diff --git a/LibTVRefCommonPortable/Utils/IPackageManager.cs b/LibTVRefCommonPortable/Utils/IPackageManager.cs deleted file mode 100644 index a449672..0000000 --- a/LibTVRefCommonPortable/Utils/IPackageManager.cs +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.Collections.Generic; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// An interface for package manager subsystem. - /// - public interface IPackageManager - { - /// - /// A method provides installed package list. - /// - /// A package list - Dictionary GetPackageList(); - - /// - /// A method provides a detail information (TBD) - /// - /// A package ID - /// A package label - string GetPackageLabel(string pkgID); - - /// - /// Gets the package ID by the app ID - /// - /// The app ID to get - /// The package ID that contains given app ID - string GetPackageIDByAppID(string appID); - - /// - /// A method removes the package. - /// - /// A package ID - /// A status of uninstall - bool UninstallPackage(string pkgID); - - /// - /// A method remove the package by using an app ID. - /// - /// an app ID - /// A status of uninstall - bool UninstallPackageByAppID(string appID); - - /// - /// Gets applications list by the package ID - /// - /// The package ID to get applications - /// The list of applications - List GetApplicationsByPkgID(string pkgID); - } -} diff --git a/LibTVRefCommonPortable/Utils/IPlatformNotification.cs b/LibTVRefCommonPortable/Utils/IPlatformNotification.cs deleted file mode 100755 index b5664e2..0000000 --- a/LibTVRefCommonPortable/Utils/IPlatformNotification.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 -{ - /// - /// An interface for the platform notification. - /// - public interface IPlatformNotification - { - /// - /// A method will be called when the Home remote control key is pressed. - /// - void OnHomeKeyPressed(); - - /// - /// A method will be called when the Menu remote control key is pressed. - /// - void OnMenuKeyPressed(); - - /// - /// A method will be called if an app is installed. - /// - /// A package ID of newly installed. - void OnAppInstalled(string pkgID); - - /// - /// A method will be called if an app is uninstalled. - /// - /// A package ID of uninstalled. - void OnAppUninstalled(string pkgID); - - /// - /// A method will be called if the app gets a App Control request for pinning a app. - /// - void OnPinAppRequestReceived(); - - /// - /// A method will be called if the app gets an app pinned notification App Control request. - /// - /// A pinned app ID - void OnAppPinnedNotificationReceived(string appID); - - /// - /// A method will be called when the Navigation remote control key is pressed. - /// - /// A pressed remote control key name - void OnNavigationKeyPressed(string keyName); - } -} diff --git a/LibTVRefCommonPortable/Utils/IStatePublisher.cs b/LibTVRefCommonPortable/Utils/IStatePublisher.cs deleted file mode 100644 index 0c3605d..0000000 --- a/LibTVRefCommonPortable/Utils/IStatePublisher.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LibTVRefCommonPortable.Utils -{ - public enum AppState - { - HomeMainPanelRecentFocused, - HomeMainPanelAppsFocused, - HomeMainPanelSettingsFocused, - HomeSubPanelRecentFocused, - HomeSubPanelAppsFocused, - HomeSubPanelSettingsFocused, - HomeShowOptions, - HomeMove, - HomeIconified, - } - - public interface IStatePublisher - { - AppState CurrentState - { - get; - set; - } - - } -} diff --git a/LibTVRefCommonPortable/Utils/IStateSubscriber.cs b/LibTVRefCommonPortable/Utils/IStateSubscriber.cs deleted file mode 100644 index bb59eb7..0000000 --- a/LibTVRefCommonPortable/Utils/IStateSubscriber.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LibTVRefCommonPortable.Utils -{ - public interface IStateSubscriber - { - void OnStateChanged(AppState state); - } -} diff --git a/LibTVRefCommonPortable/Utils/ISystemSettings.cs b/LibTVRefCommonPortable/Utils/ISystemSettings.cs deleted file mode 100644 index 97c369e..0000000 --- a/LibTVRefCommonPortable/Utils/ISystemSettings.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 -{ - /// - /// An interface for getting system setting informations. - /// - public interface ISystemSettings - { - /// - /// A method for getting system model name. - /// - /// The system model name - /// The result whether getting the modelName is done - bool GetSystemModelName(out string modelName); - } -} diff --git a/LibTVRefCommonPortable/Utils/ITVHome.cs b/LibTVRefCommonPortable/Utils/ITVHome.cs deleted file mode 100755 index c7c6f69..0000000 --- a/LibTVRefCommonPortable/Utils/ITVHome.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Models; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// An interface for the TVHomeImpl class - /// The Models' instances in the TVHomeImpl class, - /// so to use the Models from other files, it should access the instance of the TVHomeImpl. - /// To reduce dependency between the TVHome and any other file, - /// the instance of the TVHomeImpl will be provided as a ITVHome interface. - /// - public interface ITVHome - { - /// - /// An instance of the AppShortcutController - /// - /// - AppShortcutController AppShortcutControllerInstance - { - get; - } - - /// - /// An instance of the RecentShortcutController - /// - /// - RecentShortcutController RecentShortcutControllerInstance - { - get; - } - } -} diff --git a/LibTVRefCommonPortable/Utils/IWindowAPIs.cs b/LibTVRefCommonPortable/Utils/IWindowAPIs.cs deleted file mode 100644 index 98de5ef..0000000 --- a/LibTVRefCommonPortable/Utils/IWindowAPIs.cs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 -{ - /// - /// An interface for the Window management. - /// - public interface IWindowAPIs - { - /// - /// A method minimizes the app's window. - /// - /// A minimize status - void SetIconified(bool iconified); - - /// - /// A method provides a minimized status of the App. - /// - /// A status of minimized of app. - bool GetIconified(); - } -} diff --git a/LibTVRefCommonPortable/Utils/MediaContentUtils.cs b/LibTVRefCommonPortable/Utils/MediaContentUtils.cs deleted file mode 100644 index 9d56eb2..0000000 --- a/LibTVRefCommonPortable/Utils/MediaContentUtils.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Stubs; -using System; -using System.Collections.Generic; -using Xamarin.Forms; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class provides media contents and related functions. - /// - public class MediaContentUtils - { - /// - /// A instance of IMediaContentAPIs port. - /// - private static IMediaContentAPIs mediaContentAPIs; - - /// - /// A instance of MediaContentUtils - /// - private static readonly MediaContentUtils instance = new MediaContentUtils(); - - /// - /// A property of MediaContentUtils instance. - /// - public static MediaContentUtils Instance - { - get - { - return instance; - } - } - - /// - /// A Constructor - /// - private MediaContentUtils() - { - mediaContentAPIs = new MediaContentAPITestStub(); - - try - { - if (DependencyService.Get() != null) - { - mediaContentAPIs = DependencyService.Get(); - } - } - catch (InvalidOperationException e) - { - DebuggingUtils.Err(e.Message); - } - } - - /// - /// A method provides media playing history. - /// - /// A number of getting media playing history - /// A list of played medias. - public IEnumerable GetRecentlyPlayedMedia(int limitation) - { - return mediaContentAPIs.GetRecentlyPlayedMedia(limitation); - } - - } -} diff --git a/LibTVRefCommonPortable/Utils/PackageManagerUtils.cs b/LibTVRefCommonPortable/Utils/PackageManagerUtils.cs deleted file mode 100644 index 50cd961..0000000 --- a/LibTVRefCommonPortable/Utils/PackageManagerUtils.cs +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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.Collections.Generic; -using Xamarin.Forms; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class for package manager function. - /// - public sealed class PackageManagerUtils - { - /// - /// A method provides installed package list. - /// - /// A package list - public static Dictionary GetPackageList() - { - if (DependencyService.Get() == null) - { - return new Dictionary(); - } - - return DependencyService.Get().GetPackageList(); - } - - /// - /// A method provides a detail information (TBD) - /// - /// A package ID - /// A package label - public static string GetPackageLabel(string pkgID) - { - if (DependencyService.Get() == null) - { - return null; - } - - return DependencyService.Get().GetPackageLabel(pkgID); - } - - /// - /// Gets the pacakge ID by the app ID - /// - /// The app ID to get - /// The pacakge ID that contains given app ID - public static string GetPackageIDByAppID(string appID) - { - if (DependencyService.Get() == null) - { - return null; - } - - return DependencyService.Get().GetPackageIDByAppID(appID); - } - - /// - /// A method removes the package. - /// - /// A package ID - /// A status of uninstall - public static bool UninstallPackage(string pkgID) - { - if (DependencyService.Get() == null) - { - return false; - } - - return DependencyService.Get().UninstallPackage(pkgID); - } - - /// - /// A method remove the package by using an app ID. - /// - /// An app ID - /// A status of uninstallation - public static bool UninstallPackageByAppID(string appID) - { - if (DependencyService.Get() == null) - { - return false; - } - - return DependencyService.Get().UninstallPackageByAppID(appID); - } - - /// - /// Gets applications list by the package ID - /// - /// The package ID to get applications - /// The list of applications - public static List GetApplicationsByPkgID(string pkgID) - { - if (DependencyService.Get() == null) - { - return null; - } - - return DependencyService.Get().GetApplicationsByPkgID(pkgID); - } - } -} diff --git a/LibTVRefCommonPortable/Utils/RecentShortcutStorage.cs b/LibTVRefCommonPortable/Utils/RecentShortcutStorage.cs deleted file mode 100755 index 6d9dedd..0000000 --- a/LibTVRefCommonPortable/Utils/RecentShortcutStorage.cs +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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.Collections.Generic; -using LibTVRefCommonPortable.DataModels; -using System; -using LibTVRefCommonPortable.Models; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class to manage the Recent Shortcuts. - /// - public sealed class RecentShortcutStorage - { - /// - /// A maximum number of recent apps and contents - /// - private static readonly int MaxRecents = 10; - - /// - /// A method provides all Recent Shortcuts' information list. - /// - /// a Recent Shortcut information list. - public static IEnumerable Read() - { - List recentShortcutInfoList = new List(); - IEnumerable recentApps = null; - - try - { - recentApps = ApplicationManagerUtils.Instance.GetRecentApplications(); - } - catch (Exception e) - { - DebuggingUtils.Err("GetRecentApplications failed. " + e.Message); - } - - if (recentApps != null) - { - foreach (var item in recentApps) - { - if (ManagedApps.IsHiddenRecentApp(item.AppID)) - { - continue; - } - - if (item.Applabel == null || item.Applabel.Length == 0 || - item.LaunchedTime.CompareTo(new DateTime()) == 0) - { - continue; - } - - var defaultStateDescription = new StateDescription() - { - Label = item.Applabel, - IconPath = item.IconPath, - Action = new AppControlAction() - { - AppID = item.AppID, - } - }; - var recentShortcutInfo = new RecentShortcutInfo(); - - if (item.ScreenShot == null) - { - recentShortcutInfo.ScreenshotPath = "screenshot.png"; - - string capturedAppScreen = FileSystemUtils.Instance.PlatformShareStorage + item.AppID + ".jpg"; - if (FileSystemUtils.Instance.IsFileExist(capturedAppScreen)) - { - recentShortcutInfo.ScreenshotPath = capturedAppScreen; - } - else - { - string testScreenShot = FileSystemUtils.Instance.AppResourceStorage + item.AppID + ".png"; - if (FileSystemUtils.Instance.IsFileExist(testScreenShot)) - { - recentShortcutInfo.ScreenshotPath = testScreenShot; - } - } - } - else - { - recentShortcutInfo.ScreenshotPath = item.ScreenShot; - } - - recentShortcutInfo.Type = RecentShortcutType.Application; - recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); - recentShortcutInfo.CurrentStateDescription = defaultStateDescription; - recentShortcutInfo.Id = item.AppID; - recentShortcutInfo.Date = item.LaunchedTime; - recentShortcutInfoList.Add(recentShortcutInfo); - } - } - - IEnumerable recentMedias = MediaContentUtils.Instance.GetRecentlyPlayedMedia(MaxRecents); - foreach (var item in recentMedias) - { - if (item.FilePath == null || item.FilePath.Length == 0) - { - continue; - } - - // DebuggingUtils.Dbg("media :" + item.DisplayName + ", PlayedAt : " + item.PlayedAt.ToString()); - var defaultStateDescription = new StateDescription() - { - Label = item.DisplayName, - IconPath = "ic_launcher_mediahub_138.png", - Action = new MediaControlAction() - { - AppID = "org.tizen.xamediahub", - FileUri = "file://" + item.FilePath, - } - }; - var mediaControlAction = defaultStateDescription.Action as MediaControlAction; - - mediaControlAction?.ExtraData.Add("View By", "All"); - mediaControlAction?.ExtraData.Add("Media type", "Video"); - mediaControlAction?.ExtraData.Add("Media Id", item.MediaId); - - var recentShortcutInfo = new RecentShortcutInfo(); - - recentShortcutInfo.ScreenshotPath = item.FilePath + ".tn"; - - if (item.ThumbnailPath != null) - { - if (FileSystemUtils.Instance.IsFileExist(item.ThumbnailPath)) - { - recentShortcutInfo.ScreenshotPath = item.ThumbnailPath; - } - } - - recentShortcutInfo.Type = RecentShortcutType.Media; - recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); - recentShortcutInfo.CurrentStateDescription = defaultStateDescription; - recentShortcutInfo.Id = "org.tizen.xamediahub"; - recentShortcutInfo.Date = item.PlayedAt.ToUniversalTime(); - recentShortcutInfoList.Add(recentShortcutInfo); - } - - recentShortcutInfoList.Sort(); - if (recentShortcutInfoList.Count > MaxRecents) - { - recentShortcutInfoList.RemoveRange(MaxRecents, recentShortcutInfoList.Count - MaxRecents); - } - - return recentShortcutInfoList; - } - - /// - /// A method deletes a Recent Shortcut. - /// - /// An application ID - public static void Delete(string appId) - { - ApplicationManagerUtils.Instance.DeleteRecentApplication(appId); - } - - /// - /// A method deletes all Recent Shortcuts. - /// - public static void DeleteAll() - { - ApplicationManagerUtils.Instance.DeleteAllRecentApplication(); - } - } -} diff --git a/LibTVRefCommonPortable/Utils/SizeUtils.cs b/LibTVRefCommonPortable/Utils/SizeUtils.cs deleted file mode 100644 index 4ac601d..0000000 --- a/LibTVRefCommonPortable/Utils/SizeUtils.cs +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A class provides Size metric related functions - /// - public class SizeUtils - { - /// - /// Base Screen Height - /// - private static int baseScreenWidth = 1920; - - /// - /// Base Screen Height - /// - public static int BaseScreenWidth - { - get - { - return baseScreenWidth; - } - } - - /// - /// Base Screen Height - /// - private static int baseScreenHeight = 1080; - - /// - /// Base Screen Height - /// - public static int BaseScreenHeight - { - get - { - return baseScreenHeight; - } - } - - - /// - /// Screen Height - /// - public static int ScreenHeight { set; get; } - - /// - /// Screen Width - /// - public static int ScreenWidth { set; get; } - - /// - /// Device DPI - /// - public static double Dpi { set; get; } - - /// - /// Font Scale ratio - /// - public static double ScaleRatio { set; get; } - - /// - /// Platform Model enumerations - /// - private enum PlatformModel - { - TV, - Emulator, - Other, - } - - /// - /// Platform Model Name - /// - private static PlatformModel ModelName = PlatformModel.TV; - - /// - /// Set model name of running device. - /// - /// a model name - 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; - } - } - - /// - /// A method provides a converted height size. - /// - /// A height value in BaseScreen ratio - /// A converted height size - public static int GetHeightSize(int heightBaseSize) - { - return Convert.ToInt32((double)((double)heightBaseSize / (double)BaseScreenHeight) * (double)(ScreenHeight)); - } - - /// - /// A method provides a converted width size. - /// - /// A width value in BaseScreen ratio - /// A converted width size - public static int GetWidthSize(int widthBaseSize) - { - return Convert.ToInt32((double)((double)widthBaseSize / (double)BaseScreenWidth) * (double)(ScreenWidth)); - } - - /// - /// A method provides a converted width size by double type. - /// - /// A width value in BaseScreen ratio - /// A converted width size - public static double GetWidthSizeDouble(double widthBaseSize) - { - return (double)(widthBaseSize / (double)BaseScreenWidth) * (double)(ScreenWidth); - } - - /// - /// A method provides a converted font size. - /// - /// A base font size value in BaseScreen ratio - /// A converted font size - public static int GetFontSize(int fontBaseSize) - { - 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: - //DebuggingUtils.Dbg(String.Format("TV/Other, fontBaseSize = {0}, BaseScreenHeight = {1}, ScreenHeight = {2}, ScaleRatio = {3}", fontBaseSize, BaseScreenHeight, ScreenHeight, ScaleRatio)); - double tempAdjustmentRatio = 1D; - return Convert.ToInt32(((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio * tempAdjustmentRatio); - } - } - } -} diff --git a/LibTVRefCommonPortable/Utils/TVHomeImpl.cs b/LibTVRefCommonPortable/Utils/TVHomeImpl.cs deleted file mode 100755 index 01cd0f2..0000000 --- a/LibTVRefCommonPortable/Utils/TVHomeImpl.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Models; - -namespace LibTVRefCommonPortable.Utils -{ - /// - /// A main instance class of the TVHome, TVApps to providing the Model functions. - /// This class is a kind of the Singleton class and includes major Model classes - /// such as the AppShortcutController, the RecentShortcutController, and the SettingShortcutcontroller - /// that are providing major functions related with TVHome, TVApps using scenarios. - /// - /// - /// - /// - public class TVHomeImpl : ITVHome - { - /// - /// An instance of the TVHomeImpl - /// - private static readonly TVHomeImpl instance = new TVHomeImpl(); - - /// - /// An instance of the TVHomeImpl - /// - public static ITVHome GetInstance - { - get - { - return instance; - } - } - - /// - /// A constructor of TVHomeImpl - /// Initializes Model implementations. - /// - private TVHomeImpl() - { - - } - - /// - /// An instance of the AppShortcutController - /// - private static readonly AppShortcutController appShortcutController = new AppShortcutController(); - public AppShortcutController AppShortcutControllerInstance - { - get - { - return appShortcutController; - } - } - - /// - /// An instance of the RecentShortcutController - /// - private static readonly RecentShortcutController recentShortcutController = new RecentShortcutController(); - public RecentShortcutController RecentShortcutControllerInstance - { - get - { - return recentShortcutController; - } - } - } -} diff --git a/LibTVRefCommonPortable/packages.config b/LibTVRefCommonPortable/packages.config deleted file mode 100755 index 6356cba..0000000 --- a/LibTVRefCommonPortable/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/LibTVRefCommonTizen/LibTVRefCommonTizen.csproj b/LibTVRefCommonTizen/LibTVRefCommonTizen.csproj deleted file mode 100755 index bd6be11..0000000 --- a/LibTVRefCommonTizen/LibTVRefCommonTizen.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - 14.0 - Debug - AnyCPU - 8.0.30703 - 2.0 - {2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {C558D279-897E-45E1-A10A-DECD788770F4} - Library - Properties - LibTVRefCommonTizen - LibTVRefCommonTizen - 512 - en-US - - - DNXCore - v5.0 - false - .NETCoreApp,Version=v1.0 - true - $(NoWarn);1701 - false - - - true - portable - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - portable - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - {67f9d3a8-f71e-4428-913f-c37ae82cdb24} - LibTVRefCommonPortable - - - - - - - - <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) - <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) - true - - - - - - True - - - - - - - - \ No newline at end of file diff --git a/LibTVRefCommonTizen/LibTVRefCommonTizen.project.json b/LibTVRefCommonTizen/LibTVRefCommonTizen.project.json deleted file mode 100755 index 84dadd1..0000000 --- a/LibTVRefCommonTizen/LibTVRefCommonTizen.project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "dependencies": { - "ElmSharp": "1.2.2", - "Microsoft.NETCore.App": "1.1.2", - "Tizen.Applications": "1.5.8", - "Tizen.Content.MediaContent": "1.0.20", - "Tizen.Multimedia": "1.2.0", - "Tizen.Multimedia.MediaPlayer": "1.0.2", - "Tizen.Xamarin.Forms.Extension": "2.3.5-v00015", - "Xamarin.Forms": "2.4.0-r266-001", - "Xamarin.Forms.Platform.Tizen": "2.3.5-r256-001" - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "portable-net45+wp80+win81+wpa81", - "netstandard1.6" - ] - } - } -} \ No newline at end of file diff --git a/LibTVRefCommonTizen/Ports/AppControlPort.cs b/LibTVRefCommonTizen/Ports/AppControlPort.cs deleted file mode 100644 index 45dad8f..0000000 --- a/LibTVRefCommonTizen/Ports/AppControlPort.cs +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using Tizen.Applications; -using System.Collections.Generic; - -namespace LibTVRefCommonTizen.Ports -{ - /// - /// Handles the AppControl APIs - /// - public class AppControlPort : IAppControl - { - /// - /// The app ID of TV reference home application - /// - public static string TVHomeAppID = "org.tizen.xahome"; - - /// - /// The app ID of TV reference apps-tray application - /// - public static string TVAppsAppID = "org.tizen.xaapps"; - - /// - /// Represents the operation to be performed between TVHome and TVApps - /// This operation is sent from TVHomes to TVApps - /// - public static string AddAppOperation = "http://xahome.tizen.org/appcontrol/operation/add_app"; - - /// - /// Represents the operation to be performed between TVHome and TVApps - /// This operation is sent from TVApps to TVHome - /// - public static string AppAddedNotifyOperation = "http://xahome.tizen.org/appcontrol/operation/app_added"; - - public static string KeyAddedAppID = "AddedAppID"; - - /// - /// Sends the launch request - /// - /// The app ID to explicitly launch - /// The extra data for the app control - /// The file URI to be opened - public void SendLaunchRequest(string appId, IDictionary extraData = null, string fileUri = null) - { - try - { - AppControl appControl = new AppControl(); - - if (appId == null || appId.Length <= 0) - { - DbgPort.E("The AppID is null or blank"); - return; - } - - string value; - - appControl.ApplicationId = appId; - - if (extraData != null) - { - foreach (var key in extraData.Keys) - { - if (extraData.TryGetValue(key, out value)) - { - appControl.ExtraData.Add(key, value); - } - } - } - - if (fileUri != null && fileUri.Length != 0) - { - appControl.Uri = fileUri; - appControl.LaunchMode = AppControlLaunchMode.Group; - appControl.Mime = "video/*"; - appControl.Operation = AppControlOperations.View; - } - - AppControl.SendLaunchRequest(appControl); - } - catch (InvalidOperationException) - { - DbgPort.E("Failed to create AppControl"); - } - } - - /// - /// Sends the 'Add PIN apps' operation to TV Apps - /// - public void SendAddAppRequestToApps() - { - AppControl appControl = new AppControl() - { - ApplicationId = TVAppsAppID, - Operation = AddAppOperation, - }; - AppControl.SendLaunchRequest(appControl); - } - - /// - /// Sends the pinned app ID to TV Home - /// - /// The app ID to add PIN list int the TV Home - public void SendAppAddedNotificationToHome(string addedAddID) - { - AppControl appControl = new AppControl() - { - ApplicationId = TVHomeAppID, - Operation = AppAddedNotifyOperation, - }; - appControl.ExtraData.Add(KeyAddedAppID, addedAddID); - AppControl.SendLaunchRequest(appControl); - } - } -} diff --git a/LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs b/LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs deleted file mode 100755 index 29511ef..0000000 --- a/LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs +++ /dev/null @@ -1,270 +0,0 @@ -/* - * 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.Collections.Generic; -using System.Threading.Tasks; -using Tizen.Applications; -using LibTVRefCommonPortable.Utils; - -namespace LibTVRefCommonTizen.Ports -{ - /// - /// Handles the ApplicationsManager APIs - /// - public class ApplicationManagerPort : IApplicationManagerAPIs - { - /// - /// Defines the default app icon - /// If the app icon is not exist, shows the default app icon - /// - private static String DefaultAppIcon = "AppIcon.png"; - - /// - /// The constructor of this class - /// Adds the EventHandler for ApplicationLaunched - /// - public ApplicationManagerPort() - { - ApplicationManager.ApplicationLaunched += new EventHandler(OnApplicationLaunched); - } - - /// - /// Arguments for the event that is raised when the application is launched - /// - /// The source of the event - /// An object that contains no event data - /// - /// https://msdn.microsoft.com/en-us/library/system.eventhandler(v=vs.110).aspx - /// - void OnApplicationLaunched(object sender, EventArgs args) - { - ApplicationLaunchedEventArgs launchedEventArgs = args as ApplicationLaunchedEventArgs; - DbgPort.D(launchedEventArgs.ApplicationRunningContext.ApplicationId + " launched"); - } - - /// - /// Clears all recent applications - /// - public void DeleteAllRecentApplication() - { - RecentApplicationControl.DeleteAll(); - } - - /// - /// Removes the specified application with the app ID - /// - /// An application ID that is removed - public void DeleteRecentApplication(string appId) - { - IEnumerable recentApps = ApplicationManager.GetRecentApplications(); - string pkgId = PackageManager.GetPackageIdByApplicationId(appId); - - foreach (var item in recentApps) - { - if (item.PackageId.Equals(pkgId)) - { - RecentApplicationControl controller = item.Controller; - controller.Delete(); - } - } - } - - /// - /// Gets the information of the recent applications - /// - /// The list of the recent applications - public IEnumerable GetRecentApplications() - { - bool isNoRecentApps = true; - List resultList = new List(); - - try - { - IEnumerable recentApps = ApplicationManager.GetRecentApplications(); - - foreach (var app in recentApps) - { - if (app.IsNoDisplay || - app.ApplicationId == null || - app.ApplicationId.Length < 1) - { - continue; - } - - DbgPort.D("Recent App (" + app.Label + "): " + app.ApplicationId); - - resultList.Add(new RecentApp() - { - InstanceID = app.InstanceId, - InstanceLabel = app.InstanceName, - AppID = app.ApplicationId, - Applabel = (app.Label == null || app.Label.Length < 1) ? "No Name" : app.Label, - IconPath = app.IconPath, - LaunchedTime = app.LaunchTime, - Uri = app.Uri, - }); - isNoRecentApps = false; - } - } - catch (InvalidOperationException) - { - DbgPort.E("Failed to get the information of the recent applications"); - return null; - } - - if (isNoRecentApps) - { - DbgPort.E("No Recent Apps!!!"); - } - - return resultList; - } - - /// - /// Gets the information of the specified application with the app ID - /// - /// The app Id to get - /// The information of the installed application - public InstalledApp GetInstalledApplication(string appID) - { - InstalledApp result = null; - ApplicationInfo appInfo = null; - - try - { - appInfo = ApplicationManager.GetInstalledApplication(appID); - if (appInfo == null) - { - DbgPort.D("GetInstalledApplication failed"); - return null; - } - - result = new InstalledApp() - { - AppID = appInfo.ApplicationId, - Applabel = appInfo.Label, - IconPath = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon, - }; - } - catch (Exception exception) - { - DbgPort.E("Failed to get the installed application(" + appID + ") :" + exception.Message); - return null; - } - - return result; - } - - /// - /// Gets the information of the installed applications asynchronously - /// - /// The list of the installed applications - public async Task> GetAllInstalledApplication() - { - try - { - IList resultList = new List(); - Task> task = ApplicationManager.GetInstalledApplicationsAsync(); - - IEnumerable installedList = await task; - - foreach (var appInfo in installedList) - { - if (appInfo.Label == null || - appInfo.ApplicationId == null || - appInfo.IsNoDisplay) - { - continue; - } - - Package pkgInfo = PackageManager.GetPackage(appInfo.PackageId); - if (pkgInfo == null) - { - continue; - } - - if (pkgInfo.IsSystemPackage) - { - continue; - } - - resultList.Add(new InstalledApp - { - AppID = appInfo.ApplicationId, - Applabel = appInfo.Label, - IconPath = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon, - InstalledTime = new DateTime(pkgInfo.InstalledTime), - }); - } - - return resultList; - } - catch (Exception exception) - { - DbgPort.E("Failed to get the all installed applications : " + exception.Message); - return null; - } - } - - /// - /// Checks whether application is removable - /// - /// The app ID to get - /// If the application is removable, true; otherwise, false - public bool GetAppInfoRemovable(string appID) - { - ApplicationInfo appInfo = null; - - try - { - appInfo = ApplicationManager.GetInstalledApplication(appID); - if (appInfo == null) - { - DbgPort.D("Failed to get the installed application(" + appID + ")"); - return false; - } - - return !appInfo.IsPreload; - } - catch (Exception exception) - { - DbgPort.E("Failed to get the installed application(" + appID + ") :" + exception.Message); - return false; - } - } - - /// - /// Gets the app ID by the app label - /// - /// the app label to get - /// the app ID of the app label - public async Task GetAppIDbyAppLabel(string appLabel) - { - IEnumerable installedList = await ApplicationManager.GetInstalledApplicationsAsync(); - - foreach (var app in installedList) - { - if (app != null && app.Label.Equals(appLabel)) - { - return app.ApplicationId; - } - } - - return null; - } - } -} \ No newline at end of file diff --git a/LibTVRefCommonTizen/Ports/DbgPort.cs b/LibTVRefCommonTizen/Ports/DbgPort.cs deleted file mode 100644 index 64eb213..0000000 --- a/LibTVRefCommonTizen/Ports/DbgPort.cs +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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 Xamarin.Forms.Platform.Tizen.Native; -using Tizen; -using LibTVRefCommonPortable.Utils; -using System.Runtime.CompilerServices; -using System; - -namespace LibTVRefCommonTizen.Ports -{ - /// - /// Platform dependent implementation for the Logging and the Popup displaying - /// DbgPort is implementing IDebuggingAPIs which is defined in Calculator shared project - /// - /// - /// Please refer to Xamarin Dependency Service - /// https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/ - /// - public class DbgPort : IDebuggingAPIs - { - /// - /// A TV Home Windows reference - /// This is used to display a Dialog - /// - public static Xamarin.Forms.Platform.Tizen.Native.Window MainWindow - { - set; - get; - } - - /// - /// A Logging Tag - /// - public static string TAG = "home"; - - - /// - /// A flag which enables console log writting - /// - private static readonly bool IsNeedToShowInConsole = true; - - public static string Prefix - { - set; - get; - } - - /// - /// Displays a log message which developer want to check - /// - /// A debugging message - /// A file name that debugging message is exist - /// A function name that debugging message is exist - /// A line number that debugging message is exist - public void Dbg(string message, String file, String func, Int32 line) - { - D(message, file, func, line); - } - - /// - /// - /// A debugging message - /// A file name that debugging message is exist - /// A function name that debugging message is exist - /// A line number that debugging message is exist - public void Err(string message, String file, String func, Int32 line) - { - E(message, file, func, line); - } - - /// - /// Displays a dialog with a given message - /// - /// A debugging message - public void Popup(string message) - { - if (MainWindow == null) - { - return; - } - //bool result = await Xamarin.Forms.Page.DisplayAlert("Calculator", message, "OK"); - - Dialog toast = new Dialog(MainWindow); - toast.Title = message; - toast.Timeout = 2.3; - toast.BackButtonPressed += (s, e) => - { - toast.Dismiss(); - }; - toast.Show(); - } - - /// - /// Displays a log message which developer want to check - /// - /// A debugging message - /// A file name that debugging message is exist - /// A function name that debugging message is exist - /// A line number that debugging message is exist - public static void D(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) - { - Log.Debug(TAG, Prefix + ", " + message, file, func, line); - if (IsNeedToShowInConsole) - { - Console.WriteLine(String.Format("{0}, {1}:{2},{3}", message, file.Substring(file.LastIndexOf("\\")), line, func)); - } - - } - - /// - /// Displays an error log message - /// - /// A debugging message - /// A file name that debugging message is exist - /// A function name that debugging message is exist - /// A line number that debugging message is exist - public static void E(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) - { - Log.Error(TAG, Prefix + ", " + message, file, func, line); - if (IsNeedToShowInConsole) - { - Console.WriteLine(String.Format("{0}, {1}:{2},{3}", message, file.Substring(file.LastIndexOf("\\")), line, func)); - } - } - } -} \ No newline at end of file diff --git a/LibTVRefCommonTizen/Ports/FileSystemPort.cs b/LibTVRefCommonTizen/Ports/FileSystemPort.cs deleted file mode 100644 index 3479317..0000000 --- a/LibTVRefCommonTizen/Ports/FileSystemPort.cs +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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.IO; -using LibTVRefCommonPortable.Utils; - -namespace LibTVRefCommonTizen.Ports -{ - /// - /// Handles FileSystem APIs - /// - public class FileSystemPort : IFileSystemAPIs - { - /// - /// A directory path which should be used for app data storing. - /// - public static string AppDataStroagePath { private get; set; } - - /// - /// A property of AppDataStroagePath to be exported to PCL. - /// - public string AppDataStorage - { - get - { - return AppDataStroagePath ?? ""; - } - } - - public static string AppResourceStoragePath { private get; set; } - - public string AppResourceStorage - { - get - { - return AppResourceStoragePath ?? ""; - } - } - - /// - /// A directory path which should be used for sharing between apps. - /// - public static string PlatformShareStroagePath { private get; set; } - - /// - /// A property of PlatformShareStroagePath to be exported to PCL. - /// - public string PlatformShareStorage - { - get - { - return PlatformShareStroagePath ?? ""; - } - } - - /// - /// Opens the given file - /// - /// A relative or absolute path for the file that the current FileStream object will encapsulate - /// A constant that determines how to open or create the file - /// A generic view of a sequence of bytes - public Stream OpenFile(string filePath, UtilFileMode mode) - { - Stream fileStream = null; - DbgPort.D("[" + mode.ToString() + "] Opening the file, " + filePath); - try - { - fileStream = new FileStream(filePath, (FileMode)mode); - } - catch (Exception exception) - { - DbgPort.E("Exception!! " + exception.Message); - } - - return fileStream; - } - - /// - /// Flushes the given steam - /// - /// The stream to flush - public void Flush(Stream stream) - { - var fileStream = stream as FileStream; - fileStream.Flush(); - } - - /// - /// Closes the given stream - /// - /// The stream to close - public void CloseFile(Stream stream) - { - var fileStream = stream as FileStream; - fileStream.Dispose(); - } - - /// - /// Checks whether the given file exist - /// - /// The file to check - /// - /// true if the caller has the required permissions and path contains the name of an existing file, otherwise, false - /// - /// - /// https://msdn.microsoft.com/en-us/library/system.io.file.exists(v=vs.110).aspx - /// - public bool IsFileExist(String fileName) - { - return File.Exists(fileName); - } - - /// - /// Checks whether the given file ready - /// - /// The file to check - /// - /// true if the file is ready to open, otherwise, false - /// - /// - /// https://msdn.microsoft.com/en-us/library/y973b725(v=vs.110).aspx - /// - public bool IsFileReady(String fileName) - { - try - { - using (FileStream inputStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.None)) - { - return (inputStream.Length > 0) ? true : false; - } - } - catch (Exception) - { - return false; - } - } - } -} diff --git a/LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs b/LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs deleted file mode 100755 index 731690a..0000000 --- a/LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.IO; -using LibTVRefCommonPortable.Utils; -using LibTVRefCommonPortable.DataModels; - -namespace LibTVRefCommonTizen.Ports -{ - /// - /// Handles FileSystemWatcher APIs - /// - public class FileSystemWatcherPort : IFileSystemWatcherAPIs - { - static FileSystemWatcher watcher; - public event EventHandler CustomChanged; - private FileSystemEventCustomArgs args; - - /// - /// Listens to the file system change notifications and raises events when a directory, or file in a directory, changes - /// If the 'pinned_apps_info.xml' is created, changed, or deleted, invokes event handler method - /// - /// A file path which has the target file - /// A file name to be watching - /// - /// https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx - /// - public void Run(String path, String fileName) - { - if (File.Exists(path + fileName) == false) - { - DbgPort.E("Watching File is not exist!!!" + path + fileName); - } - - watcher = new FileSystemWatcher(); - watcher.Path = path; - watcher.NotifyFilter = NotifyFilters.LastWrite; - watcher.Filter = fileName; - - watcher.Created += new FileSystemEventHandler(WatcherChanged); - watcher.Changed += new FileSystemEventHandler(WatcherChanged); - watcher.Deleted += new FileSystemEventHandler(WatcherChanged); - watcher.IncludeSubdirectories = true; - watcher.EnableRaisingEvents = true; - } - - /// - /// Represents the method that will handle the Changed, Created, or Deleted event of a FileSystemWatcher class - /// - /// The source of the event - /// The FileSystemEventArgs that contains the event data - /// - /// https://msdn.microsoft.com/en-us/library/system.io.filesystemeventhandler(v=vs.110).aspx - /// - private void WatcherChanged(object sender, FileSystemEventArgs e) - { - args = new FileSystemEventCustomArgs((WatcherType)e.ChangeType, e.FullPath, e.Name); - if (e.ChangeType.Equals(WatcherChangeTypes.Changed)) - { - CustomChanged.Invoke(this, args); - } - - DbgPort.D(e.ChangeType + ", " + e.Name); - } - } -} diff --git a/LibTVRefCommonTizen/Ports/MediaContentPort.cs b/LibTVRefCommonTizen/Ports/MediaContentPort.cs deleted file mode 100644 index dba51f5..0000000 --- a/LibTVRefCommonTizen/Ports/MediaContentPort.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.Collections.Generic; -using Tizen.Content.MediaContent; -using LibTVRefCommonPortable.Utils; - -namespace LibTVRefCommonTizen.Ports -{ - /// - /// Handles the MediaContent APIs - /// - public class MediaContentPort : IMediaContentAPIs - { - /// - /// The constructor of this class - /// Connects content database - /// - public MediaContentPort() - { - DbgPort.D("MediaContentPort"); - ContentDatabase.Connect(); - } - - /// - /// A method for getting recently played media content list - /// - /// Maximum count of list - /// The recently played media content list - public IEnumerable GetRecentlyPlayedMedia(int limitation) - { - var recentlyPlayedVideos = new List(); - var contentFilter = new ContentFilter(); - - contentFilter.OrderKey = "MEDIA_LAST_PLAYED_TIME"; - contentFilter.Order = ContentOrder.Desc; - contentFilter.Condition = "MEDIA_TYPE=1 AND MEDIA_LAST_PLAYED_TIME!=0"; - contentFilter.Offset = 0; - contentFilter.Count = limitation; - - IEnumerable mediaInformations = new List(); - - try - { - mediaInformations = ContentManager.Database.SelectAll(contentFilter); - } - catch (Exception exception) - { - DbgPort.E(exception.Message); - } - - foreach (var mediaInformation in mediaInformations) - { - recentlyPlayedVideos.Add( - new RecentlyPlayedMedia() - { - MediaId = mediaInformation.MediaId, - ThumbnailPath = mediaInformation.ThumbnailPath, - DisplayName = mediaInformation.DisplayName, - PlayedAt = mediaInformation.PlayedAt, - FilePath = mediaInformation.FilePath, - }); - } - - return recentlyPlayedVideos; - } - } -} diff --git a/LibTVRefCommonTizen/Ports/PackageManagerPort.cs b/LibTVRefCommonTizen/Ports/PackageManagerPort.cs deleted file mode 100644 index 4004d1d..0000000 --- a/LibTVRefCommonTizen/Ports/PackageManagerPort.cs +++ /dev/null @@ -1,273 +0,0 @@ -/* - * 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.Collections.Generic; -using Tizen.Applications; - -using LibTVRefCommonPortable.Utils; -using System; - -namespace LibTVRefCommonTizen.Ports -{ - /// - /// Handles PackageManager APIs - /// - public class PackageManagerPort : IPackageManager - { - /// - /// An interface for platform notification - /// - private static IPlatformNotification Notification - { - get; - set; - } - - /// - /// The constructor for this class - /// - public PackageManagerPort() - { - - } - - /// - /// Registers a callback function to be invoked when the package is installed or uninstalled - /// - /// The instance of TVApps - public static void RegisterCallbacks(IPlatformNotification app) - { - Notification = app; - PackageManager.InstallProgressChanged += PackageManager_InstallProgressChanged; - PackageManager.UninstallProgressChanged += PackageManager_UninstallProgressChanged; - } - - /// - /// Unregisters the callback function - /// - public static void UnregisterCallbacks() - { - Notification = null; - PackageManager.InstallProgressChanged -= PackageManager_InstallProgressChanged; - PackageManager.UninstallProgressChanged -= PackageManager_UninstallProgressChanged; - } - - /// - /// UninstallProgressChanged event - /// This event is occurred when a package is getting uninstalled and the progress of the request to the package manager changes - /// - /// The source of the event - /// An object that contains no event data - private static void PackageManager_UninstallProgressChanged(object sender, PackageManagerEventArgs e) - { - if (e.State == PackageEventState.Completed) - { - if (Notification != null) - { - Notification.OnAppUninstalled(e.PackageId); - } - } - } - - /// - /// InstallProgressChanged event - /// This event is occurred when a package is getting installed and the progress of the request to the package manager changes - /// - /// The source of the event - /// An object that contains no event data - private static void PackageManager_InstallProgressChanged(object sender, PackageManagerEventArgs e) - { - if (e.State == PackageEventState.Completed) - { - Notification?.OnAppInstalled(e.PackageId); - } - } - - /// - /// Retrieves package information of all installed packages - /// - /// The list of packages - public Dictionary GetPackageList() - { - Dictionary pkgList = new Dictionary(); - IEnumerable packages = PackageManager.GetPackages(); - - string[] result; - - foreach (var item in packages) - { - if (item.Id == null) - { - continue; - } - - result = new string[3]; - var itemLabel = "No Name"; - - if (!string.IsNullOrEmpty(item.Label)) - { - itemLabel = item.Label; - } - - result[0] = itemLabel; - result[1] = item.Id; - result[2] = (System.IO.File.Exists(item.IconPath)) ? item.IconPath : "AppIcon.png"; - - pkgList.Add(itemLabel, result); - } - - return pkgList; - } - - /// - /// Gets the package label for the given package - /// - /// The ID of the package - /// The package label for the given package ID - public string GetPackageLabel(string pkgID) - { - try - { - Package tempItem = PackageManager.GetPackage(pkgID); - - if(tempItem == null) - { - return null; - } - else - { - return tempItem.Label; - } - } - catch (Exception e) - { - DbgPort.E("Failed to get package information(" + pkgID + ") : " + e.Message); - - return null; - } - } - - /// - /// Gets the pacakge ID by the app ID - /// - /// The app ID to get - /// The pacakge ID that contains given app ID - public string GetPackageIDByAppID(string appID) - { - try - { - return PackageManager.GetPackageIdByApplicationId(appID); - } - catch (Exception e) - { - DbgPort.E("Failed to get the package ID by app ID(" + appID + ") : " + e.Message); - - return null; - } - } - - /// - /// Uninstalls package with the given package - /// - /// The ID of the package to be uninstalled - /// Returns true if uninstalltion request is successful, false otherwise - public bool UninstallPackage(string pkgID) - { - try - { - Package tempItem = PackageManager.GetPackage(pkgID); - if(tempItem == null) - { - return false; - } - else - { - return PackageManager.Uninstall(tempItem.Id, tempItem.PackageType); - } - } - catch (Exception e) - { - DbgPort.E("Failed to get package information(" + pkgID + ") : " + e.Message); - - return false; - } - - } - - /// - /// Uninstalls package with the given app ID - /// - /// The app ID to be uninstalled< - /// Returns true if uninstallation request is successful, false otherwise - public bool UninstallPackageByAppID(string appID) - { - try - { - string pkgID = PackageManager.GetPackageIdByApplicationId(appID); - - return UninstallPackage(pkgID); - } - catch (Exception e) - { - DbgPort.E("Failed to uninstall by AppID(" + appID + ") : " + e.Message); - - return false; - } - } - - /// - /// Gets applications list by the package ID - /// - /// The package ID to get applications - /// The list of applications - public List GetApplicationsByPkgID(string pkgID) - { - try - { - int index = 0; - List apps = new List(); - Package pkg = PackageManager.GetPackage(pkgID); - if(pkg == null) - { - return null; - } - IEnumerable appsList = pkg.GetApplications(); - if (appsList == null) - { - DbgPort.E("Failed to get apps list(" + pkgID + ")"); - - return null; - } - - foreach (var app in appsList) - { - apps.Add(app.ApplicationId); - DbgPort.D("[" + index + "] " + app.ApplicationId); - index++; - } - - return apps; - } - catch (Exception e) - { - DbgPort.E("Failed to get the package information(" + pkgID + ") : " + e.Message); - - return new List(); - } - - } - } -} \ No newline at end of file diff --git a/LibTVRefCommonTizen/Ports/SystemSettingsPort.cs b/LibTVRefCommonTizen/Ports/SystemSettingsPort.cs deleted file mode 100644 index 8bba7c7..0000000 --- a/LibTVRefCommonTizen/Ports/SystemSettingsPort.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 -{ - /// - /// Handles the SystemSettings APIs - /// - 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); - } - - /// - /// A method for getting system model name. - /// - /// The system model name - /// The result whether getting the modelName is done - public bool GetSystemModelName(out string modelName) - { - if (SystemInfo.SystemInfoGetPlatformString(KeyModelName, out modelName) != ErrorNone) - { - modelName = ""; - return false; - } - - return true; - } - } -} diff --git a/LibTVRefCommonTizen/Ports/WindowPort.cs b/LibTVRefCommonTizen/Ports/WindowPort.cs deleted file mode 100644 index f2213d3..0000000 --- a/LibTVRefCommonTizen/Ports/WindowPort.cs +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 -{ - /// - /// Handles Window APIs - /// - public class WindowPort : IWindowAPIs - { - internal class ElmWindow - { - [DllImport("libelementary.so.1", EntryPoint = "elm_win_keygrab_set", CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr ElmWinKeygrabSet(IntPtr obj, string key, ulong modifiers, ulong not_modifiers, int proirity, int grab_mode); - - [DllImport("libelementary.so.1", EntryPoint = "elm_win_iconified_set", CallingConvention = CallingConvention.Cdecl)] - internal static extern void ElmWinIconfiedSet(IntPtr obj, bool iconified); - - [DllImport("libelementary.so.1", EntryPoint = "elm_win_iconified_get", CallingConvention = CallingConvention.Cdecl)] - internal static extern bool ElmWinIconifiedGet(IntPtr obj); - } - - /// - /// The main window of the App - /// - static private Window mainWindow; - public Window MainWindow - { - set - { - mainWindow = value; - } - } - - /// - /// Sets the keygrab of the Elm_Win object - /// - /// - /// keyname string to set keygrab - /// - public void SetKeyGrabExclusively(string key) - { - if (mainWindow != null) - { - ElmWindow.ElmWinKeygrabSet((IntPtr)mainWindow, key, 0, 0, 0, 1024); - } - } - - /// - /// Sets the iconified state of a window - /// - /// - /// If true the window is iconified, otherwise false - /// - public void SetIconified(bool iconified) - { - if (mainWindow != null) - { - ElmWindow.ElmWinIconfiedSet((IntPtr)mainWindow, iconified); - } - } - - /// - /// Gets the iconified state of a window - /// - /// - /// true if the window is iconified, otherwise false - /// - public bool GetIconified() - { - return (mainWindow != null) ? ElmWindow.ElmWinIconifiedGet((IntPtr)mainWindow) : false; - } - - /// - /// Activates the window object - /// - /// - /// This is just a request that a Window Manager may ignore, so calling this function does not ensure in any way that the window is going to be the active one after it - /// - public void Active() - { - mainWindow?.Active(); - } - } -} diff --git a/LibTVRefCommonTizen/Properties/AssemblyInfo.cs b/LibTVRefCommonTizen/Properties/AssemblyInfo.cs deleted file mode 100644 index cc5ece9..0000000 --- a/LibTVRefCommonTizen/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LibTVRefCommonTizen")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LibTVRefCommonTizen")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c558d279-897e-45e1-a10a-decd788770f4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LibTVRefCommonTizen/Settings.StyleCop b/LibTVRefCommonTizen/Settings.StyleCop deleted file mode 100644 index 837530c..0000000 --- a/LibTVRefCommonTizen/Settings.StyleCop +++ /dev/null @@ -1,722 +0,0 @@ - - - NoMerge - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - \ No newline at end of file diff --git a/TVApps.sln b/TVApps.sln deleted file mode 100644 index 1c609c9..0000000 --- a/TVApps.sln +++ /dev/null @@ -1,40 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TVApps", "TVApps\TVApps\TVApps.csproj", "{FD8C0EF4-6CEA-4421-85B7-7AC8592738C6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TVApps.TizenTV", "TVApps\TVApps.TizenTV\TVApps.TizenTV.csproj", "{7E341BF5-B7BD-4532-9D4A-AA89537B525E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibTVRefCommonPortable", "LibTVRefCommonPortable\LibTVRefCommonPortable.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibTVRefCommonTizen", "LibTVRefCommonTizen\LibTVRefCommonTizen.csproj", "{C558D279-897E-45E1-A10A-DECD788770F4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FD8C0EF4-6CEA-4421-85B7-7AC8592738C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FD8C0EF4-6CEA-4421-85B7-7AC8592738C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FD8C0EF4-6CEA-4421-85B7-7AC8592738C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FD8C0EF4-6CEA-4421-85B7-7AC8592738C6}.Release|Any CPU.Build.0 = Release|Any CPU - {7E341BF5-B7BD-4532-9D4A-AA89537B525E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E341BF5-B7BD-4532-9D4A-AA89537B525E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E341BF5-B7BD-4532-9D4A-AA89537B525E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E341BF5-B7BD-4532-9D4A-AA89537B525E}.Release|Any CPU.Build.0 = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|Any CPU.Build.0 = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|Any CPU.ActiveCfg = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|Any CPU.Build.0 = Release|Any CPU - {C558D279-897E-45E1-A10A-DECD788770F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C558D279-897E-45E1-A10A-DECD788770F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C558D279-897E-45E1-A10A-DECD788770F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C558D279-897E-45E1-A10A-DECD788770F4}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/TVApps/TVApps.Tizen.TV/Renderer/NinePatchImageRenderer.cs b/TVApps/TVApps.Tizen.TV/Renderer/NinePatchImageRenderer.cs new file mode 100644 index 0000000..f490767 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/Renderer/NinePatchImageRenderer.cs @@ -0,0 +1,78 @@ +/* + * 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.ComponentModel; + +using TVApps.Controls; +using TVApps.TizenTV.Renderer; +using Xamarin.Forms.Platform.Tizen; + +[assembly: ExportRenderer(typeof(NinePatchImage), typeof(NinePatchImageRenderer))] +namespace TVApps.TizenTV.Renderer +{ + /// + /// A custom renderer for NinePatchImage + /// + /// + class NinePatchImageRenderer : ImageRenderer + { + /// + /// Updates border when Element is changed + /// + /// An image element changed event's argument + protected override void OnElementChanged(ElementChangedEventArgs args) + { + base.OnElementChanged(args); + UpdateBorder(); + } + + /// + /// Updates border when ElementProperty is changed + /// + /// The source of the event + /// An image element property changed event's argument + protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if ((args.PropertyName == NinePatchImage.BorderBottomProperty.PropertyName) + || (args.PropertyName == NinePatchImage.BorderLeftProperty.PropertyName) + || (args.PropertyName == NinePatchImage.BorderRightProperty.PropertyName) + || (args.PropertyName == NinePatchImage.BorderTopProperty.PropertyName)) + { + UpdateBorder(); + } + + base.OnElementPropertyChanged(sender, args); + } + + /// + /// A method updates border of Control(Native Image) + /// + void UpdateBorder() + { + var img = Element as NinePatchImage; + Control.SetBorder(img.BorderLeft, img.BorderRight, img.BorderTop, img.BorderBottom); + } + + /// + /// A method updates border of Control(Native Image) after loading + /// + protected override void UpdateAfterLoading() + { + base.UpdateAfterLoading(); + UpdateBorder(); + } + } +} diff --git a/TVApps/TVApps.Tizen.TV/Settings.StyleCop b/TVApps/TVApps.Tizen.TV/Settings.StyleCop new file mode 100644 index 0000000..837530c --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/Settings.StyleCop @@ -0,0 +1,722 @@ + + + NoMerge + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/TVApps/TVApps.Tizen.TV/TVApps.Tizen.TV.csproj b/TVApps/TVApps.Tizen.TV/TVApps.Tizen.TV.csproj new file mode 100644 index 0000000..e0d9483 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/TVApps.Tizen.TV.csproj @@ -0,0 +1,56 @@ + + + + + + $(MSBuildExtensionsPath)\Tizen\VisualStudio\ + + + + + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TVApps/TVApps.Tizen.TV/TVApps.TizenTV.cs b/TVApps/TVApps.Tizen.TV/TVApps.TizenTV.cs new file mode 100644 index 0000000..067aef0 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/TVApps.TizenTV.cs @@ -0,0 +1,145 @@ +/* + * 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 LibTVRefCommonPortable.Utils; +using LibTVRefCommonTizen.Ports; +using Tizen.Applications; +using Tizen.Xamarin.Forms.Extension.Renderer; + +namespace TVApps.TizenTV +{ + /// + /// TV Apps application main entry point + /// + public class Program : Xamarin.Forms.Platform.Tizen.FormsApplication, IAppLifeControl + { + /// + /// The application instance + /// + private static Program instance; + + /// + /// An interface for the platform notification + /// + private IPlatformNotification notification; + + /// + /// A method will be called when application is created + /// + protected override void OnCreate() + { + base.OnCreate(); + + FileSystemPort.AppDataStroagePath = DirectoryInfo.Data; + FileSystemPort.PlatformShareStroagePath = "/opt/usr/home/owner/share/"; + + var app = new App(MainWindow.ScreenSize.Width, + MainWindow.ScreenSize.Height, + MainWindow.ScreenDpi.X, + ElmSharp.Elementary.GetScale()); + notification = app; + + DbgPort.D("-----------------------------------"); + DbgPort.D("Apps application is being loaded..."); + DbgPort.D("-----------------------------------"); + LoadApplication(app); + + PackageManagerPort.RegisterCallbacks(notification); + MainWindow.Alpha = true; + MainWindow.KeyUp += KeyUpListener; + + MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true); + MainWindow.KeyGrab("XF86Info", true); + } + + /// + /// A method will be called when application receives KeyUp event + /// + + /// The source of the event + /// A EvasKey event's argument + private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs args) + { + DebuggingUtils.Dbg("[TVApps.TizenTV.cs] Key Pressed :" + args.KeyName); + if (args.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0 || + args.KeyName.CompareTo("XF86Info") == 0) + { + notification?.OnMenuKeyPressed(); + } + } + + /// + /// A method will be called when application is terminated + /// + protected override void OnTerminate() + { + base.OnTerminate(); + + notification = null; + PackageManagerPort.UnregisterCallbacks(); + MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName); + MainWindow.KeyUngrab("XF86Info"); + } + + /// + /// A method will be called when application receives AppControl + /// + /// AppControl event argument + protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + { + DbgPort.D("OnAppControlReceived, " + e.ReceivedAppControl.Operation); + + if (AppControlPort.AddAppOperation.CompareTo(e.ReceivedAppControl.Operation) == 0) + { + DbgPort.D("Add App Request"); + notification.OnPinAppRequestReceived(); + } + } + + /// + /// The entry point for the application + /// + /// A list of command line arguments + static void Main(string[] args) + { + instance = new Program(); + + DbgPort.Prefix = "Apps"; + + Xamarin.Forms.DependencyService.Register(); + Xamarin.Forms.DependencyService.Register(); + Xamarin.Forms.DependencyService.Register(); + Xamarin.Forms.DependencyService.Register(); + Xamarin.Forms.DependencyService.Register(); + Xamarin.Forms.DependencyService.Register(); + Xamarin.Forms.DependencyService.Register(); + Xamarin.Forms.DependencyService.Register(); + + Xamarin.Forms.Platform.Tizen.Forms.Init(instance); + TizenFormsExtension.Init(); + + instance.Run(args); + } + + /// + /// A method terminates application + /// + public void SelfTerminate() + { + instance.Exit(); + } + } +} diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.deps.json b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.deps.json new file mode 100644 index 0000000..a2bf14e --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.deps.json @@ -0,0 +1,222 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v2.0", + "signature": "7b37460e941a73f9576f52a534d76051a2c28b59" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v2.0": { + "TVApps.Tizen.TV/1.0.0": { + "dependencies": { + "LibCommon.Shared": "1.0.0", + "LibCommon.Tizen": "1.0.0", + "TVApps": "1.0.0", + "Tizen.NET": "4.0.0-preview1-00143", + "Tizen.NET.Sdk": "0.9.18-pre1", + "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005", + "Xamarin.Forms": "2.4.0.266-pre1", + "Xamarin.Forms.Platform.Tizen": "2.4.0-r266-006" + }, + "runtime": { + "TVApps.Tizen.TV.dll": {} + } + }, + "Tizen.NET/4.0.0-preview1-00143": { + "runtime": { + "lib/netstandard1.6/ElmSharp.Wearable.dll": {}, + "lib/netstandard1.6/ElmSharp.dll": {}, + "lib/netstandard1.6/Tizen.Account.AccountManager.dll": {}, + "lib/netstandard1.6/Tizen.Account.FidoClient.dll": {}, + "lib/netstandard1.6/Tizen.Account.OAuth2.dll": {}, + "lib/netstandard1.6/Tizen.Account.SyncManager.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Alarm.dll": {}, + "lib/netstandard1.6/Tizen.Applications.AttachPanel.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Badge.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Common.dll": {}, + "lib/netstandard1.6/Tizen.Applications.DataControl.dll": {}, + "lib/netstandard1.6/Tizen.Applications.MessagePort.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Notification.dll": {}, + "lib/netstandard1.6/Tizen.Applications.NotificationEventListener.dll": {}, + "lib/netstandard1.6/Tizen.Applications.PackageManager.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Preference.dll": {}, + "lib/netstandard1.6/Tizen.Applications.RemoteView.dll": {}, + "lib/netstandard1.6/Tizen.Applications.Service.dll": {}, + "lib/netstandard1.6/Tizen.Applications.ToastMessage.dll": {}, + "lib/netstandard1.6/Tizen.Applications.UI.dll": {}, + "lib/netstandard1.6/Tizen.Applications.WatchApplication.dll": {}, + "lib/netstandard1.6/Tizen.Applications.WidgetApplication.dll": {}, + "lib/netstandard1.6/Tizen.Applications.WidgetControl.dll": {}, + "lib/netstandard1.6/Tizen.Content.Download.dll": {}, + "lib/netstandard1.6/Tizen.Content.MediaContent.dll": {}, + "lib/netstandard1.6/Tizen.Content.MimeType.dll": {}, + "lib/netstandard1.6/Tizen.Context.dll": {}, + "lib/netstandard1.6/Tizen.Location.Geofence.dll": {}, + "lib/netstandard1.6/Tizen.Location.dll": {}, + "lib/netstandard1.6/Tizen.Log.dll": {}, + "lib/netstandard1.6/Tizen.Maps.dll": {}, + "lib/netstandard1.6/Tizen.Messaging.Push.dll": {}, + "lib/netstandard1.6/Tizen.Messaging.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.AudioIO.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Camera.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.MediaCodec.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.MediaPlayer.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Metadata.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Radio.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Recorder.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Remoting.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.StreamRecorder.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Util.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.Vision.dll": {}, + "lib/netstandard1.6/Tizen.Multimedia.dll": {}, + "lib/netstandard1.6/Tizen.NUI.dll": {}, + "lib/netstandard1.6/Tizen.Network.Bluetooth.dll": {}, + "lib/netstandard1.6/Tizen.Network.Connection.dll": {}, + "lib/netstandard1.6/Tizen.Network.IoTConnectivity.dll": {}, + "lib/netstandard1.6/Tizen.Network.Nfc.dll": {}, + "lib/netstandard1.6/Tizen.Network.Nsd.dll": {}, + "lib/netstandard1.6/Tizen.Network.Smartcard.dll": {}, + "lib/netstandard1.6/Tizen.Network.WiFi.dll": {}, + "lib/netstandard1.6/Tizen.Network.WiFiDirect.dll": {}, + "lib/netstandard1.6/Tizen.PhonenumberUtils.dll": {}, + "lib/netstandard1.6/Tizen.Pims.Calendar.dll": {}, + "lib/netstandard1.6/Tizen.Pims.Contacts.dll": {}, + "lib/netstandard1.6/Tizen.Security.SecureRepository.dll": {}, + "lib/netstandard1.6/Tizen.Security.TEEC.dll": {}, + "lib/netstandard1.6/Tizen.Security.dll": {}, + "lib/netstandard1.6/Tizen.Sensor.dll": {}, + "lib/netstandard1.6/Tizen.System.Feedback.dll": {}, + "lib/netstandard1.6/Tizen.System.Information.dll": {}, + "lib/netstandard1.6/Tizen.System.MediaKey.dll": {}, + "lib/netstandard1.6/Tizen.System.PlatformConfig.dll": {}, + "lib/netstandard1.6/Tizen.System.Storage.dll": {}, + "lib/netstandard1.6/Tizen.System.SystemSettings.dll": {}, + "lib/netstandard1.6/Tizen.System.dll": {}, + "lib/netstandard1.6/Tizen.Telephony.dll": {}, + "lib/netstandard1.6/Tizen.Tracer.dll": {}, + "lib/netstandard1.6/Tizen.Uix.InputMethod.dll": {}, + "lib/netstandard1.6/Tizen.Uix.InputMethodManager.dll": {}, + "lib/netstandard1.6/Tizen.Uix.Stt.dll": {}, + "lib/netstandard1.6/Tizen.Uix.Tts.dll": {}, + "lib/netstandard1.6/Tizen.Uix.VoiceControl.dll": {}, + "lib/netstandard1.6/Tizen.WebView.dll": {}, + "lib/netstandard1.6/Tizen.dll": {} + } + }, + "Tizen.NET.Sdk/0.9.18-pre1": {}, + "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": { + "dependencies": { + "Xamarin.Forms": "2.4.0.266-pre1", + "Xamarin.Forms.Platform.Tizen": "2.4.0-r266-006" + }, + "runtime": { + "lib/netcoreapp2.0/Tizen.Xamarin.Forms.Extension.Renderer.dll": {}, + "lib/netcoreapp2.0/Tizen.Xamarin.Forms.Extension.dll": {} + } + }, + "Xamarin.Forms/2.4.0.266-pre1": { + "runtime": { + "lib/netstandard1.0/Xamarin.Forms.Core.dll": {}, + "lib/netstandard1.0/Xamarin.Forms.Platform.dll": {}, + "lib/netstandard1.0/Xamarin.Forms.Xaml.dll": {} + } + }, + "Xamarin.Forms.Platform.Tizen/2.4.0-r266-006": { + "dependencies": { + "Tizen.NET": "4.0.0-preview1-00143", + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "lib/netstandard1.6/Xamarin.Forms.Platform.Tizen.dll": {} + } + }, + "LibCommon.Shared/1.0.0": { + "dependencies": { + "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005", + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "LibCommon.Shared.dll": {} + } + }, + "LibCommon.Tizen/1.0.0": { + "dependencies": { + "LibCommon.Shared": "1.0.0", + "Tizen.NET": "4.0.0-preview1-00143", + "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005", + "Xamarin.Forms": "2.4.0.266-pre1", + "Xamarin.Forms.Platform.Tizen": "2.4.0-r266-006" + }, + "runtime": { + "LibCommon.Tizen.dll": {} + } + }, + "TVApps/1.0.0": { + "dependencies": { + "LibCommon.Shared": "1.0.0", + "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005", + "Xamarin.Forms": "2.4.0.266-pre1" + }, + "runtime": { + "TVApps.dll": {} + } + } + } + }, + "libraries": { + "TVApps.Tizen.TV/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Tizen.NET/4.0.0-preview1-00143": { + "type": "package", + "serviceable": true, + "sha512": "sha512-woW6D9FsWZD2lJRwbND2hzMIi9l7QYwUqfpCxrMT3+Mh3+8UdFM86skDdw3mAgpLIqfC1plUfbISksQ9G2Gcgg==", + "path": "tizen.net/4.0.0-preview1-00143", + "hashPath": "tizen.net.4.0.0-preview1-00143.nupkg.sha512" + }, + "Tizen.NET.Sdk/0.9.18-pre1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-lUsZ48M9YxKKwpYpE6zbd2/uw7GeJJZmKYABHW6Xdcfarxf17ncGRBLl7Gnt2rAc5ev8UkNKYfZoQQh+kQO2Hw==", + "path": "tizen.net.sdk/0.9.18-pre1", + "hashPath": "tizen.net.sdk.0.9.18-pre1.nupkg.sha512" + }, + "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MKUamVt5XloZ/JziyOXLdbahn7T0LDQDJGUt3ynt0iSia4aLpZLOua6/iypBhnC79FgMaNfUA7APjVfjh3NLTg==", + "path": "tizen.xamarin.forms.extension/2.4.0-v00005", + "hashPath": "tizen.xamarin.forms.extension.2.4.0-v00005.nupkg.sha512" + }, + "Xamarin.Forms/2.4.0.266-pre1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pMu+b01vdH1ul5EJo1opQjEcwisWT35DdZO6EuR9HNKfY1dWyKmAlWgRdGUtjtdbhjOAtCOQUxI7F3x4hvV8KA==", + "path": "xamarin.forms/2.4.0.266-pre1", + "hashPath": "xamarin.forms.2.4.0.266-pre1.nupkg.sha512" + }, + "Xamarin.Forms.Platform.Tizen/2.4.0-r266-006": { + "type": "package", + "serviceable": true, + "sha512": "sha512-xDEcJnKerroXtMLLUVssB9+f2mZMB5ngulNB09OsIp0gRqP7GnpqJEyWQsISFRCk272lNVd57UhXGCUFl9/aRg==", + "path": "xamarin.forms.platform.tizen/2.4.0-r266-006", + "hashPath": "xamarin.forms.platform.tizen.2.4.0-r266-006.nupkg.sha512" + }, + "LibCommon.Shared/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "LibCommon.Tizen/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "TVApps/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.runtimeconfig.dev.json b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.runtimeconfig.dev.json new file mode 100644 index 0000000..2c2f357 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.runtimeconfig.dev.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "additionalProbingPaths": [ + "C:\\Users\\samsung\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\samsung\\.nuget\\packages", + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ] + } +} \ No newline at end of file diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.runtimeconfig.json b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.runtimeconfig.json new file mode 100644 index 0000000..7539019 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/TVApps.Tizen.TV.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "netcoreapp2.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "2.0.0" + } + } +} \ No newline at end of file diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/org.tizen.xaapps-1.0.0.tpi b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/org.tizen.xaapps-1.0.0.tpi new file mode 100644 index 0000000..e69de29 diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/org.tizen.xaapps-1.0.0.tpk b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/org.tizen.xaapps-1.0.0.tpk new file mode 100644 index 0000000..7319ded Binary files /dev/null and b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/org.tizen.xaapps-1.0.0.tpk differ diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/author-signature.xml b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/author-signature.xml new file mode 100644 index 0000000..b9074ae --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/author-signature.xml @@ -0,0 +1,150 @@ + + + + + + + PW6DDKlhSQZGENOMYSTs9krh2HLoq2dKCYzYpjHKDNs= + + + + /gTbhhRqVKFAMykTkZyDaEozK7OBNMSXGtsJpmRcLuE= + + + + J/d/Iu+nPnrMUHbnjHtcNpI4dTAbHKyD61nelmBE8rE= + + + + k9quBEmTxuUA7AiVyJthoirEwrl9SgQr5J0DXi6llkk= + + + + 8FCwIup+0tvOQf5a14Lo7VQVCCG9bgxkw/sxAFAN8lM= + + + + Wnha/ZDGFuzYPiZ6JyEp1wTQYBpYv7WDYs8CHPr3Ugs= + + + + x/rqZEBQb4V2cBRByJrDHyvHUP5aIka4jiBYuVysUJg= + + + + BgawWdKNYytoW7rglBK3/WadIDO64RmYLRvqdVlKcYA= + + + + iN7qVbbwpxhN3RAqDyb3zDQuvkTlNJNM3mIo45nyMzU= + + + + nmik89SH8yehPu6zI2peM/amzyT0kunzhWjX/nKDWto= + + + + 7oZiDFE6sc/h/5gxMoKu72pn73f48lWBD8p5W7h7j4I= + + + + Q1voviamaw/GnkgZDXopBuyM18WxY0sxyD5g3Uyovf4= + + + + 1fLNIiGbumlNGMW1fApud98XB/+XaRzlfKtOlAaIDwQ= + + + + 899qMfwfpHleUrl1Eyx89Y4AJxYGBwOc7bsmIIERfA4= + + + + Ujn3mYvFRa5GBhVgy6iMMKWOOh0Vl33ISGagcSkxC2U= + + + + vy52VSuLoSlQmeqgLYOQP2SZUL8kdr2x6Dw4WL5ia5M= + + + + p9BXz7Wy961nTBtuJ6NBBlcg3d6JzxtAa2kKvTAjU0k= + + + + ytXYOQFfxUo6TNaE/JC9uMkpYq28zyKWfuzKtLt1hD8= + + + + 28yMmL3EV3MWlzVPfP3R3jC9/qQWZlIWvvKHFJz5Qs0= + + + + L9fmVpePV7PCT/SW8PIIBm6ekdcZSq9eG07O/R4s8pI= + + + + 9xk59Y9Uhmml3aT0AKL5zD8aQbN2QMedWOZxxGQ86EA= + + + + + + + e2rGZ9lURQWep1IIbrRk2NYMw5EXlejQt2B0bMLUyoc= + + + +nbrOAJrnCyJgp5Y34tEQ3Daf0njmZIIV0sNvkwJs69Uugq+NdAjTI9Svtker16UkS4R5DjC2/FmR +bMHFZVxEpsKv4mkpiqrw1R+PWjQOTUEXd1wOeuJpVvUkBMMtbQRSAgnLf01P7H9Ew3Uqb15BLHZx +1umibqx4r9BhmOMZiIE= + + + + +MIIClTCCAX2gAwIBAgIGAVYhXgiqMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz +c29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4gRGV2 +ZWxvcGVycyBDQTAeFw0xMjExMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMBExDzANBgNVBAMMBmF1 +dGhvcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApm4Xqu2NAxOEh4Fgo0w6j+Q9MccSOPny +mkyM3XMn0nL7mFKL4ZETxyRXlMU8DnM9l4zsEH3iS15cZknesUrCEAiuhL4fsp05ZSr6ERCYQrXs +06WPmepipiM7n6BWzCsSmv0qNxkYWjZODWT2+15PsXfvwsK9wsrjSDIT8SuYV48CAwEAAaMyMDAw +DAYDVR0TAQH/BAIwADALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcN +AQEFBQADggEBAMqla3XZiV3xAQe3laSgVJvmtEsjl3Zfp7Nufrobsl4pxQhVbOITomeEqrJkn4e6 +zzfsjQQ6nw0yXqeo6qfP1ez8Wvr/egyfO6BrnARX37K5cXszpIn7IvO6xl4Ux/rtp4vvQXDcrDS5 +F07d9tg+5UO6MC/9cKaCNEIxSkXEhjOf5x2LGg686fq5V4WEKCO2ApkJRXn+tFRArysrT5FPEnus +NG+XhHWJw58HgBrZFl0SOUJQvzi3xv5xVPml65qwbehmQyu+LcgWeKySO46nzF0AXlCTaC78FGYk +nrG2yFeWO6SWXGV7uxgizufT+s851rPFg/EWYEjqX4jU/jp7Swg= + + +MIIDOTCCAiGgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMRowGAYDVQQKDBFUaXplbiBBc3NvY2lh +dGlvbjEaMBgGA1UECwwRVGl6ZW4gQXNzb2NpYXRpb24xHjAcBgNVBAMMFVRpemVuIERldmVsb3Bl +cnMgUm9vdDAeFw0xMjAxMDEwMDAwMDBaFw0yNzAxMDEwMDAwMDBaMFYxGjAYBgNVBAoMEVRpemVu +IEFzc29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4g +RGV2ZWxvcGVycyBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANVGhRGmMIUyBA7o +PCz8Sxut6z6HNkF4oDIuzuKaMzRYPeWodwe9O0gmqAkToQHfwg2giRhE5GoPld0fq+OYMMwSasCu +g8dwODx1eDeSYVuOLWRxpAmbTXOsSFi6VoWeyaPEm18JBHvZBsU5YQtgZ6Kp7MqzvQg3pXOxtajj +vyHxiatJl+xXrHgcXC1wgyG3buty7u/Fi2mvKXJ0PRJcCjjK81dqe/Vr20sRUCrbk02zbm5ggFt/ +jIEhV8wbFRQpliobc7J4dSTKhFfrqGM8rdd54LYhD7gSI1CFSe16pUXfcVR7FhJztRaiGLnCrwBE +dyTZ248+D4L/qR/D0axb3jcCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC +AQEAnOXXQ/1O/QTDHyrmQDtFziqPY3xWlJBqJtEqXiT7Y+Ljpe66e+Ee/OjQMlZe8gu21/8cKklH +95RxjopMWCVedXDUbWdvS2+CdyvVW/quT2E0tjqIzXDekUTYwwhlPWlGxvfj3VsxqSFq3p8Brl04 +1Gx5RKAGyKVsMfTLhbbwSWwApuBUxYfcNpKwLWGPXkysu+HctY03OKv4/xKBnVWiN8ex/Sgesi0M ++OBAOMdZMPK32uJBTeKFx1xZgTLIhk45V0hPOomPjZloiv0LSS11eyd451ufjW0iHRE7WlpR6EvI +W6TFyZgMpQq+kg4hWl2SBTf3s2VI8Ygz7gj8TMlClg== + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/shared/res/TVApps.Tizen.TV.png b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/shared/res/TVApps.Tizen.TV.png new file mode 100644 index 0000000..9f3cb98 Binary files /dev/null and b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/shared/res/TVApps.Tizen.TV.png differ diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/signature1.xml b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/signature1.xml new file mode 100644 index 0000000..d648894 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/signature1.xml @@ -0,0 +1,152 @@ + + + + + + + PW6DDKlhSQZGENOMYSTs9krh2HLoq2dKCYzYpjHKDNs= + + + + /gTbhhRqVKFAMykTkZyDaEozK7OBNMSXGtsJpmRcLuE= + + + + J/d/Iu+nPnrMUHbnjHtcNpI4dTAbHKyD61nelmBE8rE= + + + + k9quBEmTxuUA7AiVyJthoirEwrl9SgQr5J0DXi6llkk= + + + + 8FCwIup+0tvOQf5a14Lo7VQVCCG9bgxkw/sxAFAN8lM= + + + + Wnha/ZDGFuzYPiZ6JyEp1wTQYBpYv7WDYs8CHPr3Ugs= + + + + x/rqZEBQb4V2cBRByJrDHyvHUP5aIka4jiBYuVysUJg= + + + + BgawWdKNYytoW7rglBK3/WadIDO64RmYLRvqdVlKcYA= + + + + iN7qVbbwpxhN3RAqDyb3zDQuvkTlNJNM3mIo45nyMzU= + + + + nmik89SH8yehPu6zI2peM/amzyT0kunzhWjX/nKDWto= + + + + 7oZiDFE6sc/h/5gxMoKu72pn73f48lWBD8p5W7h7j4I= + + + + Q1voviamaw/GnkgZDXopBuyM18WxY0sxyD5g3Uyovf4= + + + + 1fLNIiGbumlNGMW1fApud98XB/+XaRzlfKtOlAaIDwQ= + + + + 899qMfwfpHleUrl1Eyx89Y4AJxYGBwOc7bsmIIERfA4= + + + + Ujn3mYvFRa5GBhVgy6iMMKWOOh0Vl33ISGagcSkxC2U= + + + + vy52VSuLoSlQmeqgLYOQP2SZUL8kdr2x6Dw4WL5ia5M= + + + + p9BXz7Wy961nTBtuJ6NBBlcg3d6JzxtAa2kKvTAjU0k= + + + + ytXYOQFfxUo6TNaE/JC9uMkpYq28zyKWfuzKtLt1hD8= + + + + 28yMmL3EV3MWlzVPfP3R3jC9/qQWZlIWvvKHFJz5Qs0= + + + + L9fmVpePV7PCT/SW8PIIBm6ekdcZSq9eG07O/R4s8pI= + + + + 9xk59Y9Uhmml3aT0AKL5zD8aQbN2QMedWOZxxGQ86EA= + + + + v1HIQ1oAj0d93pjOih1y2AIp2no3LNXDJ4VtjJfuxnA= + + + + + + + abSCdQC03ZcPoEN8T0eWSILDIhDi2uNziivgdw1gmmQ= + + + +WYhNnCdE+md3kl9gZJRTpLWQQlrq6HhTOAd/YRhEAc7QaJJzVoBbWnRtxmIgmD4z5mWCUvpoIciR +ikSD0U0pc6qyKugNHRgG8U2g+4jpHfEukaPpfKBeWLVmySS+Qw2w+Gq7RgIGrMICPWntQuxxqFj8 +oX4m/76+NR8hpdU6djw= + + + + +MIICmzCCAgQCCQDXI7WLdVZwiTANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMCS1IxDjAMBgNV +BAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UE +CwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwbVGl6ZW4gUHVibGljIERpc3Ry +aWJ1dG9yIENBMB4XDTEyMTAyOTEzMDMwNFoXDTIyMTAyNzEzMDMwNFowgZMxCzAJBgNVBAYTAktS +MQ4wDAYDVQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAUBgNVBAoMDVRpemVuIFRlc3QgQ0Ex +IjAgBgNVBAsMGVRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0ExKDAmBgNVBAMMH1RpemVuIFB1Ymxp +YyBEaXN0cmlidXRvciBTaWduZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALtMvlc5hENK +90ZdA+y66+Sy0enD1gpZDBh5T9RP0oRsptJv5jjNTseQbQi0SZOdOXb6J7iQdlBCtR343RpIEz8H +mrBy7mSY7mgwoU4EPpp4CTSUeAuKcmvrNOngTp5Hv7Ngf02TTHOLK3hZLpGayaDviyNZB5PdqQdB +hokKjzAzAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAvGp1gxxAIlFfhJH1efjb9BJK/rtRkbYn9+Ez +GEbEULg1svsgnyWisFimI3uFvgI/swzr1eKVY3Sc8MQ3+Fdy3EkbDZ2+WAubhcEkorTWjzWz2fL1 +vKaYjeIsuEX6TVRUugHWudPzcEuQRLQf8ibZWjbQdBmpeQYBMg5x+xKLCJc= + + +MIICtDCCAh2gAwIBAgIJAMDbehElPNKvMA0GCSqGSIb3DQEBBQUAMIGVMQswCQYDVQQGEwJLUjEO +MAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSMw +IQYDVQQLDBpUVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEpMCcGA1UEAwwgVGl6ZW4gUHVibGlj +IERpc3RyaWJ1dG9yIFJvb3QgQ0EwHhcNMTIxMDI5MTMwMjUwWhcNMjIxMDI3MTMwMjUwWjCBjzEL +MAkGA1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6 +ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwb +VGl6ZW4gUHVibGljIERpc3RyaWJ1dG9yIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDe +OTS/3nXvkDEmsFCJIvRlQ3RKDcxdWJJp625pFqHdmoJBdV+x6jl1raGK2Y1sp2Gdvpjc/z92yzAp +bE/UVLPh/tRNZPeGhzU4ejDDm7kzdr2f7Ia0U98K+OoY12ucwg7TYNItj9is7Cj4blGfuMDzd2ah +2AgnCGlwNwV/pv+uVQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACqJ +KO33YdoGudwanZIxMdXuxnnD9R6u72ltKk1S4zPfMJJv482CRGCI4FK6djhlsI4i0Lt1SVIJEed+ +yc3qckGm19dW+4xdlkekon7pViEBWuyHw8OWv3RXtTum1+PGHjBJ2eYY4ZKIpz73U/1NC16sTB/0 +VhfnkHwPltmrpYVe + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/tizen-manifest.xml b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/tizen-manifest.xml new file mode 100644 index 0000000..e1b0576 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/bin/Debug/netcoreapp2.0/tpkroot/tizen-manifest.xml @@ -0,0 +1,9 @@ + + + + + xaapps.png + + + + diff --git a/TVApps/TVApps.Tizen.TV/shared/res/TVApps.Tizen.TV.png b/TVApps/TVApps.Tizen.TV/shared/res/TVApps.Tizen.TV.png new file mode 100644 index 0000000..9f3cb98 Binary files /dev/null and b/TVApps/TVApps.Tizen.TV/shared/res/TVApps.Tizen.TV.png differ diff --git a/TVApps/TVApps.Tizen.TV/tizen-manifest.xml b/TVApps/TVApps.Tizen.TV/tizen-manifest.xml new file mode 100644 index 0000000..e1b0576 --- /dev/null +++ b/TVApps/TVApps.Tizen.TV/tizen-manifest.xml @@ -0,0 +1,9 @@ + + + + + xaapps.png + + + + diff --git a/TVApps/TVApps.TizenTV/Properties/AssemblyInfo.cs b/TVApps/TVApps.TizenTV/Properties/AssemblyInfo.cs deleted file mode 100644 index e9b9107..0000000 --- a/TVApps/TVApps.TizenTV/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TVApps.TizenTV")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TVApps.TizenTV")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7e341bf5-b7bd-4532-9d4a-aa89537b525e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TVApps/TVApps.TizenTV/Renderer/NinePatchImageRenderer.cs b/TVApps/TVApps.TizenTV/Renderer/NinePatchImageRenderer.cs deleted file mode 100644 index f490767..0000000 --- a/TVApps/TVApps.TizenTV/Renderer/NinePatchImageRenderer.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.ComponentModel; - -using TVApps.Controls; -using TVApps.TizenTV.Renderer; -using Xamarin.Forms.Platform.Tizen; - -[assembly: ExportRenderer(typeof(NinePatchImage), typeof(NinePatchImageRenderer))] -namespace TVApps.TizenTV.Renderer -{ - /// - /// A custom renderer for NinePatchImage - /// - /// - class NinePatchImageRenderer : ImageRenderer - { - /// - /// Updates border when Element is changed - /// - /// An image element changed event's argument - protected override void OnElementChanged(ElementChangedEventArgs args) - { - base.OnElementChanged(args); - UpdateBorder(); - } - - /// - /// Updates border when ElementProperty is changed - /// - /// The source of the event - /// An image element property changed event's argument - protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs args) - { - if ((args.PropertyName == NinePatchImage.BorderBottomProperty.PropertyName) - || (args.PropertyName == NinePatchImage.BorderLeftProperty.PropertyName) - || (args.PropertyName == NinePatchImage.BorderRightProperty.PropertyName) - || (args.PropertyName == NinePatchImage.BorderTopProperty.PropertyName)) - { - UpdateBorder(); - } - - base.OnElementPropertyChanged(sender, args); - } - - /// - /// A method updates border of Control(Native Image) - /// - void UpdateBorder() - { - var img = Element as NinePatchImage; - Control.SetBorder(img.BorderLeft, img.BorderRight, img.BorderTop, img.BorderBottom); - } - - /// - /// A method updates border of Control(Native Image) after loading - /// - protected override void UpdateAfterLoading() - { - base.UpdateAfterLoading(); - UpdateBorder(); - } - } -} diff --git a/TVApps/TVApps.TizenTV/Settings.StyleCop b/TVApps/TVApps.TizenTV/Settings.StyleCop deleted file mode 100644 index 837530c..0000000 --- a/TVApps/TVApps.TizenTV/Settings.StyleCop +++ /dev/null @@ -1,722 +0,0 @@ - - - NoMerge - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - \ No newline at end of file diff --git a/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs b/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs deleted file mode 100755 index 067aef0..0000000 --- a/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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 LibTVRefCommonPortable.Utils; -using LibTVRefCommonTizen.Ports; -using Tizen.Applications; -using Tizen.Xamarin.Forms.Extension.Renderer; - -namespace TVApps.TizenTV -{ - /// - /// TV Apps application main entry point - /// - public class Program : Xamarin.Forms.Platform.Tizen.FormsApplication, IAppLifeControl - { - /// - /// The application instance - /// - private static Program instance; - - /// - /// An interface for the platform notification - /// - private IPlatformNotification notification; - - /// - /// A method will be called when application is created - /// - protected override void OnCreate() - { - base.OnCreate(); - - FileSystemPort.AppDataStroagePath = DirectoryInfo.Data; - FileSystemPort.PlatformShareStroagePath = "/opt/usr/home/owner/share/"; - - var app = new App(MainWindow.ScreenSize.Width, - MainWindow.ScreenSize.Height, - MainWindow.ScreenDpi.X, - ElmSharp.Elementary.GetScale()); - notification = app; - - DbgPort.D("-----------------------------------"); - DbgPort.D("Apps application is being loaded..."); - DbgPort.D("-----------------------------------"); - LoadApplication(app); - - PackageManagerPort.RegisterCallbacks(notification); - MainWindow.Alpha = true; - MainWindow.KeyUp += KeyUpListener; - - MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true); - MainWindow.KeyGrab("XF86Info", true); - } - - /// - /// A method will be called when application receives KeyUp event - /// - - /// The source of the event - /// A EvasKey event's argument - private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs args) - { - DebuggingUtils.Dbg("[TVApps.TizenTV.cs] Key Pressed :" + args.KeyName); - if (args.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0 || - args.KeyName.CompareTo("XF86Info") == 0) - { - notification?.OnMenuKeyPressed(); - } - } - - /// - /// A method will be called when application is terminated - /// - protected override void OnTerminate() - { - base.OnTerminate(); - - notification = null; - PackageManagerPort.UnregisterCallbacks(); - MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName); - MainWindow.KeyUngrab("XF86Info"); - } - - /// - /// A method will be called when application receives AppControl - /// - /// AppControl event argument - protected override void OnAppControlReceived(AppControlReceivedEventArgs e) - { - DbgPort.D("OnAppControlReceived, " + e.ReceivedAppControl.Operation); - - if (AppControlPort.AddAppOperation.CompareTo(e.ReceivedAppControl.Operation) == 0) - { - DbgPort.D("Add App Request"); - notification.OnPinAppRequestReceived(); - } - } - - /// - /// The entry point for the application - /// - /// A list of command line arguments - static void Main(string[] args) - { - instance = new Program(); - - DbgPort.Prefix = "Apps"; - - Xamarin.Forms.DependencyService.Register(); - Xamarin.Forms.DependencyService.Register(); - Xamarin.Forms.DependencyService.Register(); - Xamarin.Forms.DependencyService.Register(); - Xamarin.Forms.DependencyService.Register(); - Xamarin.Forms.DependencyService.Register(); - Xamarin.Forms.DependencyService.Register(); - Xamarin.Forms.DependencyService.Register(); - - Xamarin.Forms.Platform.Tizen.Forms.Init(instance); - TizenFormsExtension.Init(); - - instance.Run(args); - } - - /// - /// A method terminates application - /// - public void SelfTerminate() - { - instance.Exit(); - } - } -} diff --git a/TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj b/TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj deleted file mode 100755 index f7a4224..0000000 --- a/TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - 14.0 - Debug - AnyCPU - 8.0.30703 - 2.0 - {2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {7E341BF5-B7BD-4532-9D4A-AA89537B525E} - Exe - Properties - TVApps.TizenTV - xaapps - 512 - en-US - - - DNXCore - v5.0 - false - .NETCoreApp,Version=v1.0 - true - $(NoWarn);1701 - false - - - true - portable - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - portable - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - {67F9D3A8-F71E-4428-913F-C37AE82CDB24} - LibTVRefCommonPortable - - - {C558D279-897E-45E1-A10A-DECD788770F4} - LibTVRefCommonTizen - - - {fd8c0ef4-6cea-4421-85b7-7ac8592738c6} - TVApps - - - - - - - - <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) - <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) - true - - - - - - True - - - - - - - - \ No newline at end of file diff --git a/TVApps/TVApps.TizenTV/TVApps.TizenTV.project.json b/TVApps/TVApps.TizenTV/TVApps.TizenTV.project.json deleted file mode 100755 index af8f2d4..0000000 --- a/TVApps/TVApps.TizenTV/TVApps.TizenTV.project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "debugType": "portable", - "platform": "AnyCPU", - "preserveCompilationContext": true - }, - "dependencies": { - "ElmSharp": "1.2.2", - "Microsoft.NETCore.App": "1.1.2", - "Tizen.Applications": "1.5.8", - "Tizen.Content.MediaContent": "1.0.20", - "Tizen.Multimedia": "1.2.0", - "Tizen.Multimedia.MediaPlayer": "1.0.2", - "Tizen.Xamarin.Forms.Extension": "2.3.5-v00015", - "Xamarin.Forms": "2.4.0-r266-001", - "Xamarin.Forms.Platform.Tizen": "2.3.5-r256-001" - }, - "runtimes": { - "win": {}, - "linux": {} - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "portable-net45+wp80+win81+wpa81", - "netstandard1.6" - ] - } - } -} \ No newline at end of file diff --git a/TVApps/TVApps.TizenTV/shared/res/xaapps.png b/TVApps/TVApps.TizenTV/shared/res/xaapps.png deleted file mode 100644 index 9765b1b..0000000 Binary files a/TVApps/TVApps.TizenTV/shared/res/xaapps.png and /dev/null differ diff --git a/TVApps/TVApps.TizenTV/tizen-manifest.xml b/TVApps/TVApps.TizenTV/tizen-manifest.xml deleted file mode 100644 index 7c7a788..0000000 --- a/TVApps/TVApps.TizenTV/tizen-manifest.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - xaapps.png - - - - diff --git a/TVApps/TVApps/Controls/AppItemCell.xaml.cs b/TVApps/TVApps/Controls/AppItemCell.xaml.cs index 9e10d91..33bcd0e 100755 --- a/TVApps/TVApps/Controls/AppItemCell.xaml.cs +++ b/TVApps/TVApps/Controls/AppItemCell.xaml.cs @@ -19,7 +19,6 @@ using System; using System.ComponentModel; using System.Windows.Input; using Xamarin.Forms; -using Xamarin.Forms.PlatformConfiguration.TizenSpecific; using Tizen.Xamarin.Forms.Extension; namespace TVApps.Controls @@ -204,7 +203,7 @@ namespace TVApps.Controls ButtonTitle.PropertyChanged += ButtonTitlePropertyChanged; PropertyChanged += AppItemCellPropertyChanged; - ButtonTitle.On().SetFontWeight(FontWeight.Normal); + //ButtonTitle.On().SetFontWeight(FontWeight.Normal); } @@ -359,7 +358,6 @@ namespace TVApps.Controls ContextPopup popup = new ContextPopup { IsAutoHidingEnabled = true, - Orientation = ContextPopupOrientation.Vertical, DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Down, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Up), }; diff --git a/TVApps/TVApps/Properties/AssemblyInfo.cs b/TVApps/TVApps/Properties/AssemblyInfo.cs deleted file mode 100644 index e8bdef9..0000000 --- a/TVApps/TVApps/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Resources; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TVApps")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TVApps")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TVApps/TVApps/TVApps.csproj b/TVApps/TVApps/TVApps.csproj index 272c85a..0a45e6a 100755 --- a/TVApps/TVApps/TVApps.csproj +++ b/TVApps/TVApps/TVApps.csproj @@ -1,133 +1,16 @@ - - + + - Debug - AnyCPU - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {FD8C0EF4-6CEA-4421-85B7-7AC8592738C6} - Library - TVApps - TVApps - v4.5 - Profile259 - 10.0 - - + netstandard2.0 - - true - portable - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - portable - true - bin\Release\ - TRACE - prompt - 4 - false - - - - AppItemCell.xaml - - - AppListView.xaml - - - NinePatchImage.xaml - - - - - - - - - - - - FooterDeleteStatus.xaml - - - FooterNormalStatus.xaml - - - FooterPinStatus.xaml - - - MainPage.xaml - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - MSBuild:UpdateDesignTimeXaml - Designer - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - {67f9d3a8-f71e-4428-913f-c37ae82cdb24} - LibTVRefCommonPortable - - + - - 2.3.5-v00015 - - - 2.4.0-r266-001 - + + + - + - - - - - \ No newline at end of file + + diff --git a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs index bbfb62c..766699a 100755 --- a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs @@ -192,7 +192,6 @@ namespace TVApps.Views ContextPopup popup = new ContextPopup { IsAutoHidingEnabled = true, - Orientation = ContextPopupOrientation.Vertical, DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Down), }; diff --git a/TVApps/TVApps/Views/FooterPinStatus.xaml.cs b/TVApps/TVApps/Views/FooterPinStatus.xaml.cs index 25a7db0..95d2480 100755 --- a/TVApps/TVApps/Views/FooterPinStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterPinStatus.xaml.cs @@ -16,7 +16,6 @@ using LibTVRefCommonPortable.Utils; using Xamarin.Forms; -using Xamarin.Forms.PlatformConfiguration.TizenSpecific; namespace TVApps.Views { @@ -146,7 +145,7 @@ namespace TVApps.Views Opacity = 0.7, HorizontalTextAlignment = TextAlignment.Start, }; - AppNameLabel.On().SetFontWeight(FontWeight.Medium); + //AppNameLabel.On().SetFontWeight(FontWeight.Medium); AfterLabel = new Xamarin.Forms.Label() { @@ -157,7 +156,7 @@ namespace TVApps.Views Opacity = 0.7, HorizontalTextAlignment = TextAlignment.Start }; - AfterLabel.On().SetFontWeight(FontWeight.Light); + //AfterLabel.On().SetFontWeight(FontWeight.Light); PropertyChanged += FooterPinStatusPropertyChanged; } diff --git a/TVApps/TVApps/Views/MainPage.xaml.cs b/TVApps/TVApps/Views/MainPage.xaml.cs index 937e68f..c2f359a 100755 --- a/TVApps/TVApps/Views/MainPage.xaml.cs +++ b/TVApps/TVApps/Views/MainPage.xaml.cs @@ -24,7 +24,6 @@ using System.Threading.Tasks; using System.Windows.Input; using System.Collections.Generic; using System.Linq; -using Xamarin.Forms.PlatformConfiguration.TizenSpecific; using Tizen.Xamarin.Forms.Extension; namespace TVApps.Views @@ -159,7 +158,7 @@ namespace TVApps.Views BackKeyInfoImage.HeightRequest = backKeyImageSize; BackKeyInfo.FontSize = SizeUtils.GetFontSize(28); BackKeyInfo.Margin = new Thickness(SizeUtils.GetWidthSize(6), 0, 0, 0); - BackKeyInfo.On().SetFontWeight(FontWeight.Normal); + //BackKeyInfo.On().SetFontWeight(FontWeight.Normal); PropertyChanged += MainPagePropertyChanged; SetCurrentStatus(AppsStatus.Default); @@ -238,20 +237,20 @@ namespace TVApps.Views if (i == 1) { - prevButton?.On()?.SetNextFocusDownView( - lowerList[i - 1].FindByName