<Compile Include="Ports\BTModulePort.cs" />
<Compile Include="Ports\DBPort.cs" />
<Compile Include="Ports\DebuggingPort.cs" />
+ <Compile Include="Ports\ElmPort.cs" />
<Compile Include="Ports\FileSystemPort.cs" />
<Compile Include="Ports\FileSystemWatcherPort.cs" />
<Compile Include="Ports\PackageManagerPort.cs" />
{
"dependencies": {
- "ElmSharp": "1.1.0-beta-014",
+ "ElmSharp": "1.1.0-beta-015",
"Microsoft.NETCore.App": "1.1.0",
"Tizen.Library": "1.0.0-pre2",
"Xamarin.Forms": "2.3.3.193",
--- /dev/null
+/*
+ * 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 LibTVRefCommonTizen.Ports
+{
+ public class ElmPort
+ {
+ internal class Elm
+ {
+ internal delegate bool EcoreEventHanlderCallback(IntPtr data, int type, IntPtr ei);
+
+ [DllImport("libelementary.so.1", EntryPoint = "elm_win_keygrab_set", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr elm_win_keygrab_set(IntPtr obj, string key, ulong modifiers, ulong not_modifiers, int proirity, int grab_mode);
+
+ [DllImport("libelementary.so.1", EntryPoint = "elm_win_iconified_set", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void elm_win_iconified_set(IntPtr obj, bool iconified);
+
+ [DllImport("libelementary.so.1", EntryPoint = "elm_win_iconified_get", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern bool elm_win_iconified_get(IntPtr obj);
+ }
+
+ public static void SetKeyGrabExclusively(IntPtr window, string key)
+ {
+ DebuggingPort.D("Grab Key Event for :" + key);
+ Elm.elm_win_keygrab_set(window, key, 0, 0, 0, 1024);
+ }
+
+ public static void SetIconified(IntPtr window, bool iconified)
+ {
+ DebuggingPort.D("Iconified :" + iconified);
+ Elm.elm_win_iconified_set(window, iconified);
+ }
+
+ public static bool GetIconified(IntPtr window)
+ {
+ return Elm.elm_win_iconified_get(window);
+ }
+ }
+}
using LibTVRefCommonPortable.Utils;
using LibTVRefCommonTizen.Ports;
using Tizen.Applications;
+using ElmSharp;
namespace TVHome.TizenTV
{
IPlatformNotification notification;
private Timer timerForKeyGrab;
+ private Timer timerForIconified;
public static string AppResourcePath
{
{
MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName, true);
MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true);
+ ElmPort.SetKeyGrabExclusively((IntPtr)(MainWindow), ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName);
timerForKeyGrab.Dispose();
timerForKeyGrab = null;
DebuggingPort.D("KeyGrab finished");
}
+ private void CallbackForIconified(Object state)
+ {
+ ElmPort.SetIconified((IntPtr)MainWindow, true);
+ timerForIconified.Dispose();
+ timerForIconified = null;
+ }
+
protected override void OnCreate()
{
base.OnCreate();
PackageManagerPort.RegisterCallbacks(notification);
- MainWindow.KeyUp += KeyUpListener;
+ MainWindow.KeyUp += KeyUpListener;
MainWindow.Alpha = true;
TimerCallback timerDelegate = new TimerCallback(CallbackForKeyGrab);
- timerForKeyGrab = new Timer(timerDelegate, MainWindow, 3000, 0);
-
+ timerForKeyGrab = new Timer(timerDelegate, null, 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)
+ if (ElmPort.GetIconified((IntPtr)MainWindow) == true)
+ {
+ ElmPort.SetIconified((IntPtr)MainWindow, false);
+ MainWindow.Active();
+ notification.OnHomeKeyPressed();
+ }
+ else
{
notification.OnHomeKeyPressed();
+ TimerCallback timerDelegate = new TimerCallback(CallbackForIconified);
+ timerForIconified = new Timer(timerDelegate, null, 200, 0);
}
}
else if (e.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0)
-{\r
- "buildOptions": {\r
- "emitEntryPoint": true,\r
- "debugType": "portable",\r
- "platform": "AnyCPU",\r
- "preserveCompilationContext": true\r
- },\r
- "dependencies": {\r
- "ElmSharp": "1.1.0-beta-014",\r
- "Microsoft.NETCore.App": "1.1.0",\r
- "Tizen.Library": "1.0.0-pre2",\r
- "Xamarin.Forms": "2.3.3.193",\r
- "Xamarin.Forms.Platform.Tizen": "2.3.4-r192-001"\r
- },\r
- "runtimes": {\r
- "win": {},\r
- "linux": {}\r
- },\r
- "frameworks": {\r
- "netcoreapp1.0": {\r
- "imports": [\r
- "portable-net45+wp80+win81+wpa81",\r
- "netstandard1.6"\r
- ]\r
- }\r
- }\r
+{
+ "buildOptions": {
+ "emitEntryPoint": true,
+ "debugType": "portable",
+ "platform": "AnyCPU",
+ "preserveCompilationContext": true
+ },
+ "dependencies": {
+ "ElmSharp": "1.1.0-beta-015",
+ "Microsoft.NETCore.App": "1.1.0",
+ "Tizen.Library": "1.0.0-pre2",
+ "Xamarin.Forms": "2.3.3.193",
+ "Xamarin.Forms.Platform.Tizen": "2.3.4-r192-001"
+ },
+ "runtimes": {
+ "win": {},
+ "linux": {}
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": [
+ "portable-net45+wp80+win81+wpa81",
+ "netstandard1.6"
+ ]
+ }
+ }
}
\ No newline at end of file
<RelativeLayout Opacity="0.99">
<BoxView x:Name="ButtonBox"
WidthRequest="320"
- HeightRequest="160"
+ HeightRequest="180"
Opacity="0"/>
<Image x:Name="ThumbnailImage"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
/// </summary>
public partial class MainPage : ContentPage
{
+ private bool Iconified = false;
public static readonly BindableProperty CurrentStatusProperty = BindableProperty.Create("CurrentStatus", typeof(HomeStatus), typeof(MainPage), default(HomeStatus));
public HomeStatus CurrentStatus
{
App.SetHomeKeyListener((e, arg) =>
{
- DebuggingUtils.Dbg("FIRED!!");
- if (IsVisible)
+ if (Iconified == true)
{
- PlayHideAnimation();
- IsVisible = !IsVisible;
+ PageMainPanel.InitialFocusing();
+ PlayShowAnimation();
}
else
{
- IsVisible = !IsVisible;
- PageMainPanel.InitialFocusing();
- PlayShowAnimation();
+ PlayHideAnimation();
}
+ Iconified = !Iconified;
});
// TODO : this is for the unpin test.