Add Unpin action in home
authorHyerim Kim <rimi.kim@samsung.com>
Wed, 15 Mar 2017 09:29:49 +0000 (18:29 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:46 +0000 (18:34 +0900)
Modify FileSystemWatcher filter to pinned_apps_info.xml
Add missing resources

Change-Id: I6c1df1726d0b25e720b121f3b36c6608d06a5580
Signed-off-by: Hyerim Kim <rimi.kim@samsung.com>
12 files changed:
LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs [changed mode: 0644->0755]
TVHome/TVHome.TizenTV/res/ic_tizen_home_list_addpin_focused.png [new file with mode: 0755]
TVHome/TVHome.TizenTV/res/ic_tizen_home_list_allapps_normal.png [new file with mode: 0755]
TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml
TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml.cs
TVHome/TVHome/Controls/SubPanelButton.xaml
TVHome/TVHome/Controls/SubPanelButton.xaml.cs
TVHome/TVHome/Controls/SubPanelReservedButton.xaml
TVHome/TVHome/Controls/SubPanelReservedButton.xaml.cs
TVHome/TVHome/Views/MainPage.xaml.cs [changed mode: 0644->0755]
TVHome/TVHome/Views/Panel.cs [changed mode: 0644->0755]
TVHome/TVHome/Views/SubPanel.xaml.cs

old mode 100644 (file)
new mode 100755 (executable)
index 8a926dd..3ef228a
@@ -32,8 +32,8 @@ namespace LibTVRefCommonTizen.Ports
         {
             watcher = new FileSystemWatcher();
             watcher.Path = "/opt/usr/home/owner/share/";
-            watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.Size;
-            watcher.Filter = "apinnedapp.xml";
+            watcher.NotifyFilter = NotifyFilters.LastWrite;
+            watcher.Filter = "pinned_apps_info.xml";
 
             watcher.Created += new FileSystemEventHandler(WatcherChanged);
             watcher.Changed += new FileSystemEventHandler(WatcherChanged);
diff --git a/TVHome/TVHome.TizenTV/res/ic_tizen_home_list_addpin_focused.png b/TVHome/TVHome.TizenTV/res/ic_tizen_home_list_addpin_focused.png
new file mode 100755 (executable)
index 0000000..a0830ef
Binary files /dev/null and b/TVHome/TVHome.TizenTV/res/ic_tizen_home_list_addpin_focused.png differ
diff --git a/TVHome/TVHome.TizenTV/res/ic_tizen_home_list_allapps_normal.png b/TVHome/TVHome.TizenTV/res/ic_tizen_home_list_allapps_normal.png
new file mode 100755 (executable)
index 0000000..12517bc
Binary files /dev/null and b/TVHome/TVHome.TizenTV/res/ic_tizen_home_list_allapps_normal.png differ
index 02cad5a..ac75fd9 100755 (executable)
@@ -3,11 +3,10 @@
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       xmlns:Controls="clr-namespace:TVHome.Controls"
                       x:Class="TVHome.Controls.SubPanelAllAppsButton">
-  <RelativeLayout>
-    <BoxView x:Name = "ButtonBox"
+  <RelativeLayout x:Name="ButtonBox"
              HeightRequest="186"
              WidthRequest="138"
-             Opacity="0"/>
+             HorizontalOptions="Center">
     <Image x:Name="ButtonBgImage"
            RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
            RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"
index 667381e..1b397b2 100755 (executable)
@@ -51,7 +51,7 @@ namespace TVHome.Controls
             }
 
 #pragma warning disable CS4014
-            ButtonTitle.FadeTo(0.8, 300);
+            ButtonTitle.FadeTo(0.99, 300);
             ButtonTitle.TranslateTo(0, 22, 300);
             ButtonImage.ScaleTo(1.3, 300);
 #pragma warning restore CS4014
@@ -60,9 +60,8 @@ namespace TVHome.Controls
 
         public override async void OnUnfocused(object sender, FocusEventArgs e)
         {
-            DebuggingUtils.Dbg(View.Width.ToString() + ", " + View.Height.ToString());
 #pragma warning disable CS4014
-            ButtonTitle.FadeTo(0.6, 300);
+            ButtonTitle.FadeTo(0.5, 300);
             ButtonTitle.TranslateTo(0, 0, 300);
             ButtonImage.ScaleTo(1.0, 300);
 #pragma warning restore CS4014
index c948ee5..137b5da 100755 (executable)
@@ -3,11 +3,10 @@
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
                       xmlns:Controls="clr-namespace:TVHome.Controls"\r
                       x:Class="TVHome.Controls.SubPanelButton">\r
-    <RelativeLayout>\r
-        <BoxView x:Name = "ButtonBox"\r
-                 HeightRequest="186"\r
+    <RelativeLayout x:Name="ButtonBox"\r
                  WidthRequest="138"\r
-                 Opacity="0"/>\r
+                 HeightRequest="186"\r
+                 HorizontalOptions="Center">\r
         <Image x:Name="ButtonImage"\r
                RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"\r
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"\r
index 0b7e367..68ab19e 100755 (executable)
@@ -49,7 +49,7 @@ namespace TVHome.Controls
             }\r
 \r
 #pragma warning disable CS4014\r
-            ButtonTitle.FadeTo(0.8, 300);\r
+            ButtonTitle.FadeTo(0.99, 300);\r
             ButtonTitle.TranslateTo(0, 22, 300);\r
 #pragma warning restore CS4014\r
             await ButtonImage.ScaleTo(1.3, 300);\r
@@ -58,7 +58,7 @@ namespace TVHome.Controls
         public override async void OnUnfocused(object sender, FocusEventArgs e)\r
         {\r
 #pragma warning disable CS4014\r
-            ButtonTitle.FadeTo(0.6, 300);\r
+            ButtonTitle.FadeTo(0.5, 300);\r
             ButtonTitle.TranslateTo(0, 0, 300);\r
 #pragma warning restore CS4014\r
             await ButtonImage.ScaleTo(1, 300);\r
index 26ecd62..4eb4d7c 100755 (executable)
@@ -3,11 +3,10 @@
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       xmlns:Controls="clr-namespace:TVHome.Controls"
                       x:Class="TVHome.Controls.SubPanelReservedButton">
-    <RelativeLayout>
-        <BoxView x:Name = "ButtonBox"
+    <RelativeLayout x:Name = "ButtonBox"
                  HeightRequest="186"
                  WidthRequest="138"
-                 Opacity="0"/>
+                 HorizontalOptions="Center">
         <Image x:Name="ButtonBgImage"
                RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"
index 2fad076..b3cf271 100755 (executable)
@@ -49,7 +49,7 @@ namespace TVHome.Controls
             }
 
 #pragma warning disable CS4014
-            ButtonTitle.FadeTo(0.8, 300);
+            ButtonTitle.FadeTo(0.99, 300);
             ButtonTitle.TranslateTo(0, 22, 300);
             ButtonImage.ScaleTo(1.3, 300);
 #pragma warning restore CS4014
@@ -59,7 +59,7 @@ namespace TVHome.Controls
         public override async void OnUnfocused(object sender, FocusEventArgs e)
         {
 #pragma warning disable CS4014
-            ButtonTitle.FadeTo(0.8, 300);
+            ButtonTitle.FadeTo(0.5, 300);
             ButtonTitle.TranslateTo(0, 0, 300);
             ButtonImage.ScaleTo(1, 300);
 #pragma warning restore CS4014
old mode 100644 (file)
new mode 100755 (executable)
index 6c9e79c..c60a9e9
@@ -65,6 +65,11 @@ namespace TVHome.Views
                 PageMainPanel.SelectPanel();\r
             });\r
 \r
