From: Kyuho Jo Date: Wed, 8 Mar 2017 07:24:29 +0000 (+0900) Subject: Add ScreentShotPath to RecentShortcutInfo X-Git-Tag: submit/tizen/20170808.015446~219 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=701ad40bcb71d492dd5cbfe7c48f1854b9ed11e0;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Add ScreentShotPath to RecentShortcutInfo Signed-off-by: Kyuho Jo Change-Id: Ica75be8584e42a8258cf9f2931f9d2ef2d525c5f --- diff --git a/LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs index 907bba3..7ab5096 100644 --- a/LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs +++ b/LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs @@ -20,11 +20,9 @@ namespace LibTVRefCommmonPortable.DataModels { public class RecentShortcutInfo : ShortcutInfo { - public DateTime Date - { - get; - set; - } + public DateTime Date { get; set; } + + public string ScreenshotPath { get; set; } public override void UpdateState() { diff --git a/LibTVRefCommonPortable/Models/AppShortcutController.cs b/LibTVRefCommonPortable/Models/AppShortcutController.cs index 39772db..ba144bf 100644 --- a/LibTVRefCommonPortable/Models/AppShortcutController.cs +++ b/LibTVRefCommonPortable/Models/AppShortcutController.cs @@ -57,7 +57,7 @@ namespace LibTVRefCommmonPortable.Models var defaultStateDescription = new StateDescription() { Label = appLabel, - IconPath = appIconPath ?? icons[random.Next(0, 6)], //IconPath = (resul5t[2] == null) ? "AppIcon.png" : result[2], + IconPath = appIconPath ?? icons[random.Next(0, 6)], Action = new AppControlAction { AppID = appShortcutInfo.AppID, diff --git a/LibTVRefCommonPortable/Models/RecentShortcutController.cs b/LibTVRefCommonPortable/Models/RecentShortcutController.cs index fe816dd..6f7ae23 100644 --- a/LibTVRefCommonPortable/Models/RecentShortcutController.cs +++ b/LibTVRefCommonPortable/Models/RecentShortcutController.cs @@ -47,7 +47,49 @@ namespace LibTVRefCommmonPortable.Models return false; } - public async Task> GetList() + public IEnumerable GetList() + { + // TODO : This is a clone of AppShorcutController.ReadFromFile(). Write new code by using RUA + IEnumerable pinned_apps_info = AppShortcutStorage.ReadFromFile("/opt/usr/home/owner/share/pinned_apps_info.xml"); + IApplicationManagerAPIs applicationManagerPort = DependencyService.Get(); + List recentShortcutInfoList = new List(); + string[] icons = { "ic_black.png", "ic_blue.png", "ic_green.png", "ic_red.png", "ic_yellow.png", "AppIcon.png" }; + + foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info) + { + Dictionary appInfo = applicationManagerPort.GetInstalledApplication(appShortcutInfo.AppID); + + if (appInfo != null) + { + string appLabel; + string appIconPath; + + appInfo.TryGetValue("Label", out appLabel); + appInfo.TryGetValue("IconPath", out appIconPath); + + Random random = new Random(); + var defaultStateDescription = new StateDescription() + { + Label = appLabel, + IconPath = appIconPath ?? icons[random.Next(0, 6)], + Action = new AppControlAction + { + AppID = appShortcutInfo.AppID, + } + }; + var newRecentShortcutInfo = new RecentShortcutInfo(); + newRecentShortcutInfo.ScreenshotPath = "screenshot.png"; + // newRecentShortcutInfo.ScreenshotPath = "screenshot_" + appShortcutInfo.AppID + ".png"; + newRecentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); + newRecentShortcutInfo.CurrentStateDescription = defaultStateDescription; + recentShortcutInfoList.Add(newRecentShortcutInfo); + } + } + + return recentShortcutInfoList; + } + + public async Task> GetListAsync() { IApplicationManagerAPIs applicationManagerPort = DependencyService.Get(); List recentShortcutInfoList = new List(); @@ -57,7 +99,6 @@ namespace LibTVRefCommmonPortable.Models { var defaultStateDescription = new StateDescription() { - // TODO : Label에는 ApplicationInfo의 Label을 넣자 Label = item.Value[0], IconPath = item.Value[2], Action = new AppControlAction() @@ -66,6 +107,7 @@ namespace LibTVRefCommmonPortable.Models } }; var recentShortcutInfo = new RecentShortcutInfo(); + recentShortcutInfo.ScreenshotPath = "screenshot_" + item.Value[0] + ".png"; recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription); recentShortcutInfo.CurrentStateDescription = defaultStateDescription; recentShortcutInfoList.Add(recentShortcutInfo); diff --git a/LibTVRefCommonTizen/LibTVRefCommonTizen.nuget.targets b/LibTVRefCommonTizen/LibTVRefCommonTizen.nuget.targets index 0fb90a4..d3ba875 100644 --- a/LibTVRefCommonTizen/LibTVRefCommonTizen.nuget.targets +++ b/LibTVRefCommonTizen/LibTVRefCommonTizen.nuget.targets @@ -1,9 +1,9 @@ - - - - $(UserProfile)\.nuget\packages\ - - - - + + + + $(UserProfile)\.nuget\packages\ + + + + \ No newline at end of file diff --git a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml b/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml index ff80af6..a00327e 100644 --- a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml +++ b/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml @@ -11,7 +11,7 @@ + Source="{Binding ScreenshotPath}" /> + Source="{Binding CurrentStateDescription.IconPath}" />