From: Hyerim Kim Date: Wed, 15 Mar 2017 09:29:49 +0000 (+0900) Subject: Add Unpin action in home X-Git-Tag: submit/tizen/20170808.015446~197 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7b10e56d13fda472d9bfe7b59455b4c4d506b57;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Add Unpin action in home Modify FileSystemWatcher filter to pinned_apps_info.xml Add missing resources Change-Id: I6c1df1726d0b25e720b121f3b36c6608d06a5580 Signed-off-by: Hyerim Kim --- 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 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 index 0000000..12517bc Binary files /dev/null and b/TVHome/TVHome.TizenTV/res/ic_tizen_home_list_allapps_normal.png differ 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()