Add ScreentShotPath to RecentShortcutInfo
authorKyuho Jo <kyuho.jo@samsung.com>
Wed, 8 Mar 2017 07:24:29 +0000 (16:24 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:45 +0000 (18:34 +0900)
Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
Change-Id: Ica75be8584e42a8258cf9f2931f9d2ef2d525c5f

LibTVRefCommonPortable/DataModels/RecentShortcutInfo.cs
LibTVRefCommonPortable/Models/AppShortcutController.cs
LibTVRefCommonPortable/Models/RecentShortcutController.cs
LibTVRefCommonTizen/LibTVRefCommonTizen.nuget.targets
TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml
TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs
TVHome/TVHome/ViewModels/MainPageViewModel.cs

index 907bba39a9e927cbd2d51d8edeff3a59a0b9cf97..7ab509699310f411ab56535705abfc7805389178 100644 (file)
@@ -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()
         {
index 39772db6239f61462023c7bdeb2077ea9f8d837f..ba144bf0eaa592016dbcc427239a58ea04942613 100644 (file)
@@ -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,
index fe816dd3c736b0942de5fb78dee2ee48feb636ea..6f7ae233ae79f943fc9494547abe64dd5cdeee57 100644 (file)
@@ -47,7 +47,49 @@ namespace LibTVRefCommmonPortable.Models
             return false;
         }
 
-        public async Task<IEnumerable<RecentShortcutInfo>> GetList()
+        public IEnumerable<RecentShortcutInfo> GetList()\r
+        {\r
+            // TODO : This is a clone of AppShorcutController.ReadFromFile(). Write new code by using RUA\r
+            IEnumerable<AppShortcutInfo> pinned_apps_info = AppShortcutStorage.ReadFromFile("/opt/usr/home/owner/share/pinned_apps_info.xml");\r
+            IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();\r
+            List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();\r
+            string[] icons = { "ic_black.png", "ic_blue.png", "ic_green.png", "ic_red.png", "ic_yellow.png", "AppIcon.png" };\r
+\r
+            foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
+            {
+                Dictionary<string, string> 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();\r
+                    newRecentShortcutInfo.ScreenshotPath = "screenshot.png";\r
+                    // newRecentShortcutInfo.ScreenshotPath = "screenshot_" + appShortcutInfo.AppID + ".png";
+                    newRecentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);
+                    newRecentShortcutInfo.CurrentStateDescription = defaultStateDescription;
+                    recentShortcutInfoList.Add(newRecentShortcutInfo);
+                }
+            }\r
+\r
+            return recentShortcutInfoList;\r
+        }
+
+        public async Task<IEnumerable<RecentShortcutInfo>> GetListAsync()
         {
             IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();
             List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();
@@ -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);
index 0fb90a49fa182a1e7ed13dec032b0db11a1f36a9..d3ba87565dc3b495b7792ab2e2d797fa96acf6a6 100644 (file)
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">
-    <NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
-  </PropertyGroup>
-  <ImportGroup>
-    <Import Project="$(NuGetPackageRoot)\Xamarin.Forms\2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('$(NuGetPackageRoot)\Xamarin.Forms\2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
-  </ImportGroup>
+<?xml version="1.0" encoding="utf-8" standalone="no"?>\r
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">\r
+    <NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>\r
+  </PropertyGroup>\r
+  <ImportGroup>\r
+    <Import Project="$(NuGetPackageRoot)\Xamarin.Forms\2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('$(NuGetPackageRoot)\Xamarin.Forms\2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />\r
+  </ImportGroup>\r
 </Project>
\ No newline at end of file
index ff80af6cb32bdabee06e15bb7559df6d94e12fd6..a00327ee47045e7f9ceab3fb0d6886e36dafb26b 100644 (file)
@@ -11,7 +11,7 @@
         <Image x:Name="ThumbnailImage"
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
-               Source="screenshot.png" />
+               Source="{Binding ScreenshotPath}" />
         <Image x:Name="ThumbnailGradient"
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
@@ -21,7 +21,7 @@
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.689}"
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.131}"
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.233}"
-               Source="AppIcon.png" />
+               Source="{Binding CurrentStateDescription.IconPath}" />
         <Label x:Name="ThumbnailTitle"
                RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.206}"
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.722}"
index 5e81e7764359609ac4fcc4ba6ef02f05ce5672c4..e90a2cd050694a4e2c8e1368554c2628f6992076 100644 (file)
@@ -64,6 +64,7 @@ namespace TVHome.Controls
 
 #pragma warning disable CS4014
             ThumbnailTitle.FadeTo(0.8, 300);
+            View.ScaleTo(1.15, 300);
 #pragma warning restore CS4014
             await View.FadeTo(0.8, 300);
         }
@@ -85,9 +86,10 @@ namespace TVHome.Controls
             //Animation.Commit(ThumbnailTitle, "UnfocusedAnimation", 16, 300);
 
 #pragma warning disable CS4014
-            ThumbnailTitle.FadeTo(0.6, 300);
+            ThumbnailTitle.FadeTo(0.3, 300);
+            View.ScaleTo(1.0, 300);
 #pragma warning restore CS4014
-            await View.FadeTo(0.6, 300);
+            await View.FadeTo(0.3, 300);
         }
     }
 }
\ No newline at end of file
index c7f08aa9c7d8be4c442c0d3a005a94206f8e9edf..0025d40ed16e59ec67887ffe16c50a23da0f4380 100755 (executable)
@@ -99,9 +99,9 @@ namespace TVHome.ViewModels
             OnPropertyChanged("AppList");
         }
 
-        private async void MakeRecentButtons()
+        private void MakeRecentButtons()
         {
-            RecentList = await TVHomeImpl.GetInstance.RecentShortcutControllerInstance.GetList();
+            RecentList = TVHomeImpl.GetInstance.RecentShortcutControllerInstance.GetList();
             if (RecentList != null)
             {
                 OnPropertyChanged("RecentList");