From e340be43358be84c4f541d0b0fbbeaf5beb43407 Mon Sep 17 00:00:00 2001 From: cskim Date: Tue, 14 Mar 2017 20:17:24 +0900 Subject: [PATCH] Update Header, Footer GUI Change-Id: Ia3b3b93ef6e7a614c0fb8317ef18908a8f0e1667 --- .../Renderer/CustomButtonRenderer.cs | 65 +++++++++++++++ TVApps/TVApps.TizenTV/TVApps.TizenTV.cs | 1 + TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj | 1 + TVApps/TVApps/Controls/AppItemCell.xaml.cs | 4 +- TVApps/TVApps/Controls/AppListView.xaml.cs | 1 + TVApps/TVApps/Controls/CustomButton.xaml | 5 ++ TVApps/TVApps/Controls/CustomButton.xaml.cs | 37 +++++++++ TVApps/TVApps/Controls/TVButton.xaml | 43 ++++++++++ TVApps/TVApps/Controls/TVButton.xaml.cs | 83 +++++++++++++++++++ TVApps/TVApps/TVApps.cs | 1 + TVApps/TVApps/TVApps.csproj | 18 ++++ TVApps/TVApps/ViewModels/AppsHolder.cs | 6 +- TVApps/TVApps/Views/FooterDeleteStatus.xaml | 39 +++++---- TVApps/TVApps/Views/FooterDeleteStatus.xaml.cs | 3 +- TVApps/TVApps/Views/FooterNormalStatus.xaml | 63 ++++++++------ TVApps/TVApps/Views/FooterNormalStatus.xaml.cs | 2 +- TVApps/TVApps/Views/FooterPinStatus.xaml | 48 +++++------ TVApps/TVApps/Views/FooterPinStatus.xaml.cs | 2 +- TVApps/TVApps/Views/MainPage.xaml | 92 ++++++++------------- TVHome/TVHome.TizenTV/TVHome.TizenTV.csproj | 66 ++++++++++++++- TVHome/TVHome.TizenTV/bin/Debug/TVHome.TizenTV.tpk | Bin 1567317 -> 1580471 bytes .../TVHome/Controls/SubPanelAllAppsButton.xaml.cs | 3 + TVHome/TVHome/TVHome.cs | 1 + 23 files changed, 449 insertions(+), 135 deletions(-) create mode 100644 TVApps/TVApps.TizenTV/Renderer/CustomButtonRenderer.cs create mode 100644 TVApps/TVApps/Controls/CustomButton.xaml create mode 100644 TVApps/TVApps/Controls/CustomButton.xaml.cs create mode 100644 TVApps/TVApps/Controls/TVButton.xaml create mode 100644 TVApps/TVApps/Controls/TVButton.xaml.cs diff --git a/TVApps/TVApps.TizenTV/Renderer/CustomButtonRenderer.cs b/TVApps/TVApps.TizenTV/Renderer/CustomButtonRenderer.cs new file mode 100644 index 0000000..60c87fa --- /dev/null +++ b/TVApps/TVApps.TizenTV/Renderer/CustomButtonRenderer.cs @@ -0,0 +1,65 @@ +/* + * 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 LibTVRefCommonTizen.Ports; +using System; + +using TVApps.Controls; +using TVApps.TizenTV.Renderer; +using Xamarin.Forms.Platform.Tizen; + +[assembly: ExportRenderer(typeof(CustomButton), typeof(CustomButtonRenderer))] +namespace TVApps.TizenTV.Renderer +{ + class CustomButtonRenderer : ButtonRenderer//ViewRenderer + { + protected override void OnElementChanged(ElementChangedEventArgs args) + { + DebuggingPort.D("OnElementChanged"); + base.OnElementChanged(args); + + if (Control == null || + Element == null) + { + return; + } + + if (args.NewElement == null) + { + return; + } + + Control.Pressed += KeyDown; + Control.Released += KeyUp; + + DebuggingPort.D("OnElementChanged - REGISTERED"); + } + + private void KeyUp(object sender, EventArgs e) + { + DebuggingPort.D("KeyUp"); + CustomButton BtnElement = Element as CustomButton; + BtnElement.OnButtonUp.Invoke(sender, e); + } + + private void KeyDown(object sender, EventArgs e) + { + DebuggingPort.D("KeyDown"); + CustomButton BtnElement = Element as CustomButton; + BtnElement.OnButtonDown.Invoke(sender, e); + } + } +} diff --git a/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs b/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs index 1993eb3..7304dd4 100644 --- a/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs +++ b/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs @@ -85,6 +85,7 @@ namespace TVApps.TizenTV Xamarin.Forms.DependencyService.Register(); Xamarin.Forms.DependencyService.Register(); Xamarin.Forms.DependencyService.Register(); + // TODO : add true argument at end. Xamarin.Forms.Platform.Tizen.Forms.Init(app); app.Run(args); diff --git a/TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj b/TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj index 151e5a2..8c871ac 100644 --- a/TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj +++ b/TVApps/TVApps.TizenTV/TVApps.TizenTV.csproj @@ -47,6 +47,7 @@ + diff --git a/TVApps/TVApps/Controls/AppItemCell.xaml.cs b/TVApps/TVApps/Controls/AppItemCell.xaml.cs index a432556..29ef59a 100755 --- a/TVApps/TVApps/Controls/AppItemCell.xaml.cs +++ b/TVApps/TVApps/Controls/AppItemCell.xaml.cs @@ -69,9 +69,10 @@ namespace TVApps.Controls { PinnedIcon.FadeTo(0.0, 300); } + return; } - if (e.PropertyName.CompareTo("IsChecked") == 0) + else if (e.PropertyName.CompareTo("IsChecked") == 0) { if (IsChecked) { @@ -88,6 +89,7 @@ namespace TVApps.Controls DimImage.TranslateTo(0.0, 0.0, 300); DimImage.ScaleTo(0.0, 300); } + return; } } diff --git a/TVApps/TVApps/Controls/AppListView.xaml.cs b/TVApps/TVApps/Controls/AppListView.xaml.cs index 6d94aad..bf92647 100644 --- a/TVApps/TVApps/Controls/AppListView.xaml.cs +++ b/TVApps/TVApps/Controls/AppListView.xaml.cs @@ -90,6 +90,7 @@ namespace TVApps.Controls { AppLowerList.Children.Add(viewCell.View); } + AppCount = AppCount + 1; } diff --git a/TVApps/TVApps/Controls/CustomButton.xaml b/TVApps/TVApps/Controls/CustomButton.xaml new file mode 100644 index 0000000..413f1e2 --- /dev/null +++ b/TVApps/TVApps/Controls/CustomButton.xaml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/TVApps/TVApps/Controls/CustomButton.xaml.cs b/TVApps/TVApps/Controls/CustomButton.xaml.cs new file mode 100644 index 0000000..0b9309e --- /dev/null +++ b/TVApps/TVApps/Controls/CustomButton.xaml.cs @@ -0,0 +1,37 @@ +/* + * 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 Xamarin.Forms; + +namespace TVApps.Controls +{ + /// + /// Custom Button for TVButton to get pressed/release status + /// + /// + public partial class CustomButton : Button + { + public EventHandler OnButtonUp; + public EventHandler OnButtonDown; + + public CustomButton() + { + InitializeComponent(); + } + } +} diff --git a/TVApps/TVApps/Controls/TVButton.xaml b/TVApps/TVApps/Controls/TVButton.xaml new file mode 100644 index 0000000..ed76e5f --- /dev/null +++ b/TVApps/TVApps/Controls/TVButton.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TVApps/TVApps/Controls/TVButton.xaml.cs b/TVApps/TVApps/Controls/TVButton.xaml.cs new file mode 100644 index 0000000..9abe001 --- /dev/null +++ b/TVApps/TVApps/Controls/TVButton.xaml.cs @@ -0,0 +1,83 @@ +/* + * 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.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace TVApps.Controls +{ + /// + /// TV Button Control + /// + public partial class TVButton : StackLayout + { + public string Text + { + get { return TitleText.Text; } + set { TitleText.Text = value; } + } + + public static readonly BindableProperty CommandProperty = + BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(TVButton), null, BindingMode.TwoWay); + + /// + /// A command will be executed if the button is touched. + public ICommand Command + { + get { return (ICommand)GetValue(CommandProperty); } + set { SetValue(CommandProperty, value); } + } + + /// + /// A command parameter will be passed when the Command is executed. + /// + public String CommandParameter + { + get; + set; + } + + private static String ButtonImagePressed = "btn_tizen_dropdown_line_dimmed.9.png"; + private static String ButtonImageReleased = "btn_tizen_dropdown_line_normal.9.png"; + + public TVButton() + { + InitializeComponent(); + + HiddenButton.OnButtonUp += ButtonUpListener; + HiddenButton.OnButtonDown += ButtonDownListener; + } + + public void ButtonUpListener(Object sender, EventArgs e) + { + BackgroundImage.Source = ButtonImageReleased; + Command?.Execute(CommandParameter); + } + + public void ButtonDownListener(Object sender, EventArgs e) + { + BackgroundImage.Source = ButtonImagePressed; + } + + + } +} diff --git a/TVApps/TVApps/TVApps.cs b/TVApps/TVApps/TVApps.cs index 822a0dc..aed5cc9 100644 --- a/TVApps/TVApps/TVApps.cs +++ b/TVApps/TVApps/TVApps.cs @@ -57,6 +57,7 @@ namespace TVApps { BackKeyListener += listener; } + public static void SetAppInstalledListener(EventHandler listener) { AppInstalledListener += listener; diff --git a/TVApps/TVApps/TVApps.csproj b/TVApps/TVApps/TVApps.csproj index 830f563..ddb6249 100644 --- a/TVApps/TVApps/TVApps.csproj +++ b/TVApps/TVApps/TVApps.csproj @@ -40,6 +40,12 @@ AppListView.xaml + + CustomButton.xaml + + + TVButton.xaml + @@ -78,6 +84,12 @@ + + MSBuild:UpdateDesignTimeXaml + Designer + + + ..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll True @@ -114,6 +126,12 @@ Designer + + + MSBuild:UpdateDesignTimeXaml + Designer + + diff --git a/TVApps/TVApps/ViewModels/AppsHolder.cs b/TVApps/TVApps/ViewModels/AppsHolder.cs index 0eedf6a..4d6574c 100644 --- a/TVApps/TVApps/ViewModels/AppsHolder.cs +++ b/TVApps/TVApps/ViewModels/AppsHolder.cs @@ -135,14 +135,10 @@ namespace TVApps.ViewModels private void DeleteApp(string AppID) { DebuggingUtils.Dbg("Delete, " + AppID); - // 1. Check the property of the app - // 1-1. If the app is pinned, call UnsetPinnedApp(AppId) - // 2. Show Popup(Delete message) - // 2-1. OK : Call the AppFW API to remove the app - // 2-2. Cancel : Change AppsStatus to Normal // TODO : popup + // TODO : remove all app of removed package!!! RemovePinnedApp(AppID); ViewModel.ChangeCurrentStatus(AppsStatus.Default); diff --git a/TVApps/TVApps/Views/FooterDeleteStatus.xaml b/TVApps/TVApps/Views/FooterDeleteStatus.xaml index 3070f55..a2ce87b 100644 --- a/TVApps/TVApps/Views/FooterDeleteStatus.xaml +++ b/TVApps/TVApps/Views/FooterDeleteStatus.xaml @@ -1,23 +1,22 @@  - + - - - - - + + + + - -