+            AppsSubPanel.OnUnpinCommand = new Command<string>((appId) =>\r
+            {\r
+                UnpinAppShortcutInfo(appId);\r
+            });\r
+\r
             SettingsSubPanel.OnFocusedCommand = new Command(() =>\r
             {\r
                 PageMainPanel.SelectPanel();\r
@@ -75,5 +80,34 @@ namespace TVHome.Views
         {\r
             PageMainPanel.InitialFocusing();\r
         }\r
+\r
+        private void UnpinAppShortcutInfo(string appId)\r
+        {\r
+            RemovePinnedApp(appId);\r
+        }\r
+\r
+        private void UpdatePinnedApps(Dictionary<string, string> PinnedApps)\r
+        {\r
+            List<AppShortcutInfo> pinnedAppList = new List<AppShortcutInfo>();\r
+            foreach (var item in PinnedApps)\r
+            {\r
+                pinnedAppList.Add(new AppShortcutInfo()\r
+                {\r
+                    AppID = item.Key,\r
+                });\r
+            }\r
+\r
+            TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList);\r
+        }\r
+\r
+        public void RemovePinnedApp(string AppID)\r
+        {\r
+            Dictionary<string, string> PinnedApps = TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs();\r
+            if (PinnedApps.ContainsKey(AppID))\r
+            {\r
+                PinnedApps.Remove(AppID);\r
+                UpdatePinnedApps(PinnedApps);\r
+            }\r
+        }\r
     }\r
 }
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index f20cbb9..cd22ffd
@@ -33,6 +33,13 @@ namespace TVHome.Views
             set { SetValue(OnFocusedCommandProperty, value); }
         }
 
+        public static readonly BindableProperty OnUnpinCommandProperty = BindableProperty.Create("OnUnpinCommand", typeof(ICommand), typeof(SubPanel));
+
+        public ICommand OnUnpinCommand
+        {
+            get { return (ICommand)GetValue(OnUnpinCommandProperty); }
+            set { SetValue(OnUnpinCommandProperty, value); }
+        }
         public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable<ShortcutInfo>), typeof(MainPanel));
 
         public IEnumerable<ShortcutInfo> ItemsSource
index 48ae9a1..b48a7c9 100755 (executable)
@@ -71,12 +71,28 @@ namespace TVHome.Views
                 });\r
                 button.OnClickedCommand = new Command(() =>\r
                 {\r
-                    item.DoAction();\r
+                    if (item is AppShortcutInfo)\r
+                    {\r
+                        OnUnpinCommand.Execute((item as AppShortcutInfo).AppID);\r
+                    }\r
+                    else\r
+                    {\r
+                        item.DoAction();\r
+                    }\r
                 });\r
                 PanelButtonStack.Children.Add(button.View);\r
             }\r
 \r
-            HidePanel();\r
+            if (!isFocused)\r
+            {\r
+                HidePanel();\r
+            }\r
+            else\r
+            {\r
+                isFocused = false;\r
+                FocusPanel();\r
+            }\r
+\r
         }\r
 \r
         public override async void HidePanel()\r