From c7b10e56d13fda472d9bfe7b59455b4c4d506b57 Mon Sep 17 00:00:00 2001 From: Hyerim Kim Date: Wed, 15 Mar 2017 18:29:49 +0900 Subject: [PATCH] Add Unpin action in home Modify FileSystemWatcher filter to pinned_apps_info.xml Add missing resources Change-Id: I6c1df1726d0b25e720b121f3b36c6608d06a5580 Signed-off-by: Hyerim Kim --- LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs | 4 +-- .../res/ic_tizen_home_list_addpin_focused.png | Bin 0 -> 1020 bytes .../res/ic_tizen_home_list_allapps_normal.png | Bin 0 -> 1287 bytes TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml | 5 ++- .../TVHome/Controls/SubPanelAllAppsButton.xaml.cs | 5 ++- TVHome/TVHome/Controls/SubPanelButton.xaml | 7 ++--- TVHome/TVHome/Controls/SubPanelButton.xaml.cs | 4 +-- TVHome/TVHome/Controls/SubPanelReservedButton.xaml | 5 ++- .../TVHome/Controls/SubPanelReservedButton.xaml.cs | 4 +-- TVHome/TVHome/Views/MainPage.xaml.cs | 34 +++++++++++++++++++++ TVHome/TVHome/Views/Panel.cs | 7 +++++ TVHome/TVHome/Views/SubPanel.xaml.cs | 20 ++++++++++-- 12 files changed, 74 insertions(+), 21 deletions(-) mode change 100644 => 100755 LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs create mode 100755 TVHome/TVHome.TizenTV/res/ic_tizen_home_list_addpin_focused.png create mode 100755 TVHome/TVHome.TizenTV/res/ic_tizen_home_list_allapps_normal.png mode change 100644 => 100755 TVHome/TVHome/Views/MainPage.xaml.cs mode change 100644 => 100755 TVHome/TVHome/Views/Panel.cs diff --git a/LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs b/LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs old mode 100644 new mode 100755 index 8a926dd..3ef228a --- a/LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs +++ b/LibTVRefCommonTizen/Ports/FileSystemWatcherPort.cs @@ -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 index 0000000000000000000000000000000000000000..a0830ef8e620654dcca8b3fc6a7b45faaf9b0c28 GIT binary patch literal 1020 zcmaJ=y>HV%6psV~RJCG5h3Rk>kcdC>;Wnq5Dv2E$sg5Ei&;UZJV_y?1wa+XRDJctcGE6Ukv2n~Bu{WThmdC!>PT@L~`cM!Cg8@It@R+m(DWA_r8tHV3 zAyUDXN6j$h1<8qmiUNx`K6S7MB1N->`&8jrq(@h9{i&=MjMKytCWNLhNW2(bX#&*s z|3h7OiVmoOj^q8OaM0NDkzk+z_ld;{w~>ro`LINgNik_)ygA8Yt%E5JI@kxLx(u$Y zIi8IN!POC7*I~sAsOed#qADCy;2podM)>jDzBH4#JgdD?U;WwH-T82L-u!wG z%c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`Y;Iub=IrF==44=IXy|HY>F8wXYGGjRVq)rS z;AHFs)9aF-T$-DjR|3w=apWAt*CQ0P=A>YigTe~DWM4fe8J4I literal 0 HcmV?d00001 diff --git a/TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml b/TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml index 02cad5a..ac75fd9 100755 --- a/TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml +++ b/TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml @@ -3,11 +3,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:Controls="clr-namespace:TVHome.Controls" x:Class="TVHome.Controls.SubPanelAllAppsButton"> - - + HorizontalOptions="Center"> - - + HeightRequest="186" + HorizontalOptions="Center"> - - + HorizontalOptions="Center"> ((appId) => + { + UnpinAppShortcutInfo(appId); + }); + SettingsSubPanel.OnFocusedCommand = new Command(() => { PageMainPanel.SelectPanel(); @@ -75,5 +80,34 @@ namespace TVHome.Views { PageMainPanel.InitialFocusing(); } + + private void UnpinAppShortcutInfo(string appId) + { + RemovePinnedApp(appId); + } + + private void UpdatePinnedApps(Dictionary PinnedApps) + { + List pinnedAppList = new List(); + foreach (var item in PinnedApps) + { + pinnedAppList.Add(new AppShortcutInfo() + { + AppID = item.Key, + }); + } + + TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList); + } + + public void RemovePinnedApp(string AppID) + { + Dictionary PinnedApps = TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs(); + if (PinnedApps.ContainsKey(AppID)) + { + PinnedApps.Remove(AppID); + UpdatePinnedApps(PinnedApps); + } + } } } \ No newline at end of file diff --git a/TVHome/TVHome/Views/Panel.cs b/TVHome/TVHome/Views/Panel.cs old mode 100644 new mode 100755 index f20cbb9..cd22ffd --- a/TVHome/TVHome/Views/Panel.cs +++ b/TVHome/TVHome/Views/Panel.cs @@ -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), typeof(MainPanel)); public IEnumerable ItemsSource diff --git a/TVHome/TVHome/Views/SubPanel.xaml.cs b/TVHome/TVHome/Views/SubPanel.xaml.cs index 48ae9a1..b48a7c9 100755 --- a/TVHome/TVHome/Views/SubPanel.xaml.cs +++ b/TVHome/TVHome/Views/SubPanel.xaml.cs @@ -71,12 +71,28 @@ namespace TVHome.Views }); button.OnClickedCommand = new Command(() => { - item.DoAction(); + if (item is AppShortcutInfo) + { + OnUnpinCommand.Execute((item as AppShortcutInfo).AppID); + } + else + { + item.DoAction(); + } }); PanelButtonStack.Children.Add(button.View); } - HidePanel(); + if (!isFocused) + { + HidePanel(); + } + else + { + isFocused = false; + FocusPanel(); + } + } public override async void HidePanel() -- 2.7.4