1. Grab Home key event.
2. Remove background image.
3. Set Transparent background of MainWindow.
Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
Change-Id: I9196826042c8baab8a78e83e061dbfa9c5534c60
{
public interface IPlatformNotification
{
- void OnAppInstalled(string pkgID);
+ void OnHomeKeyPressed();
+
+ void OnAppInstalled(string pkgID);
void OnAppUninstalled(string pkgID);
{
"dependencies": {
- "ElmSharp": "1.1.0-beta-010",
+ "ElmSharp": "1.1.0-beta-013",
"Microsoft.NETCore.App": "1.1.0",
"Tizen.Library": "1.0.0-pre2",
"Xamarin.Forms": "2.3.3.193",
"Xamarin.Forms.Platform.Tizen": "2.3.3.175-beta-007"
},
"frameworks": {
- "netcoreapp1.0": {
+ "netcoreapp1.0": {
"imports": [
"portable-net45+wp80+win81+wpa81",
"netstandard1.6"
* limitations under the License.
*/
+using System;
+using System.Threading;
using LibTVRefCommonPortable.Utils;
using LibTVRefCommonTizen.Ports;
using Tizen.Applications;
+
namespace TVHome.TizenTV
{
class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
{
IPlatformNotification notification;
+ private Timer timerForKeyGrab;
public static string AppResourcePath
{
private set;
}
+ private void CallbackForKeyGrab(Object state)
+ {
+ MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName, true);
+ timerForKeyGrab.Dispose();
+ timerForKeyGrab = null;
+ DebuggingPort.D("KeyGrab finished");
+ }
+
protected override void OnCreate()
{
base.OnCreate();
LoadApplication(app);
PackageManagerPort.RegisterCallbacks(notification);
- MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName, true);
+
+ MainWindow.KeyUp += KeyUpListener;
+ MainWindow.Alpha = true;
+
+ TimerCallback timerDelegate = new TimerCallback(CallbackForKeyGrab);
+ timerForKeyGrab = new Timer(timerDelegate, MainWindow, 3000, 0);
+
+ }
+
+ private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs e)
+ {
+ DebuggingPort.D("Key Pressed :" + e.KeyName);
+ if (e.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName) == 0)
+ {
+ MainWindow.Active();
+ if (notification != null)
+ {
+ notification.OnHomeKeyPressed();
+ }
+ }
}
protected override void OnTerminate()
"preserveCompilationContext": true\r
},\r
"dependencies": {\r
- "ElmSharp": "1.1.0-beta-010",\r
+ "ElmSharp": "1.1.0-beta-013",\r
"Microsoft.NETCore.App": "1.1.0",\r
"Tizen.Library": "1.0.0-pre2",\r
"Xamarin.Forms": "2.3.3.193",\r
<privilege>http://tizen.org/privilege/packagemanager.admin</privilege>\r
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
<privilege>http://tizen.org/privilege/externalstorage</privilege>\r
+ <privilege>http://tizen.org/privilege/keygrab</privilege>\r
</privileges>\r
<profile name="common" />\r
<ui-application appid="org.tizen.example.TVHome.TizenTV" \r
public class App : Application, IPlatformNotification
{
+ private static EventHandler<TVHomeEventArgs> HomeKeyListener;
private static EventHandler<TVHomeEventArgs> AppInstalledListener;
private static EventHandler<TVHomeEventArgs> AppUninstalledListener;
private static EventHandler<TVHomeEventArgs> AppPinnedNotificationListener;
}
- public static void SetAppInstalledListener(EventHandler<TVHomeEventArgs> listener)
+ public static void SetHomeKeyListener(EventHandler<TVHomeEventArgs> listener)
+ {
+ HomeKeyListener += listener;
+ }
+
+ public static void SetAppInstalledListener(EventHandler<TVHomeEventArgs> listener)
{
AppInstalledListener += listener;
}
{
AppUninstalledListener += listener;
}
- public static void SetAppPinnedNotificationListener(EventHandler<TVHomeEventArgs> listener)
+
+ public static void SetAppPinnedNotificationListener(EventHandler<TVHomeEventArgs> listener)
{
AppPinnedNotificationListener += listener;
}
+ public void OnHomeKeyPressed()
+ {
+ DebuggingUtils.Dbg("[[[ Home Key ]]] ");
+ HomeKeyListener.Invoke(this, new TVHomeEventArgs()
+ {
+ arg = "",
+ });
+ }
+
public void OnAppInstalled(string pkgID)
{
DebuggingUtils.Dbg("[[[ App Installed ]]] " + pkgID);
xmlns:Views="clr-namespace:TVHome.Views"
xmlns:ViewModels="clr-namespace:TVHome.ViewModels"
xmlns:Controls="clr-namespace:TVHome.Controls"
- Appearing="OnAppearing"
- BackgroundImage="background.jpg">
- <ContentPage.BackgroundColor>
- <Color>White</Color>
- </ContentPage.BackgroundColor>
+ Appearing="OnAppearing">
<ContentPage.BindingContext>
<ViewModels:MainPageViewModel />
</ContentPage.BindingContext>
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
Source="bg_dimmed.png"
- Opacity="0.95"/>
+ Opacity="0.5"/>
<Views:MainPanel x:Name="PageMainPanel"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.22}"
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
private Panel currentSubPanel;
public ICommand ChangeSubPanelCommand;
+ private async void PlayHideAnimation()
+ {
+ currentSubPanel?.TranslateTo(0.0, 100, 150);
+ await PageMainPanel.ScaleTo(0.0, 150);
+ }
+
+ private async void PlayShowAnimation()
+ {
+ currentSubPanel?.TranslateTo(0.0, 0.0, 150);
+ await PageMainPanel.ScaleTo(1.0, 150);
+ }
+
public MainPage()
{
InitializeComponent();
SubPanelDictionary.Add("Apps", AppsSubPanel);
SubPanelDictionary.Add("Settings", SettingsSubPanel);
+ App.SetHomeKeyListener((e, arg) => {
+ DebuggingUtils.Dbg("FIRED!!");
+ if (IsVisible)
+ {
+ PlayHideAnimation();
+ IsVisible = !IsVisible;
+ }
+ else
+ {
+ IsVisible = !IsVisible;
+ PageMainPanel.InitialFocusing();
+ PlayShowAnimation();
+ }
+ });
+
PageMainPanel.OnFocusedCommand = new Command<string>((key) =>
{
DebuggingUtils.Dbg("MainPage : " + key);
- if (currentSubPanel != null)
+ foreach (KeyValuePair<string, Panel> aPair in SubPanelDictionary)
{
- currentSubPanel.HidePanel();
+ if (aPair.Key != key)
+ aPair.Value.HidePanel();
+ else
+ {
+ currentSubPanel = aPair.Value;
+ currentSubPanel.ShowPanel();
+ }
}
-
- currentSubPanel = SubPanelDictionary[key];
- currentSubPanel.ShowPanel();
});
RecentSubPanel.OnFocusedCommand = new Command(() =>
}
}
}
-}
\ No newline at end of file
+}
this.TranslateTo(0, 1, 0);
#pragma warning restore CS4014
await this.FadeTo(0, 0);
+ IsVisible = false;
}
public override async void ShowPanel()
{
+ IsVisible = true;
isFocused = false;
foreach (var item in PanelButtonStack.Children)
{