From 8afd3008738d8f9f081a066f3c69a5844d30426b Mon Sep 17 00:00:00 2001 From: Hyerim Kim Date: Tue, 12 Sep 2017 17:16:14 +0900 Subject: Removes Recent menu in Home Removes unneccessary codes Change-Id: Iaa61f4ad639c653531c1cd4eb61460eff52568af Signed-off-by: Hyerim Kim --- TVHome/TVHome.Tizen.TV/Sniper.cs | 329 ------------------- TVHome/TVHome.Tizen.TV/SniperException.cs | 39 --- TVHome/TVHome.Tizen.TV/SniperInterOp.cs | 54 --- TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs | 33 -- TVHome/TVHome/Controls/PanelButton.cs | 10 - .../TVHome/Controls/SubPanelThumbnailButton.xaml | 47 --- .../Controls/SubPanelThumbnailButton.xaml.cs | 168 ---------- TVHome/TVHome/ViewModels/AppListViewModel.cs | 11 +- TVHome/TVHome/ViewModels/MainPageViewModel.cs | 7 +- TVHome/TVHome/ViewModels/MainPanelViewModel.cs | 26 +- TVHome/TVHome/ViewModels/RecentListViewModel.cs | 206 ------------ TVHome/TVHome/ViewModels/SettingsViewModel.cs | 5 +- TVHome/TVHome/Views/MainPage.xaml | 9 - TVHome/TVHome/Views/MainPage.xaml.cs | 62 +--- TVHome/TVHome/Views/MainPanel.xaml.cs | 6 +- TVHome/TVHome/Views/Panel.cs | 30 -- TVHome/TVHome/Views/SubPanel.xaml.cs | 1 - TVHome/TVHome/Views/SubThumbnailPanel.xaml | 46 --- TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs | 363 --------------------- 19 files changed, 15 insertions(+), 1437 deletions(-) delete mode 100755 TVHome/TVHome.Tizen.TV/Sniper.cs delete mode 100755 TVHome/TVHome.Tizen.TV/SniperException.cs delete mode 100755 TVHome/TVHome.Tizen.TV/SniperInterOp.cs mode change 100644 => 100755 TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs delete mode 100755 TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml delete mode 100755 TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs mode change 100644 => 100755 TVHome/TVHome/ViewModels/AppListViewModel.cs mode change 100644 => 100755 TVHome/TVHome/ViewModels/MainPanelViewModel.cs delete mode 100644 TVHome/TVHome/ViewModels/RecentListViewModel.cs mode change 100644 => 100755 TVHome/TVHome/ViewModels/SettingsViewModel.cs delete mode 100755 TVHome/TVHome/Views/SubThumbnailPanel.xaml delete mode 100755 TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs (limited to 'TVHome') diff --git a/TVHome/TVHome.Tizen.TV/Sniper.cs b/TVHome/TVHome.Tizen.TV/Sniper.cs deleted file mode 100755 index db8799c..0000000 --- a/TVHome/TVHome.Tizen.TV/Sniper.cs +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Tizen; - -namespace CoreApp -{ - /// - /// Handles recent screen shot of launched applications - /// - public class Sniper - { - /// - /// Main window of the application - /// - private IntPtr nativeWindow; - - /// - /// A path of storage for recent screen shot of launched application - /// - private string storagePath; - - /// - /// A width of recent screen shot - /// - private int imageWidth; - - /// - /// A height of recent screen shot - /// - private int imageHeight; - - /// - /// A flag indicates whether updating recent screen shot or not - /// - public bool SkipUpdateFlag; - - /// - /// Callbacks of sniper events - /// - private static InterOp.SniperCallback callbacks; - - /// - /// A EventHandler handles recent screen shot update event - /// - public event EventHandler UpdatedEvent; - - /// - /// A EventHandler handles add or remove application - /// - public event EventHandler AddRemoveEvent; - - /// - /// A EventHandler handles skip update event - /// - public event EventHandler SkipUpdateEvent; - - /// - /// A event argument class for app screen update notification. - /// - public class Event : EventArgs - { - public string AppId; - public string InstanceId; - public string Info; - } - - /// - /// A method for writing debug log - /// - /// A log message - /// A path of caller file - /// A name of caller function - /// A line number of caller line - private void WriteLog(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) - { - Log.Debug("sniper", message); - } - - /// - /// A method for handling launched application - /// - /// An ID of launched application - /// An instance ID of launched application - private void AddedCallback(string appId, string instanceId) - { - EventHandler handler = AddRemoveEvent; - Event eventInfo; - - WriteLog("Added " + appId + " " + instanceId); - - if (handler == null) - { - return; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("Updated Exception : " + e.Message); - return; - } - - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - eventInfo.Info = "Added"; - - handler(this, eventInfo); - } - - /// - /// A method for handling terminated application - /// - /// An ID of terminated application - /// An instance ID of terminated application - private void RemovedCallback(string appId, string instanceId) - { - EventHandler handler = AddRemoveEvent; - Event eventInfo; - - WriteLog("Removed " + appId + " " + instanceId); - - if (handler == null) - { - return; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("Updated Exception : " + e.Message); - return; - } - - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - eventInfo.Info = "Removed"; - - handler(this, eventInfo); - } - - /// - /// A method for handling application screen is updated - /// - /// An ID of application that screen is updated - /// An instance ID of application that screen is updated - /// A path of application screen shot - private void UpdatedCallback(string appId, string instanceId, string Filename) - { - EventHandler handler = UpdatedEvent; - Event eventInfo; - - WriteLog("Updated " + appId + " " + instanceId + " " + Filename); - - if (handler == null) - { - return; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("Updated Exception : " + e.Message); - return; - } - - eventInfo.Info = Filename; - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - - handler(this, eventInfo); - } - - /// - /// A method for handling screen update is skipped - /// - /// An ID of application that screen update is skipped - /// An instance ID of application that screen update is skipped - /// A path of application screen shot - /// Returns finish code - private int SkipUpdateCallback(string appId, string instanceId, string Filename) - { - EventHandler handler = SkipUpdateEvent; - Event eventInfo; - - WriteLog("SkipUpdate" + appId + " " + instanceId + " " + Filename); - - if (handler == null) - { - return 0; - } - - try - { - eventInfo = new Event(); - } - catch (Exception e) - { - WriteLog("SkipUpdated Exception : " + e.Message); - return 0; - } - - eventInfo.Info = Filename; - eventInfo.AppId = appId; - eventInfo.InstanceId = instanceId; - - handler(this, eventInfo); - - if (SkipUpdateFlag) - { - WriteLog("Update is skipped : " + Filename); - SkipUpdateFlag = false; - return 1; - } - - return 0; - } - - /// - /// Constructor - /// - /// Main window of this application - /// Storage path - /// Screen shot width - /// Screen shot height - public Sniper(IntPtr window, string path, int width, int height) - { - nativeWindow = window; - storagePath = path; - imageWidth = width; - imageHeight = height; - SkipUpdateFlag = false; - } - - /// - /// A method for starting monitoring - /// Adds callbacks and initialize Sniper class - /// - public void StartMonitor() - { - try - { - callbacks = new InterOp.SniperCallback(); - callbacks.Added = new InterOp.CallbackAddedRemoved(AddedCallback); - callbacks.Removed = new InterOp.CallbackAddedRemoved(RemovedCallback); - callbacks.Updated = new InterOp.CallbackUpdated(UpdatedCallback); - callbacks.SkipUpdate = new InterOp.CallbackSkipUpdate(SkipUpdateCallback); - } - catch (Exception e) - { - throw new SniperException(e.Message); - } - - try - { - InterOp.sniper_init(nativeWindow, callbacks, storagePath, imageWidth, imageHeight); - } - catch (DllNotFoundException e) - { - WriteLog("Loadable library is not found " + e.StackTrace); - } - - WriteLog("Sniper starts monitoring : " + storagePath + "ImageSize : " + imageWidth + "x" + imageHeight); - } - - /// - /// A method stops monitoring - /// - public void StopMonitor() - { - try - { - InterOp.sniper_fini(); - } - catch (DllNotFoundException e) - { - WriteLog("Loadable library is not found " + e.StackTrace); - } - - WriteLog("Sniper stops monitoring : " + storagePath + "ImageSize : " + imageWidth + "x" + imageHeight); - } - - /// - /// A method requests updating application screen shot - /// - /// An instance ID of application - public void RequestUpdate(string instanceId) - { - try - { - InterOp.sniper_request_update(instanceId); - } - catch (DllNotFoundException e) - { - WriteLog("Loadable library is not found " + e.StackTrace); - } - - WriteLog("Sniper requests update (" + instanceId + ") : " + storagePath + "ImageSize : " + imageWidth + "x" + imageHeight); - } - } -} - -/* End of a file */ diff --git a/TVHome/TVHome.Tizen.TV/SniperException.cs b/TVHome/TVHome.Tizen.TV/SniperException.cs deleted file mode 100755 index ab2d391..0000000 --- a/TVHome/TVHome.Tizen.TV/SniperException.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; - -namespace CoreApp -{ - public class SniperException : Exception - { - public SniperException() - { - } - - public SniperException(string message) - : base(message) - { - } - - public SniperException(string message, Exception inner) - : base(message, inner) - { - } - } -} - -/* End of a file */ diff --git a/TVHome/TVHome.Tizen.TV/SniperInterOp.cs b/TVHome/TVHome.Tizen.TV/SniperInterOp.cs deleted file mode 100755 index aa7e936..0000000 --- a/TVHome/TVHome.Tizen.TV/SniperInterOp.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace CoreApp -{ - /// - /// Sniper InterOp class for getting application's screen-shot. - /// - internal static partial class InterOp - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CallbackAddedRemoved(string appId, string instanceId); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CallbackUpdated(string appId, string instanceId, string filename); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int CallbackSkipUpdate(string appid, string instanceId, string filename); - - [StructLayout(LayoutKind.Sequential)] - public struct SniperCallback - { - public CallbackAddedRemoved Added; - public CallbackAddedRemoved Removed; - public CallbackUpdated Updated; - public CallbackSkipUpdate SkipUpdate; - } - - [DllImport("sniper", CharSet = CharSet.Ansi)] - internal static extern int sniper_init(IntPtr win, SniperCallback callbacks, string path, int w, int h); - - [DllImport("sniper", CharSet = CharSet.Ansi)] - internal static extern int sniper_request_update(string instanceId); - - [DllImport("sniper", CharSet = CharSet.Ansi)] - internal static extern int sniper_fini(); - } -} - -/* End of a file */ diff --git a/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs b/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs old mode 100644 new mode 100755 index 78845d8..4cb7007 --- a/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs +++ b/TVHome/TVHome.Tizen.TV/TVHome.TizenTV.cs @@ -18,8 +18,6 @@ using Tizen.Applications; using LibTVRefCommonPortable.Utils; using LibTVRefCommonTizen.Ports; using Tizen.Xamarin.Forms.Extension.Renderer; -using CoreApp; -using System; namespace TVHome.TizenTV { @@ -78,36 +76,6 @@ namespace TVHome.TizenTV MainWindow.KeyGrab("Left", false); MainWindow.KeyGrab("Right", false); windowPort.SetKeyGrabExclusively(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName); - - /// Sniper - try - { - Sniper sniper = new Sniper((IntPtr)MainWindow, platformShareStoragePath, 960, 540); - sniper.UpdatedEvent += OnScreenUpdate; - sniper.AddRemoveEvent += SniperAddRemoveEvent; - sniper.SkipUpdateEvent += SniperSkipUpdateEvent; - sniper.StartMonitor(); - } - catch (SniperException e) - { - DbgPort.E("Failed to create sniper object : " + e.Message); - } - } - - private void SniperSkipUpdateEvent(object sender, Sniper.Event e) - { - DbgPort.D(" [Sniper SkipUpdateEvent] : " + e.Info); - (sender as Sniper).SkipUpdateFlag = true; - } - - private void SniperAddRemoveEvent(object sender, Sniper.Event e) - { - DbgPort.D(" [Sniper SniperAddRemoveEvent] : " + e.Info); - } - - private void OnScreenUpdate(object sender, Sniper.Event e) - { - DbgPort.D(" [Sniper OnScreenUpdate] : " + e.Info); } /// @@ -190,7 +158,6 @@ namespace TVHome.TizenTV global::Xamarin.Forms.DependencyService.Register(); global::Xamarin.Forms.DependencyService.Register(); global::Xamarin.Forms.DependencyService.Register(); - global::Xamarin.Forms.DependencyService.Register(); TizenFormsExtension.Init(); global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); app.Run(args); diff --git a/TVHome/TVHome/Controls/PanelButton.cs b/TVHome/TVHome/Controls/PanelButton.cs index 35e735d..21a697f 100755 --- a/TVHome/TVHome/Controls/PanelButton.cs +++ b/TVHome/TVHome/Controls/PanelButton.cs @@ -131,16 +131,6 @@ namespace TVHome.Controls /// public ICommand OnUnpinCommand { get; set; } - /// - /// A Command will be executed the recent is removed. - /// - public ICommand OnClearCommand { get; set; } - - /// - /// A Command will be executed the all recent are cleared. - /// - public ICommand OnClearAllCommand { get; set; } - /// /// A Command changes Panel Button to default mode. /// diff --git a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml b/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml deleted file mode 100755 index 7d2a541..0000000 --- a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - -