diff options
41 files changed, 23 insertions, 2480 deletions
diff --git a/LibCommon.Shared/DataModels/AppControlAction.cs b/LibCommon.Shared/DataModels/AppControlAction.cs index e30afe4..72240e3 100644..100755 --- a/LibCommon.Shared/DataModels/AppControlAction.cs +++ b/LibCommon.Shared/DataModels/AppControlAction.cs @@ -14,7 +14,6 @@ * limitations under the License. */ -using System; using LibTVRefCommonPortable.Utils; using System.Collections.Generic; diff --git a/LibCommon.Shared/DataModels/AppShortcutInfo.cs b/LibCommon.Shared/DataModels/AppShortcutInfo.cs index 7aeff96..16eae2f 100644..100755 --- a/LibCommon.Shared/DataModels/AppShortcutInfo.cs +++ b/LibCommon.Shared/DataModels/AppShortcutInfo.cs @@ -14,7 +14,6 @@ * limitations under the License. */ -using LibTVRefCommonPortable.Utils; using System; using System.Xml.Serialization; using Xamarin.Forms; diff --git a/LibCommon.Shared/DataModels/IEnumerableItem.cs b/LibCommon.Shared/DataModels/IEnumerableItem.cs deleted file mode 100644 index efcfd2b..0000000 --- a/LibCommon.Shared/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<int, string> ItemProperties - { - set; - get; - } - - } -} diff --git a/LibCommon.Shared/DataModels/MediaControlAction.cs b/LibCommon.Shared/DataModels/MediaControlAction.cs deleted file mode 100644 index 440fcfb..0000000 --- a/LibCommon.Shared/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 -{ - /// <summary> - /// A Media ControlAction. - /// </summary> - class MediaControlAction : AppControlAction - { - /// <summary> - /// A file URI to be open - /// </summary> - public string FileUri { get; set; } - - /// <summary> - /// A method execute a action. - /// </summary> - /// <returns>A next statue of a Shortcut.</returns> - 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 deleted file mode 100644 index 6dd61b2..0000000 --- a/LibCommon.Shared/DataModels/RecentShortcutInfo.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.Collections; - -namespace LibTVRefCommonPortable.DataModels -{ - /// <summary> - /// A Recent Shortcut information - /// </summary> - public class RecentShortcutInfo : ShortcutInfo, IComparable - { - /// <summary> - /// An Id for the content of the shortcut - /// </summary> - public string Id { get; set; } - /// <summary> - /// A Last used Time - /// </summary> - public DateTime Date { get; set; } - - /// <summary> - /// A Screenshot image path - /// </summary> - public string ScreenshotPath { get; set; } - - /// <summary> - /// Initialize State of a shortcut. - /// </summary> - 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 index fd355d2..26b508a 100644..100755 --- a/LibCommon.Shared/DataModels/SettingShortcutInfo.cs +++ b/LibCommon.Shared/DataModels/SettingShortcutInfo.cs @@ -14,7 +14,6 @@ * limitations under the License. */ -using System; namespace LibTVRefCommonPortable.DataModels { diff --git a/LibCommon.Shared/Models/ManagedApps.cs b/LibCommon.Shared/Models/ManagedApps.cs index b6b00b1..af9f1d0 100644..100755 --- a/LibCommon.Shared/Models/ManagedApps.cs +++ b/LibCommon.Shared/Models/ManagedApps.cs @@ -14,11 +14,6 @@ * limitations under the License. */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LibTVRefCommonPortable.Models { @@ -93,28 +88,5 @@ namespace LibTVRefCommonPortable.Models return false; } - - /// <summary> - /// Checks application have to be hidden at recently used application - /// </summary> - /// <param name="appID">Application id for checking</param> - /// <returns>If the application have to be hidden, return 'true'</returns> - 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 deleted file mode 100644 index 4fa5a06..0000000 --- a/LibCommon.Shared/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 -{ - /// <summary> - /// 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. - /// </summary> - public class RecentShortcutController - { - /// <summary> - /// A method removes a Recent Shortcut. - /// </summary> - /// <param name="appId">a Recent Shortcut's appId to be removed.</param> - public void Remove(string appId) - { - RecentShortcutStorage.Delete(appId); - } - - /// <summary> - /// A method removes all Recent Shortcuts. - /// </summary> - public void RemoveAll() - { - RecentShortcutStorage.DeleteAll(); - } - - /// <summary> - /// A method provides a Recent Shortcut list. - /// </summary> - /// <returns>A Recent Shortcut list.</returns> - public IEnumerable<RecentShortcutInfo> GetList() - { - return RecentShortcutStorage.Read(); - } - } -} diff --git a/LibCommon.Shared/Stubs/ApplicationManagerAPITestStub.cs b/LibCommon.Shared/Stubs/ApplicationManagerAPITestStub.cs index 082dc66..e0b5953 100644..100755 --- a/LibCommon.Shared/Stubs/ApplicationManagerAPITestStub.cs +++ b/LibCommon.Shared/Stubs/ApplicationManagerAPITestStub.cs @@ -27,23 +27,6 @@ namespace LibTVRefCommonPortable.Stubs public class ApplicationManagerAPITestStub : IApplicationManagerAPIs { /// <summary> - /// A method for removing all recent applications - /// </summary> - public void DeleteAllRecentApplication() - { - throw new NotImplementedException(); - } - - /// <summary> - /// A method for removing the specified recent application - /// </summary> - /// <param name="appId">An application ID</param> - public void DeleteRecentApplication(string appId) - { - throw new NotImplementedException(); - } - - /// <summary> /// A method provides installed application list. /// </summary> /// <returns>An installed application list</returns> @@ -162,89 +145,5 @@ namespace LibTVRefCommonPortable.Stubs InstalledTime = DateUtils.GetRandomDate(), }; } - - /// <summary> - /// A method provides a recent application list. - /// </summary> - /// <returns>A Recent application list.</returns> - public IEnumerable<RecentApp> GetRecentApplications() - { - IList<RecentApp> testData = new List<RecentApp>(); - - 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/MediaContentAPITestStub.cs b/LibCommon.Shared/Stubs/MediaContentAPITestStub.cs deleted file mode 100644 index 2eeefb9..0000000 --- a/LibCommon.Shared/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 -{ - /// <summary> - /// A unit testing stub for MediaContentUtils - /// </summary> - public class MediaContentAPITestStub : IMediaContentAPIs - { - /// <summary> - /// A method for getting recently played media content list - /// </summary> - /// <param name="limitation">Maximum count of list</param> - /// <returns>The recently played media content list</returns> - public IEnumerable<RecentlyPlayedMedia> GetRecentlyPlayedMedia(int limitation) - { - IList<RecentlyPlayedMedia> recentlyPlayed = new List<RecentlyPlayedMedia>(); - - 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/ApplicationManagerUtils.cs b/LibCommon.Shared/Utils/ApplicationManagerUtils.cs index 138d211..b0eb7c5 100644..100755 --- a/LibCommon.Shared/Utils/ApplicationManagerUtils.cs +++ b/LibCommon.Shared/Utils/ApplicationManagerUtils.cs @@ -69,33 +69,6 @@ namespace LibTVRefCommonPortable.Utils } /// <summary> - /// A method for removing all recent applications - /// </summary> - public void DeleteAllRecentApplication() - { - applicationManagerAPIs.DeleteAllRecentApplication(); - } - - /// <summary> - /// A method for removing the specified recent application - /// </summary> - /// <param name="appId">An application ID</param> - public void DeleteRecentApplication(string appId) - { - applicationManagerAPIs.DeleteRecentApplication(appId); - } - - - /// <summary> - /// Gets the information of the recent applications - /// </summary> - /// <returns>The list of the recent applications</returns> - public IEnumerable<RecentApp> GetRecentApplications() - { - return applicationManagerAPIs.GetRecentApplications(); - } - - /// <summary> /// Gets the information of the specified application with the app ID /// </summary> /// <param name="appID">The app Id to get</param> diff --git a/LibCommon.Shared/Utils/IApplicationManagerAPIs.cs b/LibCommon.Shared/Utils/IApplicationManagerAPIs.cs index c8521b9..06abeb6 100644..100755 --- a/LibCommon.Shared/Utils/IApplicationManagerAPIs.cs +++ b/LibCommon.Shared/Utils/IApplicationManagerAPIs.cs @@ -21,52 +21,6 @@ using System.Threading.Tasks; namespace LibTVRefCommonPortable.Utils { /// <summary> - /// A class to store RecentApp information. - /// </summary> - public class RecentApp - { - /// <summary> - /// A Recent instance ID - /// </summary> - public String InstanceID; - - /// <summary> - /// A Recent instance label - /// </summary> - public String InstanceLabel; - - /// <summary> - /// An app ID - /// </summary> - public String AppID; - - /// <summary> - /// An app label - /// </summary> - public String Applabel; - - /// <summary> - /// An app icon path - /// </summary> - public String IconPath; - - /// <summary> - /// A last launched date - /// </summary> - public DateTime LaunchedTime; - - /// <summary> - /// A URI of accessible content if the Recent is a content. - /// </summary> - public String Uri; - - /// <summary> - /// A File Path of screenshot of the recent app or recent content. - /// </summary> - public String ScreenShot; - } - - /// <summary> /// A class to store installed app information. /// </summary> public class InstalledApp @@ -104,12 +58,6 @@ namespace LibTVRefCommonPortable.Utils Task<IEnumerable<InstalledApp>> GetAllInstalledApplication(); /// <summary> - /// A method provides a recent application list. - /// </summary> - /// <returns>A Recent application list.</returns> - IEnumerable<RecentApp> GetRecentApplications(); - - /// <summary> /// A method provides application information which is matched with the given app ID. /// </summary> /// <param name="applicationId">An application ID</param> @@ -117,17 +65,6 @@ namespace LibTVRefCommonPortable.Utils InstalledApp GetInstalledApplication(string applicationId); /// <summary> - /// A method for removing all recent applications - /// </summary> - void DeleteAllRecentApplication(); - - /// <summary> - /// A method for removing the specified recent application - /// </summary> - /// <param name="appId">An application ID</param> - void DeleteRecentApplication(string appId); - - /// <summary> /// Checks whether application is removable /// </summary> /// <param name="appID">The app ID to get</param> diff --git a/LibCommon.Shared/Utils/IMediaContentAPIs.cs b/LibCommon.Shared/Utils/IMediaContentAPIs.cs deleted file mode 100644 index a0b26a9..0000000 --- a/LibCommon.Shared/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 -{ - /// <summary> - /// An information of recently played media content - /// </summary> - public struct RecentlyPlayedMedia - { - /// <summary> - /// An ID of media content - /// </summary> - public string MediaId; - - /// <summary> - /// A path of media content thumbnail - /// </summary> - public string ThumbnailPath; - - /// <summary> - /// A path of media content - /// </summary> - public string FilePath; - - /// <summary> - /// A title of media content - /// </summary> - public string DisplayName; - - /// <summary> - /// Last played time of media content - /// </summary> - public DateTime PlayedAt; - } - - /// <summary> - /// An interface for getting recently played media contents. - /// </summary> - public interface IMediaContentAPIs - { - /// <summary> - /// A method for getting recently played media content list - /// </summary> - /// <param name="limitation">Maximum count of list</param> - /// <returns>The recently played media content list</returns> - IEnumerable<RecentlyPlayedMedia> GetRecentlyPlayedMedia(int limitation); - } -} diff --git a/LibCommon.Shared/Utils/IStatePublisher.cs b/LibCommon.Shared/Utils/IStatePublisher.cs index 0c3605d..ddeee6a 100644..100755 --- a/LibCommon.Shared/Utils/IStatePublisher.cs +++ b/LibCommon.Shared/Utils/IStatePublisher.cs @@ -14,20 +14,14 @@ * 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, + HomeInitialized, HomeMainPanelAppsFocused, HomeMainPanelSettingsFocused, - HomeSubPanelRecentFocused, HomeSubPanelAppsFocused, HomeSubPanelSettingsFocused, HomeShowOptions, diff --git a/LibCommon.Shared/Utils/IStateSubscriber.cs b/LibCommon.Shared/Utils/IStateSubscriber.cs index bb59eb7..f2ffbef 100644..100755 --- a/LibCommon.Shared/Utils/IStateSubscriber.cs +++ b/LibCommon.Shared/Utils/IStateSubscriber.cs @@ -14,11 +14,6 @@ * limitations under the License. */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LibTVRefCommonPortable.Utils { diff --git a/LibCommon.Shared/Utils/ITVHome.cs b/LibCommon.Shared/Utils/ITVHome.cs index c7c6f69..b227862 100644..100755 --- a/LibCommon.Shared/Utils/ITVHome.cs +++ b/LibCommon.Shared/Utils/ITVHome.cs @@ -35,14 +35,5 @@ namespace LibTVRefCommonPortable.Utils { get; } - - /// <summary> - /// An instance of the RecentShortcutController - /// </summary> - /// <see cref="RecentShortcutController"/> - RecentShortcutController RecentShortcutControllerInstance - { - get; - } } } diff --git a/LibCommon.Shared/Utils/MediaContentUtils.cs b/LibCommon.Shared/Utils/MediaContentUtils.cs deleted file mode 100644 index 9d56eb2..0000000 --- a/LibCommon.Shared/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 -{ - /// <summary> - /// A class provides media contents and related functions. - /// </summary> - public class MediaContentUtils - { - /// <summary> - /// A instance of IMediaContentAPIs port. - /// </summary> - private static IMediaContentAPIs mediaContentAPIs; - - /// <summary> - /// A instance of MediaContentUtils - /// </summary> - private static readonly MediaContentUtils instance = new MediaContentUtils(); - - /// <summary> - /// A property of MediaContentUtils instance. - /// </summary> - public static MediaContentUtils Instance - { - get - { - return instance; - } - } - - /// <summary> - /// A Constructor - /// </summary> - private MediaContentUtils() - { - mediaContentAPIs = new MediaContentAPITestStub(); - - try - { - if (DependencyService.Get<IMediaContentAPIs>() != null) - { - mediaContentAPIs = DependencyService.Get<IMediaContentAPIs>(); - } - } - catch (InvalidOperationException e) - { - DebuggingUtils.Err(e.Message); - } - } - - /// <summary> - /// A method provides media playing history. - /// </summary> - /// <param name="limitation">A number of getting media playing history</param> - /// <returns>A list of played medias.</returns> - public IEnumerable<RecentlyPlayedMedia> GetRecentlyPlayedMedia(int limitation) - { - return mediaContentAPIs.GetRecentlyPlayedMedia(limitation); - } - - } -} diff --git a/LibCommon.Shared/Utils/RecentShortcutStorage.cs b/LibCommon.Shared/Utils/RecentShortcutStorage.cs deleted file mode 100644 index d781e2f..0000000 --- a/LibCommon.Shared/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 -{ - /// <summary> - /// A class to manage the Recent Shortcuts. - /// </summary> - public sealed class RecentShortcutStorage - { - /// <summary> - /// A maximum number of recent apps and contents - /// </summary> - private static readonly int MaxRecents = 10; - - /// <summary> - /// A method provides all Recent Shortcuts' information list. - /// </summary> - /// <returns>a Recent Shortcut information list.</returns> - public static IEnumerable<RecentShortcutInfo> Read() - { - List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>(); - IEnumerable<RecentApp> 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.ShortcutType = ShortcutType.Application; - recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); - recentShortcutInfo.CurrentStateDescription = defaultStateDescription; - recentShortcutInfo.Id = item.AppID; - recentShortcutInfo.Date = item.LaunchedTime; - recentShortcutInfoList.Add(recentShortcutInfo); - } - } - - IEnumerable<RecentlyPlayedMedia> 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.ShortcutType = ShortcutType.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; - } - - /// <summary> - /// A method deletes a Recent Shortcut. - /// </summary> - /// <param name="appId">An application ID</param> - public static void Delete(string appId) - { - ApplicationManagerUtils.Instance.DeleteRecentApplication(appId); - } - - /// <summary> - /// A method deletes all Recent Shortcuts. - /// </summary> - public static void DeleteAll() - { - ApplicationManagerUtils.Instance.DeleteAllRecentApplication(); - } - } -} diff --git a/LibCommon.Shared/Utils/TVHomeImpl.cs b/LibCommon.Shared/Utils/TVHomeImpl.cs index 01cd0f2..41a9fe7 100644..100755 --- a/LibCommon.Shared/Utils/TVHomeImpl.cs +++ b/LibCommon.Shared/Utils/TVHomeImpl.cs @@ -21,11 +21,10 @@ namespace LibTVRefCommonPortable.Utils /// <summary> /// 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 + /// such as the AppShortcutController and the SettingShortcutcontroller /// that are providing major functions related with TVHome, TVApps using scenarios. /// </summary> /// <see cref="AppShortcutController"/> - /// <see cref="RecentShortcutController"/> /// <see cref="SettingShortcutController"/> public class TVHomeImpl : ITVHome { @@ -65,17 +64,5 @@ namespace LibTVRefCommonPortable.Utils return appShortcutController; } } - - /// <summary> - /// An instance of the RecentShortcutController - /// </summary> - private static readonly RecentShortcutController recentShortcutController = new RecentShortcutController(); - public RecentShortcutController RecentShortcutControllerInstance - { - get - { - return recentShortcutController; - } - } } } diff --git a/LibCommon.Tizen/Ports/ApplicationManagerPort.cs b/LibCommon.Tizen/Ports/ApplicationManagerPort.cs index 29511ef..d4083d3 100644..100755 --- a/LibCommon.Tizen/Ports/ApplicationManagerPort.cs +++ b/LibCommon.Tizen/Ports/ApplicationManagerPort.cs @@ -57,84 +57,6 @@ namespace LibTVRefCommonTizen.Ports } /// <summary> - /// Clears all recent applications - /// </summary> - public void DeleteAllRecentApplication() - { - RecentApplicationControl.DeleteAll(); - } - - /// <summary> - /// Removes the specified application with the app ID - /// </summary> - /// <param name="appId">An application ID that is removed</param> - public void DeleteRecentApplication(string appId) - { - IEnumerable<RecentApplicationInfo> recentApps = ApplicationManager.GetRecentApplications(); - string pkgId = PackageManager.GetPackageIdByApplicationId(appId); - - foreach (var item in recentApps) - { - if (item.PackageId.Equals(pkgId)) - { - RecentApplicationControl controller = item.Controller; - controller.Delete(); - } - } - } - - /// <summary> - /// Gets the information of the recent applications - /// </summary> - /// <returns>The list of the recent applications</returns> - public IEnumerable<RecentApp> GetRecentApplications() - { - bool isNoRecentApps = true; - List<RecentApp> resultList = new List<RecentApp>(); - - try - { - IEnumerable<RecentApplicationInfo> 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; - } - - /// <summary> /// Gets the information of the specified application with the app ID /// </summary> /// <param name="appID">The app Id to get</param> diff --git a/LibCommon.Tizen/Ports/MediaContentPort.cs b/LibCommon.Tizen/Ports/MediaContentPort.cs deleted file mode 100644 index bd41cc4..0000000 --- a/LibCommon.Tizen/Ports/MediaContentPort.cs +++ /dev/null @@ -1,88 +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 -{ - /// <summary> - /// Handles the MediaContent APIs - /// </summary> - public class MediaContentPort : IMediaContentAPIs - { - private MediaDatabase mediaDatabase; - private MediaInfoCommand mediaInfoCommand; - /// <summary> - /// The constructor of this class - /// Connects content database - /// </summary> - public MediaContentPort() - { - DbgPort.D("MediaContentPort"); - mediaDatabase = new MediaDatabase(); - mediaDatabase.Connect(); - mediaInfoCommand = new MediaInfoCommand(mediaDatabase); - } - - /// <summary> - /// A method for getting recently played media content list - /// </summary> - /// <param name="limitation">Maximum count of list</param> - /// <returns>The recently played media content list</returns> - public IEnumerable<RecentlyPlayedMedia> GetRecentlyPlayedMedia(int limitation) - { - var recentlyPlayedVideos = new List<RecentlyPlayedMedia>(); - 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<VideoInfo> mediaInformations = new List<VideoInfo>(); - - 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 index 4004d1d..a2535cd 100644..100755 --- a/LibCommon.Tizen/Ports/PackageManagerPort.cs +++ b/LibCommon.Tizen/Ports/PackageManagerPort.cs @@ -51,8 +51,8 @@ namespace LibTVRefCommonTizen.Ports public static void RegisterCallbacks(IPlatformNotification app) { Notification = app; - PackageManager.InstallProgressChanged += PackageManager_InstallProgressChanged; - PackageManager.UninstallProgressChanged += PackageManager_UninstallProgressChanged; + PackageManager.InstallProgressChanged += PackageManagerInstallProgressChanged; + PackageManager.UninstallProgressChanged += PackageManagerUninstallProgressChanged; } /// <summary> @@ -61,8 +61,8 @@ namespace LibTVRefCommonTizen.Ports public static void UnregisterCallbacks() { Notification = null; - PackageManager.InstallProgressChanged -= PackageManager_InstallProgressChanged; - PackageManager.UninstallProgressChanged -= PackageManager_UninstallProgressChanged; + PackageManager.InstallProgressChanged -= PackageManagerInstallProgressChanged; + PackageManager.UninstallProgressChanged -= PackageManagerUninstallProgressChanged; } /// <summary> @@ -71,7 +71,7 @@ namespace LibTVRefCommonTizen.Ports /// </summary> /// <param name="sender">The source of the event</param> /// <param name="e">An object that contains no event data</param> - private static void PackageManager_UninstallProgressChanged(object sender, PackageManagerEventArgs e) + private static void PackageManagerUninstallProgressChanged(object sender, PackageManagerEventArgs e) { if (e.State == PackageEventState.Completed) { @@ -88,7 +88,7 @@ namespace LibTVRefCommonTizen.Ports /// </summary> /// <param name="sender">The source of the event</param> /// <param name="e">An object that contains no event data</param> - private static void PackageManager_InstallProgressChanged(object sender, PackageManagerEventArgs e) + private static void PackageManagerInstallProgressChanged(object sender, PackageManagerEventArgs e) { if (e.State == PackageEventState.Completed) { diff --git a/TVHome/TVHome.Tizen.TV/Sniper.cs b/TVHome/TVHome.Tizen.TV/Sniper.cs deleted file mode 100755 index db8799c..0000000 --- a/TVHome/TVHome.Tizen.TV/Sniper.cs +++ /dev/null @@ -1,329 +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 System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Tizen; - -namespace CoreApp -{ - /// <summary> - /// Handles recent screen shot of launched applications - /// </summary> - public class Sniper - { - /// <summary> - /// Main window of the application - /// </summary> - private IntPtr nativeWindow; - - /// <summary> - /// A path of storage for recent screen shot of launched application - /// </summary> - private string storagePath; - - /// <summary> - /// A width of recent screen shot - /// </summary> - private int imageWidth; - - /// <summary> - /// A height of recent screen shot - /// </summary> - private int imageHeight; - - /// <summary> - /// A flag indicates whether updating recent screen shot or not - /// </summary> - public bool SkipUpdateFlag; - - /// <summary> - /// Callbacks of sniper events - /// </summary> - private static InterOp.SniperCallback callbacks; - - /// <summary> - /// A EventHandler handles recent screen shot update event - /// </summary> - public event EventHandler<Event> UpdatedEvent; - - /// <summary> - /// A EventHandler handles add or remove application - /// </summary> - public event EventHandler<Event> AddRemoveEvent; - - /// <summary> - /// A EventHandler handles skip update event - /// </summary> - public event EventHandler<Event> SkipUpdateEvent; - - /// <summary> - /// A event argument class for app screen update notification. - /// </summary> - public class Event : EventArgs - { - public string AppId; - public string InstanceId; - public string Info; - } - - /// <summary> - /// A method for writing debug log - /// </summary> - /// <param name="message">A log message</param> - /// <param name="file">A path of caller file</param> - /// <param name="func">A name of caller function</param> - /// <param name="line">A line number of caller line</param> - private void WriteLog(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) - { - Log.Debug("sniper", message); - } - - /// <summary> - /// A method for handling launched application - /// </summary> - /// <param name="appId">An ID of launched application</param> - /// <param name="instanceId">An instance ID of launched application</param> - private void AddedCallback(string appId, string instanceId) - { - EventHandler<Event> handler = AddRemoveEvent; - Event eventInfo; - - WriteLog("Added " + appId + " " + instanceId); - - if (handler == null) - { - return; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("Updated Exception : " + e.Message); - return; - } - - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - eventInfo.Info = "Added"; - - handler(this, eventInfo); - } - - /// <summary> - /// A method for handling terminated application - /// </summary> - /// <param name="appId">An ID of terminated application</param> - /// <param name="instanceId">An instance ID of terminated application</param> - private void RemovedCallback(string appId, string instanceId) - { - EventHandler<Event> handler = AddRemoveEvent; - Event eventInfo; - - WriteLog("Removed " + appId + " " + instanceId); - - if (handler == null) - { - return; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("Updated Exception : " + e.Message); - return; - } - - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - eventInfo.Info = "Removed"; - - handler(this, eventInfo); - } - - /// <summary> - /// A method for handling application screen is updated - /// </summary> - /// <param name="appId">An ID of application that screen is updated</param> - /// <param name="instanceId">An instance ID of application that screen is updated</param> - /// <param name="Filename">A path of application screen shot</param> - private void UpdatedCallback(string appId, string instanceId, string Filename) - { - EventHandler<Event> handler = UpdatedEvent; - Event eventInfo; - - WriteLog("Updated " + appId + " " + instanceId + " " + Filename); - - if (handler == null) - { - return; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("Updated Exception : " + e.Message); - return; - } - - eventInfo.Info = Filename; - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - - handler(this, eventInfo); - } - - /// <summary> - /// A method for handling screen update is skipped - /// </summary> - /// <param name="appId">An ID of application that screen update is skipped</param> - /// <param name="instanceId">An instance ID of application that screen update is skipped</param> - /// <param name="Filename">A path of application screen shot</param> - /// <returns>Returns finish code</returns> - private int SkipUpdateCallback(string appId, string instanceId, string Filename) - { - EventHandler<Event> handler = SkipUpdateEvent; - Event eventInfo; - - WriteLog("SkipUpdate" + appId + " " + instanceId + " " + Filename); - - if (handler == null) - { - return 0; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("SkipUpdated Exception : " + e.Message); - return 0; - } - - eventInfo.Info = Filename; - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - - handler(this, eventInfo); - - if (SkipUpdateFlag) - { - WriteLog("Update is skipped : " + Filename); - SkipUpdateFlag = false; - return 1; - } - - return 0; - } - - /// <summary> - /// Constructor - /// </summary> - /// <param name="window">Main window of this application</param> - /// <param name="path">Storage path</param> - /// <param name="width">Screen shot width</param> - /// <param name="height">Screen shot height</param> - public Sniper(IntPtr window, string path, int width, int height) - { - nativeWindow = window; - storagePath = path; - imageWidth = width; - imageHeight = height; - SkipUpdateFlag = false; - } - - /// <summary> - /// A method for starting monitoring - /// Adds callbacks and initialize Sniper class - /// </summary> - public void StartMonitor() - { - try - { - callbacks = new InterOp.SniperCallback(); - callbacks.Added = new InterOp.CallbackAddedRemoved(AddedCallback); - callbacks.Removed = new InterOp.CallbackAddedRemoved(RemovedCallback); - callbacks.Updated = new InterOp.CallbackUpdated(UpdatedCallback); - callbacks.SkipUpdate = new InterOp.CallbackSkipUpdate(SkipUpdateCallback); - } - catch (Exception e) - { - throw new SniperException(e.Message); - } - - try - { - InterOp.sniper_init(nativeWindow, callbacks, storagePath, imageWidth, imageHeight); - } - catch (DllNotFoundException e) - { - WriteLog("Loadable library is not found " + e.StackTrace); - } - - WriteLog("Sniper starts monitoring : " + storagePath + "ImageSize : " + imageWidth + "x" + imageHeight); - } - - /// <summary> - /// A method stops monitoring - /// </summary> - public void StopMonitor() - { - try - { - InterOp.sniper_fini(); - } - catch (DllNotFoundException e) - { - WriteLog("Loadable library is not found " + e.StackTrace); - } - - WriteLog("Sniper stops monitoring : " + storagePath + "ImageSize : " + imageWidth + "x" + imageHeight); - } - - /// <summary> - /// A method requests updating application screen shot - /// </summary> - /// <param name="instanceId">An instance ID of application</param> - public void RequestUpdate(string instanceId) - { - try - { - InterOp.sniper_request_update(instanceId); - } - catch (DllNotFoundException e) - { - WriteLog("Loadable library is not found " + e.StackTrace); - } - - WriteLog("Sniper requests update (" + instanceId + ") : " + storagePath + "ImageSize : " + imageWidth + "x" + imageHeight); - } - } -} - -/* End of a file */ diff --git a/TVHome/TVHome.Tizen.TV/SniperException.cs b/TVHome/TVHome.Tizen.TV/SniperException.cs deleted file mode 100755 index ab2d391..0000000 --- a/TVHome/TVHome.Tizen.TV/SniperException.cs +++ /dev/null @@ -1,39 +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 CoreApp -{ - public class SniperException : Exception - { - public SniperException() - { - } - - public SniperException(string message) - : base(message) - { - } - - public SniperException(string message, Exception inner) - : base(message, inner) - { - } - } -} - -/* End of a file */ diff --git a/TVHome/TVHome.Tizen.TV/SniperInterOp.cs b/TVHome/TVHome.Tizen.TV/SniperInterOp.cs deleted file mode 100755 index aa7e936..0000000 --- a/TVHome/TVHome.Tizen.TV/SniperInterOp.cs +++ /dev/null @@ -1,54 +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; - -namespace CoreApp -{ - /// <summary> - /// Sniper InterOp class for getting application's screen-shot. - /// </summary> - internal static partial class InterOp - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CallbackAddedRemoved(string appId, string instanceId); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CallbackUpdated(string appId, string instanceId, string filename); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int CallbackSkipUpdate(string appid, string instanceId, string filename); - - [StructLayout(LayoutKind.Sequential)] - public struct SniperCallback - { - public CallbackAddedRemoved Added; - public CallbackAddedRemoved Removed; - public CallbackUpdated Updated; - public CallbackSkipUpdate SkipUpdate; - } - - [DllImport("sniper", CharSet = CharSet.Ansi)] - internal static extern int sniper_init(IntPtr win, SniperCallback callbacks, string path, int w, int h); - - [DllImport("sniper", CharSet = CharSet.Ansi)] - internal static extern int sniper_request_update(string instanceId); - - [DllImport("sniper", CharSet = CharSet.Ansi)] - internal static extern int sniper_fini(); - } -} - -/* End of a file */ diff --git a/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs b/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs index 78845d8..4cb7007 100644..100755 --- a/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs +++ b/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs @@ -18,8 +18,6 @@ using Tizen.Applications; using LibTVRefCommonPortable.Utils; using LibTVRefCommonTizen.Ports; using Tizen.Xamarin.Forms.Extension.Renderer; -using CoreApp; -using System; namespace TVHome.TizenTV { @@ -78,36 +76,6 @@ namespace TVHome.TizenTV MainWindow.KeyGrab("Left", false); MainWindow.KeyGrab("Right", false); windowPort.SetKeyGrabExclusively(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName); - - /// Sniper - try - { - Sniper sniper = new Sniper((IntPtr)MainWindow, platformShareStoragePath, 960, 540); - sniper.UpdatedEvent += OnScreenUpdate; - sniper.AddRemoveEvent += SniperAddRemoveEvent; - sniper.SkipUpdateEvent += SniperSkipUpdateEvent; - sniper.StartMonitor(); - } - catch (SniperException e) - { - DbgPort.E("Failed to create sniper object : " + e.Message); - } - } - - private void SniperSkipUpdateEvent(object sender, Sniper.Event e) - { - DbgPort.D(" [Sniper SkipUpdateEvent] : " + e.Info); - (sender as Sniper).SkipUpdateFlag = true; - } - - private void SniperAddRemoveEvent(object sender, Sniper.Event e) - { - DbgPort.D(" [Sniper SniperAddRemoveEvent] : " + e.Info); - } - - private void OnScreenUpdate(object sender, Sniper.Event e) - { - DbgPort.D(" [Sniper OnScreenUpdate] : " + e.Info); } /// <summary> @@ -190,7 +158,6 @@ namespace TVHome.TizenTV global::Xamarin.Forms.DependencyService.Register<FileSystemPort>(); global::Xamarin.Forms.DependencyService.Register<WindowPort>(); global::Xamarin.Forms.DependencyService.Register<SystemSettingsPort>(); - global::Xamarin.Forms.DependencyService.Register<MediaContentPort>(); TizenFormsExtension.Init(); global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); app.Run(args); diff --git a/TVHome/TVHome/Controls/PanelButton.cs b/TVHome/TVHome/Controls/PanelButton.cs index 35e735d..21a697f 100755 --- a/TVHome/TVHome/Controls/PanelButton.cs +++ b/TVHome/TVHome/Controls/PanelButton.cs @@ -132,16 +132,6 @@ namespace TVHome.Controls public ICommand OnUnpinCommand { get; set; } /// <summary> - /// A Command will be executed the recent is removed. - /// </summary> - public ICommand OnClearCommand { get; set; } - - /// <summary> - /// A Command will be executed the all recent are cleared. - /// </summary> - public ICommand OnClearAllCommand { get; set; } - - /// <summary> /// A Command changes Panel Button to default mode. /// </summary> public ICommand OnDefaultModeCommand { get; set; } diff --git a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml b/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml deleted file mode 100755 index 7d2a541..0000000 --- a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Controls:PanelButton xmlns="http://xamarin.com/schemas/2014/forms" - xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:Controls="clr-namespace:TVHome.Controls" - x:Class="TVHome.Controls.SubPanelThumbnailButton"> - <Image x:Name="ThumbnailImage" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - Source="{Binding ScreenshotPath}" /> - <Controls:NinePatchImage x:Name="ThumbnailGradient" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - Aspect="Fill" - BorderTop="2" - BorderBottom="2" - BorderLeft="1" - BorderRight="1" - Source="ic_list_thumbnail_gradient_normal.9.png" /> - <Image x:Name="ThumbnailIcon" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.043}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.689}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.131}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.233}" - Source="{Binding CurrentStateDescription.IconPath}" /> - <Label x:Name="ThumbnailTitle" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.206}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.722}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.75}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.166}" - LineBreakMode="TailTruncation" - FontFamily="BreezeSans" - Text="{Binding CurrentStateDescription.Label}" - TextColor="#FFFFFF"/> - <Image x:Name="ThumnailDimLayer" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - Aspect="Fill" - Opacity="0.99" - Source="img_tizen_home_list_dimmed_recent.png"/> - <Button x:Name="ButtonFocusArea" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - Focused="OnFocused" - Unfocused="OnUnfocused" - Clicked="OnClicked" - Opacity="0" /> -</Controls:PanelButton>
\ No newline at end of file diff --git a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs b/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs deleted file mode 100755 index b0a487e..0000000 --- a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs +++ /dev/null @@ -1,168 +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 Tizen.Xamarin.Forms.Extension; -using Xamarin.Forms; -using Xamarin.Forms.PlatformConfiguration.TizenSpecific; - -namespace TVHome.Controls -{ - /// <summary> - /// Custom Control for Thumbnail Button in Sub Panel - /// </summary> - public partial class SubPanelThumbnailButton : PanelButton - { - /// <summary> - /// Constructor - /// </summary> - public SubPanelThumbnailButton() - { - InitializeComponent(); - - WidthRequest = SizeUtils.GetWidthSize(320); - HeightRequest = SizeUtils.GetHeightSize(180); - ThumbnailTitle.FontSize = SizeUtils.GetFontSize(26); - ThumbnailTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal); - - } - - /// <summary> - /// Handles Button Clicked event - /// </summary> - /// <param name="sender">The source of the event</param> - /// <param name="e">The event that is occurred when button is clicked</param> - public override async void OnClicked(object sender, EventArgs e) - { - OnClickedCommand?.Execute(""); - - await this.FadeTo(0.9, 300); - } - - /// <summary> - /// Handles Button Focused event - /// </summary> - /// <param name="sender">The source of the event</param> - /// <param name="e">The event that is occurred when button is focused</param> - public override async void OnFocused(object sender, FocusEventArgs e) - { - DebuggingUtils.Dbg("SubPanelThumbnailButton " + ThumbnailTitle.Text + " - OnFocused"); - - PanelButtonState = PanelButtonState.Focused; - - OnFocusedCommand?.Execute(""); - -#pragma warning disable CS4014 - ThumbnailGradient.Source = "ic_list_thumbnail_gradient_focused.9.png"; - ThumbnailTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Medium); - //ThumbnailTitle.FadeTo(0.8, 300); -#pragma warning restore CS4014 - await this.ScaleTo(1.2, 300); - } - - /// <summary> - /// Handles Button Unfocused event - /// </summary> - /// <param name="sender">The source of the event</param> - /// <param name="e">The event that is occurred when button is unfocused</param> - public override async void OnUnfocused(object sender, FocusEventArgs e) - { - DebuggingUtils.Dbg("SubPanelThumbnailButton " + ThumbnailTitle.Text + " - OnUnfocused"); - - if (!IsOptionsShowing) - { - PanelButtonState = PanelButtonState.Show; - } - -#pragma warning disable CS4014 - //ThumbnailTitle.FadeTo(0.3, 300); - ThumbnailGradient.Source = "ic_list_thumbnail_gradient_normal.9.png"; - ThumbnailTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal); -#pragma warning restore CS4014 - await this.ScaleTo(1.0, 300); - } - - public override void OnMoveStarting() - { - - } - - /// <summary> - /// A method for handling the button when button is changed to move mode - /// </summary> - /// <param name="isMoveCanceled">A flag indicates whether moving is canceled or not</param> - public override void OnMoveFinishing(bool isMoveCanceled) - { - - } - - /// <summary> - /// A method for showing Context popup - /// </summary> - public override void ShowContextPopup() - { - if (popup != null) - { - return; - } - - popup = new ContextPopup - { - IsAutoHidingEnabled = true, - DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Down, ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left) - }; - - PanelButtonState = PanelButtonState.ShowingOption; - - popup.Items.Add(new ContextPopupItem("REMOVE")); - popup.Items.Add(new ContextPopupItem("CLEAR ALL")); - - popup.SelectedIndexChanged += (sender, args) => - { - var ctxPopup = sender as ContextPopup; - switch (ctxPopup.SelectedIndex) - { - case 0: - OnClearCommand.Execute(""); - ctxPopup.Dismiss(); - break; - - case 1: - OnClearAllCommand.Execute(""); - ctxPopup.Dismiss(); - break; - } - }; - - popup.Dismissed += (sender, args) => - { - popup = null; - }; - - DebuggingUtils.Dbg("auto hiding = " + popup.IsAutoHidingEnabled); - - popup.Show(this); - } - - /// <summary> - /// A method for changing context popup mode - /// </summary> - /// <param name="showOptions">Options for change context popup mode</param> - public override void ChangeShowOptionsMode(bool showOptions) - { - } - } -}
\ No newline at end of file diff --git a/TVHome/TVHome/ViewModels/AppListViewModel.cs b/TVHome/TVHome/ViewModels/AppListViewModel.cs index 509c659..998a0e5 100644..100755 --- a/TVHome/TVHome/ViewModels/AppListViewModel.cs +++ b/TVHome/TVHome/ViewModels/AppListViewModel.cs @@ -17,18 +17,16 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; using Xamarin.Forms; -using LibTVRefCommonPortable.Models; using TVHome.Views; namespace TVHome.ViewModels { /// <summary> - /// A class for ViewModel of TV Home Recent Menu List + /// A class for ViewModel of TV Home Menu List /// </summary> public class AppListViewModel : INotifyPropertyChanged, IStateSubscriber { @@ -120,8 +118,6 @@ namespace TVHome.ViewModels DebuggingUtils.Dbg("OnUnpinCommand "); UnpinAppShortcutInfo(appId); }); - - } /// <summary> @@ -172,7 +168,6 @@ namespace TVHome.ViewModels } - /// <summary> /// A method for updating pinned applications /// </summary> @@ -227,8 +222,6 @@ namespace TVHome.ViewModels public void OnStateChanged(AppState state) { - //DebuggingUtils.Dbg("AppPanel OnStateChanged " + state); - switch (state) { case AppState.HomeMainPanelAppsFocused: @@ -253,7 +246,5 @@ namespace TVHome.ViewModels } } - - } } diff --git a/TVHome/TVHome/ViewModels/MainPageViewModel.cs b/TVHome/TVHome/ViewModels/MainPageViewModel.cs index e371045..76bfb26 100755 --- a/TVHome/TVHome/ViewModels/MainPageViewModel.cs +++ b/TVHome/TVHome/ViewModels/MainPageViewModel.cs @@ -17,11 +17,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; -using LibTVRefCommonPortable.Models; namespace TVHome.ViewModels { @@ -30,8 +26,7 @@ namespace TVHome.ViewModels /// </summary> public enum HomeMenuItem { - Recent = 0, - Apps, + Apps = 0, Settings, NotSelected, }; diff --git a/TVHome/TVHome/ViewModels/MainPanelViewModel.cs b/TVHome/TVHome/ViewModels/MainPanelViewModel.cs index 5191d07..d956a10 100644..100755 --- a/TVHome/TVHome/ViewModels/MainPanelViewModel.cs +++ b/TVHome/TVHome/ViewModels/MainPanelViewModel.cs @@ -20,7 +20,6 @@ using System.ComponentModel; using System.Linq; using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; using LibTVRefCommonPortable.Models; using TVHome.Views; @@ -28,7 +27,7 @@ namespace TVHome.ViewModels { /// <summary> - /// A class for ViewModel of TV Home Recent Menu List + /// A class for ViewModel of TV Home Menu List /// </summary> public class MainPanelViewModel : INotifyPropertyChanged, IStateSubscriber { @@ -74,24 +73,15 @@ namespace TVHome.ViewModels set { - /* - if (focusedItemIndex == value) - { - return; - } - */ focusedItemIndex = value; DebuggingUtils.Dbg("FocusedItemIndex => " + value); switch (focusedItemIndex) { case 0: - MainPageViewModel.Publisher.CurrentState = AppState.HomeMainPanelRecentFocused; - return; - case 1: MainPageViewModel.Publisher.CurrentState = AppState.HomeMainPanelAppsFocused; return; - case 2: + case 1: MainPageViewModel.Publisher.CurrentState = AppState.HomeMainPanelSettingsFocused; return; } @@ -114,8 +104,6 @@ namespace TVHome.ViewModels MakeMainMenuItems(); - //FocusedItemIndex = 1; - MainPageViewModel.Instance.RegisterStateSubscriber(this); } @@ -125,8 +113,8 @@ namespace TVHome.ViewModels /// </summary> private void MakeMainMenuItems() { - string[] AppName = { "Recent", "Apps", "Settings" }; - string[] AppControlID = { ManagedApps.TVAppsAppID, ManagedApps.TVAppsAppID, ManagedApps.SettingsAppID }; + string[] AppName = { "Apps", "Settings" }; + string[] AppControlID = { ManagedApps.TVAppsAppID, ManagedApps.SettingsAppID }; string[] AppIconPath = { "ic_home_menu_{0}_normal.png", @@ -215,12 +203,9 @@ namespace TVHome.ViewModels public void OnStateChanged(AppState state) { - //DebuggingUtils.Dbg("MainPanel OnStateChanged " + state); - switch (state) { case AppState.HomeMainPanelAppsFocused: - case AppState.HomeMainPanelRecentFocused: case AppState.HomeMainPanelSettingsFocused: MainPanelState = PanelState.Focused; @@ -234,7 +219,6 @@ namespace TVHome.ViewModels OnPropertyChanged("MainList"); break; - case AppState.HomeSubPanelRecentFocused: case AppState.HomeSubPanelAppsFocused: case AppState.HomeSubPanelSettingsFocused: foreach (var menuItem in MainList) @@ -246,8 +230,6 @@ namespace TVHome.ViewModels (MainList.ElementAt(FocusedItemIndex) as HomeMenuAppShortcutInfo)?.ChangeStatus("selected"); OnPropertyChanged("MainList"); MainPanelState = PanelState.Show; - - break; case AppState.HomeShowOptions: diff --git a/TVHome/TVHome/ViewModels/RecentListViewModel.cs b/TVHome/TVHome/ViewModels/RecentListViewModel.cs deleted file mode 100644 index 73ddbd4..0000000 --- a/TVHome/TVHome/ViewModels/RecentListViewModel.cs +++ /dev/null @@ -1,206 +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.Linq; -using LibTVRefCommonPortable.DataModels; -using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; -using LibTVRefCommonPortable.Models; -using TVHome.Views; - -namespace TVHome.ViewModels -{ - - /// <summary> - /// A class for ViewModel of TV Home Recent Menu List - /// </summary> - public class RecentListViewModel : INotifyPropertyChanged, IStateSubscriber - { - private static readonly Lazy<RecentListViewModel> instance = new Lazy<RecentListViewModel>(() => new RecentListViewModel()); - - public static RecentListViewModel Instance - { - get - { - return instance.Value; - } - } - - private PanelState recentSubPanelState; - public PanelState RecentSubPanelState - { - set - { - if (recentSubPanelState == value) - { - return; - } - - DebuggingUtils.Dbg("RecentSubPanelState, set - " + value); - - switch (value) - { - case PanelState.Focused: - if (MainPageViewModel.Publisher.CurrentState == AppState.HomeMainPanelRecentFocused) - { - MainPageViewModel.Publisher.CurrentState = AppState.HomeSubPanelRecentFocused; - } - - break; - - case PanelState.Iconified: - MainPageViewModel.Publisher.CurrentState = AppState.HomeIconified; - break; - } - - recentSubPanelState = value; - OnPropertyChanged("RecentSubPanelState"); - } - - get - { - return recentSubPanelState; - } - } - - - - /// <summary> - /// Gets or set RecentList for Recent SubPanel - /// </summary> - public IEnumerable<ShortcutInfo> RecentList { get; set; } - - - /// <summary> - /// A command for delete a recent item - /// </summary> - public Command OnClearCommand { get; set; } - - /// <summary> - /// A command for delete all recent items - /// </summary> - public Command OnClearAllCommand { get; set; } - - private RecentListViewModel() - { - DebuggingUtils.Dbg("RecentListViewModel"); - - MakeRecentButtons(); - - MainPageViewModel.Instance.RegisterStateSubscriber(this); - - OnClearCommand = new Command<string>((appId) => - { - RemoveRecentApplication(appId); - }); - - OnClearAllCommand = new Command(() => - { - ClearAllRecentApplications(); - }); - - MessagingCenter.Subscribe<App, TVHomeStatus>(this, App.AppStatus, (sender, arg) => - { - switch (arg) - { - case TVHomeStatus.OnResume: - MakeRecentButtons(); - break; - } - }); - } - - /// <summary> - /// Gets the RecentList for displaying items and updates the list to Recent SubPanel - /// </summary> - private void MakeRecentButtons() - { - // @TODO : Check ApplicationManager.GetRecentApplications() API - // RecentList = TVHomeImpl.GetInstance.RecentShortcutControllerInstance.GetList(); - OnPropertyChanged("RecentList"); - } - - /// <summary> - /// Clears all recent applications and updates the list to Recent SubPanel - /// </summary> - private void ClearAllRecentApplications() - { - TVHomeImpl.GetInstance.RecentShortcutControllerInstance.RemoveAll(); - MakeRecentButtons(); - } - - /// <summary> - /// Removes specified recent application and updates the list to Recent SubPanel - /// </summary> - /// <param name="appId">An application ID</param> - private void RemoveRecentApplication(string appId) - { - TVHomeImpl.GetInstance.RecentShortcutControllerInstance.Remove(appId); - MakeRecentButtons(); - } - - /// <summary> - /// An event that is occurred when property of MainPageViewModel is changed - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; - - /// <summary> - /// A method for invoking PropertyChanged event - /// </summary> - /// <param name="name">The name of property</param> - public void OnPropertyChanged(string name) - { - DebuggingUtils.Dbg("RecentListViewModel OnPropertyChanged " + name); - PropertyChangedEventHandler handler = PropertyChanged; - if (handler != null) - { - handler(this, new PropertyChangedEventArgs(name)); - } - } - - public void OnStateChanged(AppState state) - { - DebuggingUtils.Dbg("RecentListViewModel OnStateChanged " + state); - - switch (state) - { - case AppState.HomeMainPanelRecentFocused: - RecentSubPanelState = PanelState.Show; - break; - - case AppState.HomeSubPanelRecentFocused: - RecentSubPanelState = PanelState.Focused; - break; - - case AppState.HomeShowOptions: - case AppState.HomeMove: - break; - - case AppState.HomeIconified: - RecentSubPanelState = PanelState.Iconified; - break; - - default: - RecentSubPanelState = PanelState.Hide; - break; - - } - } - } -} diff --git a/TVHome/TVHome/ViewModels/SettingsViewModel.cs b/TVHome/TVHome/ViewModels/SettingsViewModel.cs index 874e5a2..5aac445 100644..100755 --- a/TVHome/TVHome/ViewModels/SettingsViewModel.cs +++ b/TVHome/TVHome/ViewModels/SettingsViewModel.cs @@ -17,18 +17,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; -using LibTVRefCommonPortable.Models; using TVHome.Views; namespace TVHome.ViewModels { /// <summary> - /// A class for ViewModel of TV Home Recent Menu List + /// A class for ViewModel of TV Home Menu List /// </summary> public class SettingsViewModel : INotifyPropertyChanged, IStateSubscriber { diff --git a/TVHome/TVHome/Views/MainPage.xaml b/TVHome/TVHome/Views/MainPage.xaml index 7b6617a..35fdee3 100755 --- a/TVHome/TVHome/Views/MainPage.xaml +++ b/TVHome/TVHome/Views/MainPage.xaml @@ -27,15 +27,6 @@ FocusedItemIndex="{Binding FocusedItemIndex}" ItemsSource="{Binding MainList}"/> - <Views:SubThumbnailPanel x:Name="RecentSubPanel" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.224}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.89}" - PanelState="{Binding RecentSubPanelState}" - OnClearVMCommand="{Binding OnClearCommand}" - OnClearAllVMCommand="{Binding OnClearAllCommand}" - ItemsSource="{Binding RecentList}" /> - <Views:SubPanel x:Name="AppsSubPanel" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2370}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" diff --git a/TVHome/TVHome/Views/MainPage.xaml.cs b/TVHome/TVHome/Views/MainPage.xaml.cs index 23e505b..17c8158 100755 --- a/TVHome/TVHome/Views/MainPage.xaml.cs +++ b/TVHome/TVHome/Views/MainPage.xaml.cs @@ -106,13 +106,9 @@ namespace TVHome.Views BindingContext = MainPageViewModel.Instance; SubPanelDictionary = new Dictionary<HomeMenuItem, Panel>(); - SubPanelDictionary.Add(HomeMenuItem.Recent, RecentSubPanel); SubPanelDictionary.Add(HomeMenuItem.Apps, AppsSubPanel); SubPanelDictionary.Add(HomeMenuItem.Settings, SettingsSubPanel); - RecentSubPanel.OnPanelHiding(); - RecentSubPanel.BindingContext = RecentListViewModel.Instance; - AppsSubPanel.OnPanelShowing(); AppsSubPanel.BindingContext = AppListViewModel.Instance; @@ -148,9 +144,6 @@ namespace TVHome.Views { switch (arg) { - case TVHomeStatus.OnResume: - InitializeRecentSubPanelButtonFocusChain(); - break; case TVHomeStatus.OnSleep: PageMainPanel.InitialFocusing(); break; @@ -185,58 +178,22 @@ namespace TVHome.Views /// </summary> private void InitializeMainPanelButtonFocusChain() { - Button recentMainPanelButton = PageMainPanel.GetButtonToFocusing(0); - Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(1); - Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(2); + Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(0); + Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(1); - recentMainPanelButton.On<Tizen>().SetNextFocusLeftView(recentMainPanelButton); - recentMainPanelButton.On<Tizen>().SetNextFocusRightView(appsMainPanelButton); - appsMainPanelButton.On<Tizen>().SetNextFocusLeftView(recentMainPanelButton); + appsMainPanelButton.On<Tizen>().SetNextFocusLeftView(appsMainPanelButton); appsMainPanelButton.On<Tizen>().SetNextFocusRightView(settingMainPanelButton); settingMainPanelButton.On<Tizen>().SetNextFocusLeftView(appsMainPanelButton); settingMainPanelButton.On<Tizen>().SetNextFocusRightView(settingMainPanelButton); } /// <summary> - /// A method for setting focus chain in Recent Sub Panel - /// </summary> - private void InitializeRecentSubPanelButtonFocusChain() - { - List<View> recentSubPanelButtons = new List<View>(RecentSubPanel.GetSubPanelButtons); - Button recentMainPanelButton = PageMainPanel.GetButtonToFocusing(0); - - if (recentSubPanelButtons.Count > 1) - { - recentMainPanelButton.On<Tizen>().SetNextFocusDownView(recentSubPanelButtons[0].FindByName<Button>("ButtonFocusArea")); - } - - foreach (var item in recentSubPanelButtons) - { - item.FindByName<Button>("ButtonFocusArea").On<Tizen>().SetNextFocusUpView(recentMainPanelButton); - } - - for (var i = 0; i < recentSubPanelButtons.Count; i++) - { - if (i != 0) - { - recentSubPanelButtons[i].FindByName<Button>("ButtonFocusArea").On<Tizen>().SetNextFocusLeftView(recentSubPanelButtons[i - 1].FindByName<Button>("ButtonFocusArea")); - } - - if (i != recentSubPanelButtons.Count - 1) - { - recentSubPanelButtons[i].FindByName<Button>("ButtonFocusArea").On<Tizen>().SetNextFocusRightView(recentSubPanelButtons[i + 1].FindByName<Button>("ButtonFocusArea")); - } - } - } - - /// <summary> /// A method for setting focus chain in Apps Sub Panel /// </summary> private void InitializeAppsSubPanelButtonFocusChain() { List<View> appsSubPanelButtons = new List<View>(AppsSubPanel.SubPanelButtons); - DebuggingUtils.Dbg("InitializeAppsSubPanelButtonFocusChain, buttons = " + appsSubPanelButtons.Count); - Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(1); + Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(0); if (appsSubPanelButtons.Count > 2) { @@ -268,7 +225,7 @@ namespace TVHome.Views private void InitializeSettingsSubPanelButtonFocusChain() { List<View> settingSubPanelButtons = new List<View>(SettingsSubPanel.SubPanelButtons); - Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(2); + Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(1); if (settingSubPanelButtons.Count > 2) { @@ -288,10 +245,8 @@ namespace TVHome.Views /// <param name="e">The event that is occurred when property is changed</param> private void MainPage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { - DebuggingUtils.Dbg("MainPage_PropertyChanged, status = " + CurrentState + ", - " + e.PropertyName); if (e.PropertyName.CompareTo("CurrentState") == 0) { - DebuggingUtils.Dbg("MyTest" + CurrentState); switch (CurrentState) { case AppState.HomeIconified: @@ -319,17 +274,12 @@ namespace TVHome.Views case AppState.HomeMainPanelAppsFocused: // TODO : remove dependency of MainPanel - PageMainPanel.SetButtonFocus(1); - break; - - case AppState.HomeMainPanelRecentFocused: - // TODO : PageMainPanel.SetButtonFocus(0); break; case AppState.HomeMainPanelSettingsFocused: // TODO : - PageMainPanel.SetButtonFocus(2); + PageMainPanel.SetButtonFocus(1); break; default: diff --git a/TVHome/TVHome/Views/MainPanel.xaml.cs b/TVHome/TVHome/Views/MainPanel.xaml.cs index 41003c7..73f2e48 100755 --- a/TVHome/TVHome/Views/MainPanel.xaml.cs +++ b/TVHome/TVHome/Views/MainPanel.xaml.cs @@ -68,7 +68,6 @@ namespace TVHome.Views PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(mainPanelIconWidth) }); PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(mainPanelIconWidth) }); - PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(mainPanelIconWidth) }); PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); PanelButtonGrid.ColumnSpacing = mainPanelColumnSpacing; @@ -85,8 +84,7 @@ namespace TVHome.Views { if (e.PropertyName == "ItemsSource") { - - HomeMenuItem menuIndex = HomeMenuItem.Recent; + HomeMenuItem menuIndex = HomeMenuItem.Apps; var index = 0; PanelButtonGrid.Children.Clear(); @@ -150,7 +148,7 @@ namespace TVHome.Views return; } - var button = PanelButtonGrid.Children[1]; + var button = PanelButtonGrid.Children[0]; button.FindByName<Button>("ButtonFocusArea").Focus(); } diff --git a/TVHome/TVHome/Views/Panel.cs b/TVHome/TVHome/Views/Panel.cs index c51fd62..ea216e0 100755 --- a/TVHome/TVHome/Views/Panel.cs +++ b/TVHome/TVHome/Views/Panel.cs @@ -104,36 +104,6 @@ namespace TVHome.Views } /// <summary> - /// Identifies the OnClearVMCommand bindable property - /// </summary> - public static readonly BindableProperty OnClearVMCommandProperty = BindableProperty.Create("OnClearVMCommand", typeof(ICommand), typeof(SubThumbnailPanel)); - - /// <summary> - /// A command is executed when item remove is clicked - /// </summary> - public ICommand OnClearVMCommand - { - get { return (ICommand)GetValue(OnClearVMCommandProperty); } - set { SetValue(OnClearVMCommandProperty, value); } - } - - /// <summary> - /// Identifies the OnClearAllVMCommand bindable property - /// </summary> - public static readonly BindableProperty OnClearAllVMCommandProperty = BindableProperty.Create("OnClearAllVMCommand", typeof(ICommand), typeof(SubThumbnailPanel)); - - /// <summary> - /// A command is executed when item remove all is clicked - /// </summary> - public ICommand OnClearAllVMCommand - { - get { return (ICommand)GetValue(OnClearAllVMCommandProperty); } - set { SetValue(OnClearAllVMCommandProperty, value); } - } - - - - /// <summary> /// Identifies the ItemsSource bindable property /// </summary> public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable<ShortcutInfo>), typeof(MainPanel)); diff --git a/TVHome/TVHome/Views/SubPanel.xaml.cs b/TVHome/TVHome/Views/SubPanel.xaml.cs index 47e3154..a0234c3 100755 --- a/TVHome/TVHome/Views/SubPanel.xaml.cs +++ b/TVHome/TVHome/Views/SubPanel.xaml.cs @@ -19,7 +19,6 @@ using TVHome.Controls; using LibTVRefCommonPortable.DataModels; using Xamarin.Forms; using System.Threading.Tasks; -using System.Windows.Input; using System.Collections.Generic; using LibTVRefCommonPortable.Utils; using System; diff --git a/TVHome/TVHome/Views/SubThumbnailPanel.xaml b/TVHome/TVHome/Views/SubThumbnailPanel.xaml deleted file mode 100755 index 849ae36..0000000 --- a/TVHome/TVHome/Views/SubThumbnailPanel.xaml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Views:Panel xmlns="http://xamarin.com/schemas/2014/forms" - xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:Views="clr-namespace:TVHome.Views" - xmlns:Controls="clr-namespace:TVHome.Controls" - x:Class="TVHome.Views.SubThumbnailPanel"> - <RelativeLayout x:Name="ThumbnailParent"> - <ScrollView x:Name="PanelScrollView" - Orientation="Horizontal" - HorizontalOptions="Center" - IsVisible="false" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}" > - <StackLayout x:Name="PanelButtonStack" - Orientation="Horizontal" /> - </ScrollView> - <RelativeLayout x:Name="NoContentInfo" - IsVisible="false" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"> - <Controls:NinePatchImage - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.3}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.354167}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.1}" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.33177}" - Source="btn_option_menu_nocontent_bg.9.png" - Aspect="Fill" - BorderTop="2" - BorderBottom="2" - BorderLeft="2" - BorderRight="2" /> - <Label x:Name="NoContentInfoText" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.3}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.354167}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.181818}" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.33177}" - HorizontalTextAlignment="Center" - VerticalTextAlignment="Center" - Text="No Content to display" - FontFamily="BreezeSans" - TextColor="White" /> - </RelativeLayout> - </RelativeLayout> -</Views:Panel>
\ No newline at end of file diff --git a/TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs b/TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs deleted file mode 100755 index 521d2ab..0000000 --- a/TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs +++ /dev/null @@ -1,363 +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 TVHome.Controls; -using LibTVRefCommonPortable.DataModels; -using Xamarin.Forms; -using System.Threading.Tasks; -using LibTVRefCommonPortable.Utils; -using System.Collections.Generic; - -namespace TVHome.Views -{ - using TVHome.ViewModels; - using Xamarin.Forms.PlatformConfiguration.TizenSpecific; - using Tizen = Xamarin.Forms.PlatformConfiguration.Tizen; - /// <summary> - /// SubThumnailPanel in Main Page for Recent - /// </summary> - public partial class SubThumbnailPanel : Panel - { - /// <summary> - /// A list has panel button that consist of this SubThumbnailPanel. - /// </summary> - private List<PanelButton> ButtonList; - - /// <summary> - /// A flag indicates whether displaying "no content info" is needed or not - /// </summary> - private bool isShowNoContentsInfo = true; - - /// <summary> - /// SubPanel icon's transition height value when it focused. - /// </summary> - private int selectTransitionHeight = SizeUtils.GetHeightSize(140); - - /// <summary> - /// A method for getting Panel Buttons - /// </summary> - /// <returns>A list of panel button views</returns> - public IList<View> GetSubPanelButtons - { - get - { - return PanelButtonStack.Children; - } - } - - /// <summary> - /// Constructor - /// </summary> - public SubThumbnailPanel() - { - InitializeComponent(); - InitializeSize(); - - SetPanelDisplay(); - - PropertyChanged += OnPropertyChanged; - NoContentInfoText.On<Tizen>().SetFontWeight(FontWeight.Light); - - ButtonList = new List<PanelButton>(); - } - - private void SetPanelDisplay() - { - if (isShowNoContentsInfo) - { - DebuggingUtils.Dbg("SetPanelDisplay - TRUE"); - PanelScrollView.IsVisible = false; - NoContentInfo.IsVisible = true; - } - else - { - DebuggingUtils.Dbg("SetPanelDisplay - FALSE"); - PanelScrollView.IsVisible = true; - NoContentInfo.IsVisible = false; - } - } - - private void InitializeSize() - { - PanelButtonStack.Spacing = SizeUtils.GetWidthSizeDouble(27.5); - PanelButtonStack.Padding = new Thickness(SizeUtils.GetWidthSize(96), SizeUtils.GetWidthSize(32)); - - NoContentInfoText.FontSize = SizeUtils.GetFontSize(28); - } - - /// <summary> - /// A method for handling when menu key is pressed - /// </summary> - public override void MenuKeyPressed() - { - foreach (var item in ButtonList) - { - if (item.IsButtonFocused) - { - item.PanelButtonState = PanelButtonState.ShowingOption; - } - } - } - - public void PanelButtonStateEventHandler(object sender, PanelButtonState panelButtonStateArg) - { - DebuggingUtils.Dbg("PanelButtonStateEventHandler, " + panelButtonStateArg); - switch (panelButtonStateArg) - { - case PanelButtonState.Focused: - if (PanelState != PanelState.Moving) - { - PanelState = PanelState.Focused; - } - - break; - - case PanelButtonState.ShowingOption: - PanelState = PanelState.ShowingOption; - break; - } - } - - /// <summary> - /// An event handler for handling property changed event - /// </summary> - /// <param name="sender">A source of event</param> - /// <param name="e">The event that is occurred when property is changed</param> - private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName == "ItemsSource") - { - DebuggingUtils.Dbg("SubThumbnailPanel view OnPropertyChanged, ItemSource "); - - isShowNoContentsInfo = true; - PanelButtonStack.Children.Clear(); - ButtonList.Clear(); - - foreach (RecentShortcutInfo item in ItemsSource) - { - PanelButton button = new SubPanelThumbnailButton(); - button.BindingContext = item; - - button.OnPanelButtonStateChanged += PanelButtonStateEventHandler; - button.OnFocusedCommand = new Command(() => - { - DebuggingUtils.Dbg("SubThumbnailPanel Focused"); - PanelState = PanelState.Focused; - SelectedItem = item; - - if (SizeUtils.GetWidthSize((int)button.X) - SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) < 0) - { - ScrollToLeft(); - } - else if (SizeUtils.GetWidthSize((int)button.X) + SizeUtils.GetWidthSize(320) > SizeUtils.GetWidthSize(1920)) - { - ScrollToRight(); - } - }); - button.OnClickedCommand = new Command(() => - { - item.DoAction(); - }); - button.OnClearCommand = new Command(() => - { - OnClearVMCommand.Execute(item.Id); - }); - button.OnClearAllCommand = new Command(() => - { - OnClearAllVMCommand.Execute(""); - }); - PanelButtonStack.Children.Add(button); - ButtonList.Add(button); - - isShowNoContentsInfo = false; - } - - SetPanelDisplay(); - - if (PanelState == PanelState.Hide || - PanelState == PanelState.Iconified) - { - OnPanelHiding(); - } - else - { - OnPanelFocusing(); - } - } - } - - /// <summary> - /// A method for scrolling to right - /// </summary> - private async void ScrollToRight() - { - double distance = SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) + SizeUtils.GetWidthSize(320); - await Task.Delay(1); - await PanelScrollView.ScrollToAsync(distance, 0, true); - } - - /// <summary> - /// A method for scrolling to left - /// </summary> - private async void ScrollToLeft() - { - double distance = SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) - SizeUtils.GetWidthSize(320); - await Task.Delay(1); - await PanelScrollView.ScrollToAsync(distance, 0, true); - } - - /// <summary> - /// A method for hiding the panel - /// </summary> - public override void OnPanelHiding() - { - if (isShowNoContentsInfo) - { - TranslationY = 0; - Opacity = 0; - return; - } - - foreach (var item in PanelButtonStack.Children) - { - item.IsEnabled = false; - } - - AnimationExtensions.AbortAnimation(this, "PanelAnimation"); - var currentTranslationY = TranslationY; - var diff = selectTransitionHeight - currentTranslationY; - var currentOpacity = Opacity; - Animation animation = new Animation(); - Animation translateAnimation = new Animation(v => TranslationY = (currentTranslationY + diff * v)); - Animation fadeAnimation = new Animation(v => Opacity = currentOpacity * (1 - v)); - animation.Add(0, 1, translateAnimation); - animation.Add(0, 1, fadeAnimation); - animation.Commit(this, "PanelAnimation", length: 300, finished: (percentage, cancel) => - { - PanelScrollView.ScrollToAsync(0, 0, true); - }); - } - - /// <summary> - /// A method for showing the panel - /// </summary> - public override void OnPanelShowing() - { - if (isShowNoContentsInfo) - { - TranslationY = 0; - Opacity = 1; - return; - } - - foreach (var item in PanelButtonStack.Children) - { - item.IsEnabled = true; - item.FindByName<Xamarin.Forms.Image>("ThumnailDimLayer").Opacity = 1; - } - - AnimationExtensions.AbortAnimation(this, "PanelAnimation"); - var currentTranslationY = TranslationY; - var currentOpacity = Opacity; - var diff = 1 - currentOpacity; - Animation animation = new Animation(); - Animation translateAnimation = new Animation(v => TranslationY = (currentTranslationY * (1 - v))); - Animation fadeAnimation = new Animation(v => Opacity = currentOpacity + diff * v); - animation.Add(0, 1, translateAnimation); - animation.Add(0, 1, fadeAnimation); - animation.Commit(this, "PanelAnimation", length: 300); - - } - - /// <summary> - /// A method for handling panel focused event - /// </summary> - /// <param name="shouldBeFirstItemFocused">If this flag is true, the first item should be focused.</param> - public override void OnPanelFocusing(bool shouldBeFirstItemFocused = true) - { - if (isShowNoContentsInfo) - { - return; - } - - foreach (var item in PanelButtonStack.Children) - { - item.FindByName<Xamarin.Forms.Image>("ThumnailDimLayer").Opacity = 0; - } - - if (shouldBeFirstItemFocused) - { - var button = PanelButtonStack.Children[0]; - button.FindByName<Button>("ButtonFocusArea").Focus(); - } - - AnimationExtensions.AbortAnimation(this, "PanelAnimation"); - var currentTranslationY = TranslationY; - var diff = -selectTransitionHeight - currentTranslationY; - Animation animation = new Animation(); - Animation translateAnimation = new Animation(v => TranslationY = (currentTranslationY + diff * v)); - animation.Add(0.5, 1, translateAnimation); - animation.Commit(this, "PanelAnimation", length: 600); - } - - - public override void OnOptionMenuShowing() - { - DebuggingUtils.Dbg("OnShowingOptiongMenu - SubThumbnailPanel"); - var bounds = Bounds; - bounds.Height += 300; - bounds.Y -= 300; - this.LayoutTo(bounds, 0); - } - - public override void OnOptionMenuHiding() - { - DebuggingUtils.Dbg("OnHidingOptiongMenu - SubThumbnailPanel"); - var bounds = Bounds; - bounds.Height -= 300; - bounds.Y += 300; - this.LayoutTo(bounds, 0); - } - - - public override void OnMoveStarting() - { - } - - public override void OnMoveFinishing() - { - } - - /// <summary> - /// A method for handling to hide panel without animation - /// </summary> - public override void OnPanelForcelyHiding() - { - /* - foreach (var item in PanelButtonStack.Children) - { - item.IsEnabled = true; - item.FindByName<Xamarin.Forms.Image>("ThumnailDimLayer").Opacity = 1; - } - - this.TranslationY = selectTransitionHeight; - Opacity = 1; - */ - OnPanelHiding(); - } - } -}
\ No newline at end of file |