diff options
author | Hyerim Kim <rimi.kim@samsung.com> | 2017-09-12 17:16:14 +0900 |
---|---|---|
committer | Hyerim Kim <rimi.kim@samsung.com> | 2017-09-12 17:16:14 +0900 |
commit | 8afd3008738d8f9f081a066f3c69a5844d30426b (patch) | |
tree | 50d8c7f8b62a3ea89de1b704dc6e1d3d3d330618 /TVHome | |
parent | d357ba3d5c34bd735142e4de3738852ce19095db (diff) | |
download | home-8afd3008738d8f9f081a066f3c69a5844d30426b.tar.gz home-8afd3008738d8f9f081a066f3c69a5844d30426b.tar.bz2 home-8afd3008738d8f9f081a066f3c69a5844d30426b.zip |
Removes Recent menu in Home
Removes unneccessary codes
Change-Id: Iaa61f4ad639c653531c1cd4eb61460eff52568af
Signed-off-by: Hyerim Kim <rimi.kim@samsung.com>
Diffstat (limited to 'TVHome')
19 files changed, 15 insertions, 1437 deletions
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 -{ - /// <summary> - /// Handles recent screen shot of launched applications - /// </summary> - public class Sniper - { - /// <summary> - /// Main window of the application - /// </summary> - private IntPtr nativeWindow; - - /// <summary> - /// A path of storage for recent screen shot of launched application - /// </summary> - private string storagePath; - - /// <summary> - /// A width of recent screen shot - /// </summary> - private int imageWidth; - - /// <summary> - /// A height of recent screen shot - /// </summary> - private int imageHeight; - - /// <summary> - /// A flag indicates whether updating recent screen shot or not - /// </summary> - public bool SkipUpdateFlag; - - /// <summary> - /// Callbacks of sniper events - /// </summary> - private static InterOp.SniperCallback callbacks; - - /// <summary> - /// A EventHandler handles recent screen shot update event - /// </summary> - public event EventHandler<Event> UpdatedEvent; - - /// <summary> - /// A EventHandler handles add or remove application - /// </summary> - public event EventHandler<Event> AddRemoveEvent; - - /// <summary> - /// A EventHandler handles skip update event - /// </summary> - public event EventHandler<Event> SkipUpdateEvent; - - /// <summary> - /// A event argument class for app screen update notification. - /// </summary> - public class Event : EventArgs - { - public string AppId; - public string InstanceId; - public string Info; - } - - /// <summary> - /// A method for writing debug log - /// </summary> - /// <param name="message">A log message</param> - /// <param name="file">A path of caller file</param> - /// <param name="func">A name of caller function</param> - /// <param name="line">A line number of caller line</param> - private void WriteLog(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) - { - Log.Debug("sniper", message); - } - - /// <summary> - /// A method for handling launched application - /// </summary> - /// <param name="appId">An ID of launched application</param> - /// <param name="instanceId">An instance ID of launched application</param> - private void AddedCallback(string appId, string instanceId) - { - EventHandler<Event> 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); - } - - /// <summary> - /// A method for handling terminated application - /// </summary> - /// <param name="appId">An ID of terminated application</param> - /// <param name="instanceId">An instance ID of terminated application</param> - private void RemovedCallback(string appId, string instanceId) - { - EventHandler<Event> 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); - } - - /// <summary> - /// A method for handling application screen is updated - /// </summary> - /// <param name="appId">An ID of application that screen is updated</param> - /// <param name="instanceId">An instance ID of application that screen is updated</param> - /// <param name="Filename">A path of application screen shot</param> - private void UpdatedCallback(string appId, string instanceId, string Filename) - { - EventHandler<Event> 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); - } - - /// <summary> - /// A method for handling screen update is skipped - /// </summary> - /// <param name="appId">An ID of application that screen update is skipped</param> - /// <param name="instanceId">An instance ID of application that screen update is skipped</param> - /// <param name="Filename">A path of application screen shot</param> - /// <returns>Returns finish code</returns> - private int SkipUpdateCallback(string appId, string instanceId, string Filename) - { - EventHandler<Event> 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; - } - - /// <summary> - /// Constructor - /// </summary> - /// <param name="window">Main window of this application</param> - /// <param name="path">Storage path</param> - /// <param name="width">Screen shot width</param> - /// <param name="height">Screen shot height</param> - public Sniper(IntPtr window, string path, int width, int height) - { - nativeWindow = window; - storagePath = path; - imageWidth = width; - imageHeight = height; - SkipUpdateFlag = false; - } - - /// <summary> - /// A method for starting monitoring - /// Adds callbacks and initialize Sniper class - /// </summary> - 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); - } - - /// <summary> - /// A method stops monitoring - /// </summary> - 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); - } - - /// <summary> - /// A method requests updating application screen shot - /// </summary> - /// <param name="instanceId">An instance ID of application</param> - 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 -{ - /// <summary> - /// Sniper InterOp class for getting application's screen-shot. - /// </summary> - 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 index 78845d8..4cb7007 100644..100755 --- 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); } /// <summary> @@ -190,7 +158,6 @@ namespace TVHome.TizenTV global::Xamarin.Forms.DependencyService.Register<FileSystemPort>(); global::Xamarin.Forms.DependencyService.Register<WindowPort>(); global::Xamarin.Forms.DependencyService.Register<SystemSettingsPort>(); - global::Xamarin.Forms.DependencyService.Register<MediaContentPort>(); 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 @@ -132,16 +132,6 @@ namespace TVHome.Controls public ICommand OnUnpinCommand { get; set; } /// <summary> - /// A Command will be executed the recent is removed. - /// </summary> - public ICommand OnClearCommand { get; set; } - - /// <summary> - /// A Command will be executed the all recent are cleared. - /// </summary> - public ICommand OnClearAllCommand { get; set; } - - /// <summary> /// A Command changes Panel Button to default mode. /// </summary> public ICommand OnDefaultModeCommand { get; set; } 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Controls:PanelButton xmlns="http://xamarin.com/schemas/2014/forms" - xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:Controls="clr-namespace:TVHome.Controls" - x:Class="TVHome.Controls.SubPanelThumbnailButton"> - <Image x:Name="ThumbnailImage" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - Source="{Binding ScreenshotPath}" /> - <Controls:NinePatchImage x:Name="ThumbnailGradient" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - Aspect="Fill" - BorderTop="2" - BorderBottom="2" - BorderLeft="1" - BorderRight="1" - Source="ic_list_thumbnail_gradient_normal.9.png" /> - <Image x:Name="ThumbnailIcon" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.043}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.689}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.131}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.233}" - Source="{Binding CurrentStateDescription.IconPath}" /> - <Label x:Name="ThumbnailTitle" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.206}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.722}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.75}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.166}" - LineBreakMode="TailTruncation" - FontFamily="BreezeSans" - Text="{Binding CurrentStateDescription.Label}" - TextColor="#FFFFFF"/> - <Image x:Name="ThumnailDimLayer" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - Aspect="Fill" - Opacity="0.99" - Source="img_tizen_home_list_dimmed_recent.png"/> - <Button x:Name="ButtonFocusArea" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - Focused="OnFocused" - Unfocused="OnUnfocused" - Clicked="OnClicked" - Opacity="0" /> -</Controls:PanelButton>
\ No newline at end of file diff --git a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs b/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs deleted file mode 100755 index b0a487e..0000000 --- a/TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs +++ /dev/null @@ -1,168 +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 LibTVRefCommonPortable.Utils; -using System; -using Tizen.Xamarin.Forms.Extension; -using Xamarin.Forms; -using Xamarin.Forms.PlatformConfiguration.TizenSpecific; - -namespace TVHome.Controls -{ - /// <summary> - /// Custom Control for Thumbnail Button in Sub Panel - /// </summary> - public partial class SubPanelThumbnailButton : PanelButton - { - /// <summary> - /// Constructor - /// </summary> - public SubPanelThumbnailButton() - { - InitializeComponent(); - - WidthRequest = SizeUtils.GetWidthSize(320); - HeightRequest = SizeUtils.GetHeightSize(180); - ThumbnailTitle.FontSize = SizeUtils.GetFontSize(26); - ThumbnailTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal); - - } - - /// <summary> - /// Handles Button Clicked event - /// </summary> - /// <param name="sender">The source of the event</param> - /// <param name="e">The event that is occurred when button is clicked</param> - public override async void OnClicked(object sender, EventArgs e) - { - OnClickedCommand?.Execute(""); - - await this.FadeTo(0.9, 300); - } - - /// <summary> - /// Handles Button Focused event - /// </summary> - /// <param name="sender">The source of the event</param> - /// <param name="e">The event that is occurred when button is focused</param> - public override async void OnFocused(object sender, FocusEventArgs e) - { - DebuggingUtils.Dbg("SubPanelThumbnailButton " + ThumbnailTitle.Text + " - OnFocused"); - - PanelButtonState = PanelButtonState.Focused; - - OnFocusedCommand?.Execute(""); - -#pragma warning disable CS4014 - ThumbnailGradient.Source = "ic_list_thumbnail_gradient_focused.9.png"; - ThumbnailTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Medium); - //ThumbnailTitle.FadeTo(0.8, 300); -#pragma warning restore CS4014 - await this.ScaleTo(1.2, 300); - } - - /// <summary> - /// Handles Button Unfocused event - /// </summary> - /// <param name="sender">The source of the event</param> - /// <param name="e">The event that is occurred when button is unfocused</param> - public override async void OnUnfocused(object sender, FocusEventArgs e) - { - DebuggingUtils.Dbg("SubPanelThumbnailButton " + ThumbnailTitle.Text + " - OnUnfocused"); - - if (!IsOptionsShowing) - { - PanelButtonState = PanelButtonState.Show; - } - -#pragma warning disable CS4014 - //ThumbnailTitle.FadeTo(0.3, 300); - ThumbnailGradient.Source = "ic_list_thumbnail_gradient_normal.9.png"; - ThumbnailTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal); -#pragma warning restore CS4014 - await this.ScaleTo(1.0, 300); - } - - public override void OnMoveStarting() - { - - } - - /// <summary> - /// A method for handling the button when button is changed to move mode - /// </summary> - /// <param name="isMoveCanceled">A flag indicates whether moving is canceled or not</param> - public override void OnMoveFinishing(bool isMoveCanceled) - { - - } - - /// <summary> - /// A method for showing Context popup - /// </summary> - public override void ShowContextPopup() - { - if (popup != null) - { - return; - } - - popup = new ContextPopup - { - IsAutoHidingEnabled = true, - DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Down, ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left) - }; - - PanelButtonState = PanelButtonState.ShowingOption; - - popup.Items.Add(new ContextPopupItem("REMOVE")); - popup.Items.Add(new ContextPopupItem("CLEAR ALL")); - - popup.SelectedIndexChanged += (sender, args) => - { - var ctxPopup = sender as ContextPopup; - switch (ctxPopup.SelectedIndex) - { - case 0: - OnClearCommand.Execute(""); - ctxPopup.Dismiss(); - break; - - case 1: - OnClearAllCommand.Execute(""); - ctxPopup.Dismiss(); - break; - } - }; - - popup.Dismissed += (sender, args) => - { - popup = null; - }; - - DebuggingUtils.Dbg("auto hiding = " + popup.IsAutoHidingEnabled); - - popup.Show(this); - } - - /// <summary> - /// A method for changing context popup mode - /// </summary> - /// <param name="showOptions">Options for change context popup mode</param> - public override void ChangeShowOptionsMode(bool showOptions) - { - } - } -}
\ No newline at end of file diff --git a/TVHome/TVHome/ViewModels/AppListViewModel.cs b/TVHome/TVHome/ViewModels/AppListViewModel.cs index 509c659..998a0e5 100644..100755 --- a/TVHome/TVHome/ViewModels/AppListViewModel.cs +++ b/TVHome/TVHome/ViewModels/AppListViewModel.cs @@ -17,18 +17,16 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; using Xamarin.Forms; -using LibTVRefCommonPortable.Models; using TVHome.Views; namespace TVHome.ViewModels { /// <summary> - /// A class for ViewModel of TV Home Recent Menu List + /// A class for ViewModel of TV Home Menu List /// </summary> public class AppListViewModel : INotifyPropertyChanged, IStateSubscriber { @@ -120,8 +118,6 @@ namespace TVHome.ViewModels DebuggingUtils.Dbg("OnUnpinCommand "); UnpinAppShortcutInfo(appId); }); - - } /// <summary> @@ -172,7 +168,6 @@ namespace TVHome.ViewModels } - /// <summary> /// A method for updating pinned applications /// </summary> @@ -227,8 +222,6 @@ namespace TVHome.ViewModels public void OnStateChanged(AppState state) { - //DebuggingUtils.Dbg("AppPanel OnStateChanged " + state); - switch (state) { case AppState.HomeMainPanelAppsFocused: @@ -253,7 +246,5 @@ namespace TVHome.ViewModels } } - - } } diff --git a/TVHome/TVHome/ViewModels/MainPageViewModel.cs b/TVHome/TVHome/ViewModels/MainPageViewModel.cs index e371045..76bfb26 100755 --- a/TVHome/TVHome/ViewModels/MainPageViewModel.cs +++ b/TVHome/TVHome/ViewModels/MainPageViewModel.cs @@ -17,11 +17,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; -using LibTVRefCommonPortable.Models; namespace TVHome.ViewModels { @@ -30,8 +26,7 @@ namespace TVHome.ViewModels /// </summary> public enum HomeMenuItem { - Recent = 0, - Apps, + Apps = 0, Settings, NotSelected, }; diff --git a/TVHome/TVHome/ViewModels/MainPanelViewModel.cs b/TVHome/TVHome/ViewModels/MainPanelViewModel.cs index 5191d07..d956a10 100644..100755 --- a/TVHome/TVHome/ViewModels/MainPanelViewModel.cs +++ b/TVHome/TVHome/ViewModels/MainPanelViewModel.cs @@ -20,7 +20,6 @@ using System.ComponentModel; using System.Linq; using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; using LibTVRefCommonPortable.Models; using TVHome.Views; @@ -28,7 +27,7 @@ namespace TVHome.ViewModels { /// <summary> - /// A class for ViewModel of TV Home Recent Menu List + /// A class for ViewModel of TV Home Menu List /// </summary> public class MainPanelViewModel : INotifyPropertyChanged, IStateSubscriber { @@ -74,24 +73,15 @@ namespace TVHome.ViewModels set { - /* - if (focusedItemIndex == value) - { - return; - } - */ focusedItemIndex = value; DebuggingUtils.Dbg("FocusedItemIndex => " + value); switch (focusedItemIndex) { case 0: - MainPageViewModel.Publisher.CurrentState = AppState.HomeMainPanelRecentFocused; - return; - case 1: MainPageViewModel.Publisher.CurrentState = AppState.HomeMainPanelAppsFocused; return; - case 2: + case 1: MainPageViewModel.Publisher.CurrentState = AppState.HomeMainPanelSettingsFocused; return; } @@ -114,8 +104,6 @@ namespace TVHome.ViewModels MakeMainMenuItems(); - //FocusedItemIndex = 1; - MainPageViewModel.Instance.RegisterStateSubscriber(this); } @@ -125,8 +113,8 @@ namespace TVHome.ViewModels /// </summary> private void MakeMainMenuItems() { - string[] AppName = { "Recent", "Apps", "Settings" }; - string[] AppControlID = { ManagedApps.TVAppsAppID, ManagedApps.TVAppsAppID, ManagedApps.SettingsAppID }; + string[] AppName = { "Apps", "Settings" }; + string[] AppControlID = { ManagedApps.TVAppsAppID, ManagedApps.SettingsAppID }; string[] AppIconPath = { "ic_home_menu_{0}_normal.png", @@ -215,12 +203,9 @@ namespace TVHome.ViewModels public void OnStateChanged(AppState state) { - //DebuggingUtils.Dbg("MainPanel OnStateChanged " + state); - switch (state) { case AppState.HomeMainPanelAppsFocused: - case AppState.HomeMainPanelRecentFocused: case AppState.HomeMainPanelSettingsFocused: MainPanelState = PanelState.Focused; @@ -234,7 +219,6 @@ namespace TVHome.ViewModels OnPropertyChanged("MainList"); break; - case AppState.HomeSubPanelRecentFocused: case AppState.HomeSubPanelAppsFocused: case AppState.HomeSubPanelSettingsFocused: foreach (var menuItem in MainList) @@ -246,8 +230,6 @@ namespace TVHome.ViewModels (MainList.ElementAt(FocusedItemIndex) as HomeMenuAppShortcutInfo)?.ChangeStatus("selected"); OnPropertyChanged("MainList"); MainPanelState = PanelState.Show; - - break; case AppState.HomeShowOptions: diff --git a/TVHome/TVHome/ViewModels/RecentListViewModel.cs b/TVHome/TVHome/ViewModels/RecentListViewModel.cs deleted file mode 100644 index 73ddbd4..0000000 --- a/TVHome/TVHome/ViewModels/RecentListViewModel.cs +++ /dev/null @@ -1,206 +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.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using LibTVRefCommonPortable.DataModels; -using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; -using LibTVRefCommonPortable.Models; -using TVHome.Views; - -namespace TVHome.ViewModels -{ - - /// <summary> - /// A class for ViewModel of TV Home Recent Menu List - /// </summary> - public class RecentListViewModel : INotifyPropertyChanged, IStateSubscriber - { - private static readonly Lazy<RecentListViewModel> instance = new Lazy<RecentListViewModel>(() => new RecentListViewModel()); - - public static RecentListViewModel Instance - { - get - { - return instance.Value; - } - } - - private PanelState recentSubPanelState; - public PanelState RecentSubPanelState - { - set - { - if (recentSubPanelState == value) - { - return; - } - - DebuggingUtils.Dbg("RecentSubPanelState, set - " + value); - - switch (value) - { - case PanelState.Focused: - if (MainPageViewModel.Publisher.CurrentState == AppState.HomeMainPanelRecentFocused) - { - MainPageViewModel.Publisher.CurrentState = AppState.HomeSubPanelRecentFocused; - } - - break; - - case PanelState.Iconified: - MainPageViewModel.Publisher.CurrentState = AppState.HomeIconified; - break; - } - - recentSubPanelState = value; - OnPropertyChanged("RecentSubPanelState"); - } - - get - { - return recentSubPanelState; - } - } - - - - /// <summary> - /// Gets or set RecentList for Recent SubPanel - /// </summary> - public IEnumerable<ShortcutInfo> RecentList { get; set; } - - - /// <summary> - /// A command for delete a recent item - /// </summary> - public Command OnClearCommand { get; set; } - - /// <summary> - /// A command for delete all recent items - /// </summary> - public Command OnClearAllCommand { get; set; } - - private RecentListViewModel() - { - DebuggingUtils.Dbg("RecentListViewModel"); - - MakeRecentButtons(); - - MainPageViewModel.Instance.RegisterStateSubscriber(this); - - OnClearCommand = new Command<string>((appId) => - { - RemoveRecentApplication(appId); - }); - - OnClearAllCommand = new Command(() => - { - ClearAllRecentApplications(); - }); - - MessagingCenter.Subscribe<App, TVHomeStatus>(this, App.AppStatus, (sender, arg) => - { - switch (arg) - { - case TVHomeStatus.OnResume: - MakeRecentButtons(); - break; - } - }); - } - - /// <summary> - /// Gets the RecentList for displaying items and updates the list to Recent SubPanel - /// </summary> - private void MakeRecentButtons() - { - // @TODO : Check ApplicationManager.GetRecentApplications() API - // RecentList = TVHomeImpl.GetInstance.RecentShortcutControllerInstance.GetList(); - OnPropertyChanged("RecentList"); - } - - /// <summary> - /// Clears all recent applications and updates the list to Recent SubPanel - /// </summary> - private void ClearAllRecentApplications() - { - TVHomeImpl.GetInstance.RecentShortcutControllerInstance.RemoveAll(); - MakeRecentButtons(); - } - - /// <summary> - /// Removes specified recent application and updates the list to Recent SubPanel - /// </summary> - /// <param name="appId">An application ID</param> - private void RemoveRecentApplication(string appId) - { - TVHomeImpl.GetInstance.RecentShortcutControllerInstance.Remove(appId); - MakeRecentButtons(); - } - - /// <summary> - /// An event that is occurred when property of MainPageViewModel is changed - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; - - /// <summary> - /// A method for invoking PropertyChanged event - /// </summary> - /// <param name="name">The name of property</param> - public void OnPropertyChanged(string name) - { - DebuggingUtils.Dbg("RecentListViewModel OnPropertyChanged " + name); - PropertyChangedEventHandler handler = PropertyChanged; - if (handler != null) - { - handler(this, new PropertyChangedEventArgs(name)); - } - } - - public void OnStateChanged(AppState state) - { - DebuggingUtils.Dbg("RecentListViewModel OnStateChanged " + state); - - switch (state) - { - case AppState.HomeMainPanelRecentFocused: - RecentSubPanelState = PanelState.Show; - break; - - case AppState.HomeSubPanelRecentFocused: - RecentSubPanelState = PanelState.Focused; - break; - - case AppState.HomeShowOptions: - case AppState.HomeMove: - break; - - case AppState.HomeIconified: - RecentSubPanelState = PanelState.Iconified; - break; - - default: - RecentSubPanelState = PanelState.Hide; - break; - - } - } - } -} diff --git a/TVHome/TVHome/ViewModels/SettingsViewModel.cs b/TVHome/TVHome/ViewModels/SettingsViewModel.cs index 874e5a2..5aac445 100644..100755 --- a/TVHome/TVHome/ViewModels/SettingsViewModel.cs +++ b/TVHome/TVHome/ViewModels/SettingsViewModel.cs @@ -17,18 +17,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using LibTVRefCommonPortable.DataModels; using LibTVRefCommonPortable.Utils; -using Xamarin.Forms; -using LibTVRefCommonPortable.Models; using TVHome.Views; namespace TVHome.ViewModels { /// <summary> - /// A class for ViewModel of TV Home Recent Menu List + /// A class for ViewModel of TV Home Menu List /// </summary> public class SettingsViewModel : INotifyPropertyChanged, IStateSubscriber { diff --git a/TVHome/TVHome/Views/MainPage.xaml b/TVHome/TVHome/Views/MainPage.xaml index 7b6617a..35fdee3 100755 --- a/TVHome/TVHome/Views/MainPage.xaml +++ b/TVHome/TVHome/Views/MainPage.xaml @@ -27,15 +27,6 @@ FocusedItemIndex="{Binding FocusedItemIndex}" ItemsSource="{Binding MainList}"/> - <Views:SubThumbnailPanel x:Name="RecentSubPanel" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.224}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.89}" - PanelState="{Binding RecentSubPanelState}" - OnClearVMCommand="{Binding OnClearCommand}" - OnClearAllVMCommand="{Binding OnClearAllCommand}" - ItemsSource="{Binding RecentList}" /> - <Views:SubPanel x:Name="AppsSubPanel" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2370}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" diff --git a/TVHome/TVHome/Views/MainPage.xaml.cs b/TVHome/TVHome/Views/MainPage.xaml.cs index 23e505b..17c8158 100755 --- a/TVHome/TVHome/Views/MainPage.xaml.cs +++ b/TVHome/TVHome/Views/MainPage.xaml.cs @@ -106,13 +106,9 @@ namespace TVHome.Views BindingContext = MainPageViewModel.Instance; SubPanelDictionary = new Dictionary<HomeMenuItem, Panel>(); - SubPanelDictionary.Add(HomeMenuItem.Recent, RecentSubPanel); SubPanelDictionary.Add(HomeMenuItem.Apps, AppsSubPanel); SubPanelDictionary.Add(HomeMenuItem.Settings, SettingsSubPanel); - RecentSubPanel.OnPanelHiding(); - RecentSubPanel.BindingContext = RecentListViewModel.Instance; - AppsSubPanel.OnPanelShowing(); AppsSubPanel.BindingContext = AppListViewModel.Instance; @@ -148,9 +144,6 @@ namespace TVHome.Views { switch (arg) { - case TVHomeStatus.OnResume: - InitializeRecentSubPanelButtonFocusChain(); - break; case TVHomeStatus.OnSleep: PageMainPanel.InitialFocusing(); break; @@ -185,58 +178,22 @@ namespace TVHome.Views /// </summary> private void InitializeMainPanelButtonFocusChain() { - Button recentMainPanelButton = PageMainPanel.GetButtonToFocusing(0); - Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(1); - Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(2); + Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(0); + Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(1); - recentMainPanelButton.On<Tizen>().SetNextFocusLeftView(recentMainPanelButton); - recentMainPanelButton.On<Tizen>().SetNextFocusRightView(appsMainPanelButton); - appsMainPanelButton.On<Tizen>().SetNextFocusLeftView(recentMainPanelButton); + appsMainPanelButton.On<Tizen>().SetNextFocusLeftView(appsMainPanelButton); appsMainPanelButton.On<Tizen>().SetNextFocusRightView(settingMainPanelButton); settingMainPanelButton.On<Tizen>().SetNextFocusLeftView(appsMainPanelButton); settingMainPanelButton.On<Tizen>().SetNextFocusRightView(settingMainPanelButton); } /// <summary> - /// A method for setting focus chain in Recent Sub Panel - /// </summary> - private void InitializeRecentSubPanelButtonFocusChain() - { - List<View> recentSubPanelButtons = new List<View>(RecentSubPanel.GetSubPanelButtons); - Button recentMainPanelButton = PageMainPanel.GetButtonToFocusing(0); - - if (recentSubPanelButtons.Count > 1) - { - recentMainPanelButton.On<Tizen>().SetNextFocusDownView(recentSubPanelButtons[0].FindByName<Button>("ButtonFocusArea")); - } - - foreach (var item in recentSubPanelButtons) - { - item.FindByName<Button>("ButtonFocusArea").On<Tizen>().SetNextFocusUpView(recentMainPanelButton); - } - - for (var i = 0; i < recentSubPanelButtons.Count; i++) - { - if (i != 0) - { - recentSubPanelButtons[i].FindByName<Button>("ButtonFocusArea").On<Tizen>().SetNextFocusLeftView(recentSubPanelButtons[i - 1].FindByName<Button>("ButtonFocusArea")); - } - - if (i != recentSubPanelButtons.Count - 1) - { - recentSubPanelButtons[i].FindByName<Button>("ButtonFocusArea").On<Tizen>().SetNextFocusRightView(recentSubPanelButtons[i + 1].FindByName<Button>("ButtonFocusArea")); - } - } - } - - /// <summary> /// A method for setting focus chain in Apps Sub Panel /// </summary> private void InitializeAppsSubPanelButtonFocusChain() { List<View> appsSubPanelButtons = new List<View>(AppsSubPanel.SubPanelButtons); - DebuggingUtils.Dbg("InitializeAppsSubPanelButtonFocusChain, buttons = " + appsSubPanelButtons.Count); - Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(1); + Button appsMainPanelButton = PageMainPanel.GetButtonToFocusing(0); if (appsSubPanelButtons.Count > 2) { @@ -268,7 +225,7 @@ namespace TVHome.Views private void InitializeSettingsSubPanelButtonFocusChain() { List<View> settingSubPanelButtons = new List<View>(SettingsSubPanel.SubPanelButtons); - Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(2); + Button settingMainPanelButton = PageMainPanel.GetButtonToFocusing(1); if (settingSubPanelButtons.Count > 2) { @@ -288,10 +245,8 @@ namespace TVHome.Views /// <param name="e">The event that is occurred when property is changed</param> private void MainPage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { - DebuggingUtils.Dbg("MainPage_PropertyChanged, status = " + CurrentState + ", - " + e.PropertyName); if (e.PropertyName.CompareTo("CurrentState") == 0) { - DebuggingUtils.Dbg("MyTest" + CurrentState); switch (CurrentState) { case AppState.HomeIconified: @@ -319,17 +274,12 @@ namespace TVHome.Views case AppState.HomeMainPanelAppsFocused: // TODO : remove dependency of MainPanel - PageMainPanel.SetButtonFocus(1); - break; - - case AppState.HomeMainPanelRecentFocused: - // TODO : PageMainPanel.SetButtonFocus(0); break; case AppState.HomeMainPanelSettingsFocused: // TODO : - PageMainPanel.SetButtonFocus(2); + PageMainPanel.SetButtonFocus(1); break; default: diff --git a/TVHome/TVHome/Views/MainPanel.xaml.cs b/TVHome/TVHome/Views/MainPanel.xaml.cs index 41003c7..73f2e48 100755 --- a/TVHome/TVHome/Views/MainPanel.xaml.cs +++ b/TVHome/TVHome/Views/MainPanel.xaml.cs @@ -68,7 +68,6 @@ namespace TVHome.Views PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(mainPanelIconWidth) }); PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(mainPanelIconWidth) }); - PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(mainPanelIconWidth) }); PanelButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); PanelButtonGrid.ColumnSpacing = mainPanelColumnSpacing; @@ -85,8 +84,7 @@ namespace TVHome.Views { if (e.PropertyName == "ItemsSource") { - - HomeMenuItem menuIndex = HomeMenuItem.Recent; + HomeMenuItem menuIndex = HomeMenuItem.Apps; var index = 0; PanelButtonGrid.Children.Clear(); @@ -150,7 +148,7 @@ namespace TVHome.Views return; } - var button = PanelButtonGrid.Children[1]; + var button = PanelButtonGrid.Children[0]; button.FindByName<Button>("ButtonFocusArea").Focus(); } diff --git a/TVHome/TVHome/Views/Panel.cs b/TVHome/TVHome/Views/Panel.cs index c51fd62..ea216e0 100755 --- a/TVHome/TVHome/Views/Panel.cs +++ b/TVHome/TVHome/Views/Panel.cs @@ -104,36 +104,6 @@ namespace TVHome.Views } /// <summary> - /// Identifies the OnClearVMCommand bindable property - /// </summary> - public static readonly BindableProperty OnClearVMCommandProperty = BindableProperty.Create("OnClearVMCommand", typeof(ICommand), typeof(SubThumbnailPanel)); - - /// <summary> - /// A command is executed when item remove is clicked - /// </summary> - public ICommand OnClearVMCommand - { - get { return (ICommand)GetValue(OnClearVMCommandProperty); } - set { SetValue(OnClearVMCommandProperty, value); } - } - - /// <summary> - /// Identifies the OnClearAllVMCommand bindable property - /// </summary> - public static readonly BindableProperty OnClearAllVMCommandProperty = BindableProperty.Create("OnClearAllVMCommand", typeof(ICommand), typeof(SubThumbnailPanel)); - - /// <summary> - /// A command is executed when item remove all is clicked - /// </summary> - public ICommand OnClearAllVMCommand - { - get { return (ICommand)GetValue(OnClearAllVMCommandProperty); } - set { SetValue(OnClearAllVMCommandProperty, value); } - } - - - - /// <summary> /// Identifies the ItemsSource bindable property /// </summary> public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable<ShortcutInfo>), typeof(MainPanel)); diff --git a/TVHome/TVHome/Views/SubPanel.xaml.cs b/TVHome/TVHome/Views/SubPanel.xaml.cs index 47e3154..a0234c3 100755 --- a/TVHome/TVHome/Views/SubPanel.xaml.cs +++ b/TVHome/TVHome/Views/SubPanel.xaml.cs @@ -19,7 +19,6 @@ using TVHome.Controls; using LibTVRefCommonPortable.DataModels; using Xamarin.Forms; using System.Threading.Tasks; -using System.Windows.Input; using System.Collections.Generic; using LibTVRefCommonPortable.Utils; using System; diff --git a/TVHome/TVHome/Views/SubThumbnailPanel.xaml b/TVHome/TVHome/Views/SubThumbnailPanel.xaml deleted file mode 100755 index 849ae36..0000000 --- a/TVHome/TVHome/Views/SubThumbnailPanel.xaml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Views:Panel xmlns="http://xamarin.com/schemas/2014/forms" - xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:Views="clr-namespace:TVHome.Views" - xmlns:Controls="clr-namespace:TVHome.Controls" - x:Class="TVHome.Views.SubThumbnailPanel"> - <RelativeLayout x:Name="ThumbnailParent"> - <ScrollView x:Name="PanelScrollView" - Orientation="Horizontal" - HorizontalOptions="Center" - IsVisible="false" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}" > - <StackLayout x:Name="PanelButtonStack" - Orientation="Horizontal" /> - </ScrollView> - <RelativeLayout x:Name="NoContentInfo" - IsVisible="false" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"> - <Controls:NinePatchImage - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.3}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.354167}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.1}" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.33177}" - Source="btn_option_menu_nocontent_bg.9.png" - Aspect="Fill" - BorderTop="2" - BorderBottom="2" - BorderLeft="2" - BorderRight="2" /> - <Label x:Name="NoContentInfoText" - RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.3}" - RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.354167}" - RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Height, Factor=0.181818}" - RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=NoContentInfo ,Property=Width, Factor=0.33177}" - HorizontalTextAlignment="Center" - VerticalTextAlignment="Center" - Text="No Content to display" - FontFamily="BreezeSans" - TextColor="White" /> - </RelativeLayout> - </RelativeLayout> -</Views:Panel>
\ No newline at end of file diff --git a/TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs b/TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs deleted file mode 100755 index 521d2ab..0000000 --- a/TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs +++ /dev/null @@ -1,363 +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.ComponentModel; -using TVHome.Controls; -using LibTVRefCommonPortable.DataModels; -using Xamarin.Forms; -using System.Threading.Tasks; -using LibTVRefCommonPortable.Utils; -using System.Collections.Generic; - -namespace TVHome.Views -{ - using TVHome.ViewModels; - using Xamarin.Forms.PlatformConfiguration.TizenSpecific; - using Tizen = Xamarin.Forms.PlatformConfiguration.Tizen; - /// <summary> - /// SubThumnailPanel in Main Page for Recent - /// </summary> - public partial class SubThumbnailPanel : Panel - { - /// <summary> - /// A list has panel button that consist of this SubThumbnailPanel. - /// </summary> - private List<PanelButton> ButtonList; - - /// <summary> - /// A flag indicates whether displaying "no content info" is needed or not - /// </summary> - private bool isShowNoContentsInfo = true; - - /// <summary> - /// SubPanel icon's transition height value when it focused. - /// </summary> - private int selectTransitionHeight = SizeUtils.GetHeightSize(140); - - /// <summary> - /// A method for getting Panel Buttons - /// </summary> - /// <returns>A list of panel button views</returns> - public IList<View> GetSubPanelButtons - { - get - { - return PanelButtonStack.Children; - } - } - - /// <summary> - /// Constructor - /// </summary> - public SubThumbnailPanel() - { - InitializeComponent(); - InitializeSize(); - - SetPanelDisplay(); - - PropertyChanged += OnPropertyChanged; - NoContentInfoText.On<Tizen>().SetFontWeight(FontWeight.Light); - - ButtonList = new List<PanelButton>(); - } - - private void SetPanelDisplay() - { - if (isShowNoContentsInfo) - { - DebuggingUtils.Dbg("SetPanelDisplay - TRUE"); - PanelScrollView.IsVisible = false; - NoContentInfo.IsVisible = true; - } - else - { - DebuggingUtils.Dbg("SetPanelDisplay - FALSE"); - PanelScrollView.IsVisible = true; - NoContentInfo.IsVisible = false; - } - } - - private void InitializeSize() - { - PanelButtonStack.Spacing = SizeUtils.GetWidthSizeDouble(27.5); - PanelButtonStack.Padding = new Thickness(SizeUtils.GetWidthSize(96), SizeUtils.GetWidthSize(32)); - - NoContentInfoText.FontSize = SizeUtils.GetFontSize(28); - } - - /// <summary> - /// A method for handling when menu key is pressed - /// </summary> - public override void MenuKeyPressed() - { - foreach (var item in ButtonList) - { - if (item.IsButtonFocused) - { - item.PanelButtonState = PanelButtonState.ShowingOption; - } - } - } - - public void PanelButtonStateEventHandler(object sender, PanelButtonState panelButtonStateArg) - { - DebuggingUtils.Dbg("PanelButtonStateEventHandler, " + panelButtonStateArg); - switch (panelButtonStateArg) - { - case PanelButtonState.Focused: - if (PanelState != PanelState.Moving) - { - PanelState = PanelState.Focused; - } - - break; - - case PanelButtonState.ShowingOption: - PanelState = PanelState.ShowingOption; - break; - } - } - - /// <summary> - /// An event handler for handling property changed event - /// </summary> - /// <param name="sender">A source of event</param> - /// <param name="e">The event that is occurred when property is changed</param> - private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName == "ItemsSource") - { - DebuggingUtils.Dbg("SubThumbnailPanel view OnPropertyChanged, ItemSource "); - - isShowNoContentsInfo = true; - PanelButtonStack.Children.Clear(); - ButtonList.Clear(); - - foreach (RecentShortcutInfo item in ItemsSource) - { - PanelButton button = new SubPanelThumbnailButton(); - button.BindingContext = item; - - button.OnPanelButtonStateChanged += PanelButtonStateEventHandler; - button.OnFocusedCommand = new Command(() => - { - DebuggingUtils.Dbg("SubThumbnailPanel Focused"); - PanelState = PanelState.Focused; - SelectedItem = item; - - if (SizeUtils.GetWidthSize((int)button.X) - SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) < 0) - { - ScrollToLeft(); - } - else if (SizeUtils.GetWidthSize((int)button.X) + SizeUtils.GetWidthSize(320) > SizeUtils.GetWidthSize(1920)) - { - ScrollToRight(); - } - }); - button.OnClickedCommand = new Command(() => - { - item.DoAction(); - }); - button.OnClearCommand = new Command(() => - { - OnClearVMCommand.Execute(item.Id); - }); - button.OnClearAllCommand = new Command(() => - { - OnClearAllVMCommand.Execute(""); - }); - PanelButtonStack.Children.Add(button); - ButtonList.Add(button); - - isShowNoContentsInfo = false; - } - - SetPanelDisplay(); - - if (PanelState == PanelState.Hide || - PanelState == PanelState.Iconified) - { - OnPanelHiding(); - } - else - { - OnPanelFocusing(); - } - } - } - - /// <summary> - /// A method for scrolling to right - /// </summary> - private async void ScrollToRight() - { - double distance = SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) + SizeUtils.GetWidthSize(320); - await Task.Delay(1); - await PanelScrollView.ScrollToAsync(distance, 0, true); - } - - /// <summary> - /// A method for scrolling to left - /// </summary> - private async void ScrollToLeft() - { - double distance = SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) - SizeUtils.GetWidthSize(320); - await Task.Delay(1); - await PanelScrollView.ScrollToAsync(distance, 0, true); - } - - /// <summary> - /// A method for hiding the panel - /// </summary> - public override void OnPanelHiding() - { - if (isShowNoContentsInfo) - { - TranslationY = 0; - Opacity = 0; - return; - } - - foreach (var item in PanelButtonStack.Children) - { - item.IsEnabled = false; - } - - AnimationExtensions.AbortAnimation(this, "PanelAnimation"); - var currentTranslationY = TranslationY; - var diff = selectTransitionHeight - currentTranslationY; - var currentOpacity = Opacity; - Animation animation = new Animation(); - Animation translateAnimation = new Animation(v => TranslationY = (currentTranslationY + diff * v)); - Animation fadeAnimation = new Animation(v => Opacity = currentOpacity * (1 - v)); - animation.Add(0, 1, translateAnimation); - animation.Add(0, 1, fadeAnimation); - animation.Commit(this, "PanelAnimation", length: 300, finished: (percentage, cancel) => - { - PanelScrollView.ScrollToAsync(0, 0, true); - }); - } - - /// <summary> - /// A method for showing the panel - /// </summary> - public override void OnPanelShowing() - { - if (isShowNoContentsInfo) - { - TranslationY = 0; - Opacity = 1; - return; - } - - foreach (var item in PanelButtonStack.Children) - { - item.IsEnabled = true; - item.FindByName<Xamarin.Forms.Image>("ThumnailDimLayer").Opacity = 1; - } - - AnimationExtensions.AbortAnimation(this, "PanelAnimation"); - var currentTranslationY = TranslationY; - var currentOpacity = Opacity; - var diff = 1 - currentOpacity; - Animation animation = new Animation(); - Animation translateAnimation = new Animation(v => TranslationY = (currentTranslationY * (1 - v))); - Animation fadeAnimation = new Animation(v => Opacity = currentOpacity + diff * v); - animation.Add(0, 1, translateAnimation); - animation.Add(0, 1, fadeAnimation); - animation.Commit(this, "PanelAnimation", length: 300); - - } - - /// <summary> - /// A method for handling panel focused event - /// </summary> - /// <param name="shouldBeFirstItemFocused">If this flag is true, the first item should be focused.</param> - public override void OnPanelFocusing(bool shouldBeFirstItemFocused = true) - { - if (isShowNoContentsInfo) - { - return; - } - - foreach (var item in PanelButtonStack.Children) - { - item.FindByName<Xamarin.Forms.Image>("ThumnailDimLayer").Opacity = 0; - } - - if (shouldBeFirstItemFocused) - { - var button = PanelButtonStack.Children[0]; - button.FindByName<Button>("ButtonFocusArea").Focus(); - } - - AnimationExtensions.AbortAnimation(this, "PanelAnimation"); - var currentTranslationY = TranslationY; - var diff = -selectTransitionHeight - currentTranslationY; - Animation animation = new Animation(); - Animation translateAnimation = new Animation(v => TranslationY = (currentTranslationY + diff * v)); - animation.Add(0.5, 1, translateAnimation); - animation.Commit(this, "PanelAnimation", length: 600); - } - - - public override void OnOptionMenuShowing() - { - DebuggingUtils.Dbg("OnShowingOptiongMenu - SubThumbnailPanel"); - var bounds = Bounds; - bounds.Height += 300; - bounds.Y -= 300; - this.LayoutTo(bounds, 0); - } - - public override void OnOptionMenuHiding() - { - DebuggingUtils.Dbg("OnHidingOptiongMenu - SubThumbnailPanel"); - var bounds = Bounds; - bounds.Height -= 300; - bounds.Y += 300; - this.LayoutTo(bounds, 0); - } - - - public override void OnMoveStarting() - { - } - - public override void OnMoveFinishing() - { - } - - /// <summary> - /// A method for handling to hide panel without animation - /// </summary> - public override void OnPanelForcelyHiding() - { - /* - foreach (var item in PanelButtonStack.Children) - { - item.IsEnabled = true; - item.FindByName<Xamarin.Forms.Image>("ThumnailDimLayer").Opacity = 1; - } - - this.TranslationY = selectTransitionHeight; - Opacity = 1; - */ - OnPanelHiding(); - } - } -}
\ No newline at end of file |