Set the default icon if the app icon is not exist
authorgs86.lee <gs86.lee@DO-GS86-LEE04>
Thu, 2 Mar 2017 05:02:27 +0000 (14:02 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:44 +0000 (18:34 +0900)
Change-Id: I5df548772df7ed7e98ef22e421031ee8dd2d1cd8

TVHome/TVHome.TizenTV/Ports/ApplicationManagerPort.cs
TVHome/TVHome.TizenTV/Ports/PackageManagerPort.cs

index ca109c19f4acdd0345011529afb5a542746ea953..431a469c4730fa413629640e61ea9424b0ad5f71 100644 (file)
@@ -49,9 +49,9 @@ namespace TVHome.TizenTV.Ports
             {\r
                 result = new string[3];\r
 \r
-                result[0] = appInfo.Label != null ? appInfo.Label : null;\r
-                result[1] = appInfo.ApplicationId != null ? appInfo.ApplicationId : null;\r
-                result[2] = appInfo.IconPath != null ? appInfo.IconPath : "AppIcon.png";\r
+                result[0] = (appInfo.Label != null) ? appInfo.Label : null;\r
+                result[1] = (appInfo.ApplicationId != null) ? appInfo.ApplicationId : null;\r
+                result[2] = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : "AppIcon.png";\r
                 resultList.Add(appInfo.ApplicationId, result);\r
             }\r
 \r
@@ -62,6 +62,9 @@ namespace TVHome.TizenTV.Ports
         {\r
             Dictionary<string, string> result = null;\r
             ApplicationInfo appInfo = null;\r
+            string[] icons = { "ic_black.png", "ic_blue.png", "ic_green.png", "ic_red.png", "ic_yellow.png", "AppIcon.png" };\r
+            Random random = new Random();\r
+\r
             try\r
             {\r
                 appInfo = ApplicationManager.GetInstalledApplication(applicationId);\r
@@ -73,7 +76,7 @@ namespace TVHome.TizenTV.Ports
                 result = new Dictionary<string, string>();\r
                 result.Add("Label", appInfo.Label);\r
                 result.Add("ApplicationId", appInfo.ApplicationId);\r
-                result.Add("IconPath", appInfo.IconPath);\r
+                result.Add("IconPath", (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : icons[random.Next(0, 6)]);\r
             }\r
             catch(Exception exception)\r
             {\r
index a27a58879d4235abe7c972c9c1e9a46a2367e57f..e2a90d9d49169175868f678a55377a971bb631ad 100644 (file)
@@ -62,32 +62,9 @@ namespace TVHome.TizenTV.Ports
             {\r
                 result = new string[3];\r
 \r
-                if (item.Label != null)\r
-                {\r
-                    result[0] = item.Label;\r
-                }\r
-                else\r
-                {\r
-                    result[0] = null;\r
-                }\r
-\r
-                if (item.Id != null)\r
-                {\r
-                    result[1] = item.Id;\r
-                }\r
-                else\r
-                {\r
-                    result[1] = null;\r
-                }\r
-\r
-                if (item.IconPath != null)\r
-                {\r
-                    result[2] = item.IconPath;\r
-                }\r
-                else\r
-                {\r
-                    result[2] = null;\r
-                }\r
+                result[0] = (item.Label != null) ? item.Label : null;\r
+                result[1] = (item.Id != null) ? item.Id : null;\r
+                result[2] = (System.IO.File.Exists(item.IconPath)) ? item.IconPath : "AppIcon.png";\r
 \r
                 pkgList.Add(item.Label, result);\r
             }\r
@@ -99,14 +76,7 @@ namespace TVHome.TizenTV.Ports
         {\r
             Package tempItem = PackageManager.GetPackage(PkgID);\r
 \r
-            if (tempItem != null)\r
-            {\r
-                return tempItem.Label;\r
-            }\r
-            else\r
-            {\r
-                return null;\r
-            }\r
+            return (tempItem != null) ? tempItem.Label : null;\r
         }\r
     }\r
 }
\ No newline at end of file