From: Geunsun, Lee Date: Wed, 22 Mar 2017 10:29:01 +0000 (+0900) Subject: Implement Menu key event for Apps X-Git-Tag: submit/tizen/20170808.015446~174 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ef529ef249ef7cc0263d719add797d6ca65f832;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Implement Menu key event for Apps Change-Id: I6233e0f77d345d3f971809cf9caf119a24a1497b --- diff --git a/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs index 4ef066a..8652033 100644 --- a/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs +++ b/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs @@ -15,10 +15,8 @@ */ using System; -using System.Collections.Generic; using System.Xml.Serialization; - namespace LibTVRefCommonPortable.DataModels { public class AppShortcutInfo : ShortcutInfo @@ -92,6 +90,27 @@ namespace LibTVRefCommonPortable.DataModels } [XmlIgnore] + private bool isFocused { get; set; } + + [XmlIgnore] + public bool IsFocused + { + get + { + return isFocused; + } + + set + { + if (isFocused != value) + { + isFocused = value; + OnPropertyChanged("IsFocused"); + } + } + } + + [XmlIgnore] private bool isDim; [XmlIgnore] diff --git a/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs b/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs index 1fc292d..050b7e5 100644 --- a/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs +++ b/TVApps/TVApps.TizenTV/TVApps.TizenTV.cs @@ -18,6 +18,7 @@ using System; using LibTVRefCommonPortable.Utils; using LibTVRefCommonTizen.Ports; using Tizen.Applications; +using System.Threading; namespace TVApps.TizenTV { @@ -25,6 +26,7 @@ namespace TVApps.TizenTV { private static Program instance; private IPlatformNotification notification; + private Timer timerForKeyGrab; public static string AppResourcePath { @@ -37,6 +39,13 @@ namespace TVApps.TizenTV get; private set; } + private void CallbackForKeyGrab(Object state) + { + MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true); + timerForKeyGrab.Dispose(); + timerForKeyGrab = null; + DebuggingUtils.Dbg("KeyGrab finished"); + } protected override void OnCreate() { @@ -51,6 +60,23 @@ namespace TVApps.TizenTV LoadApplication(app); PackageManagerPort.RegisterCallbacks(notification); + + MainWindow.KeyUp += KeyUpListener; + + TimerCallback timerDelegate = new TimerCallback(CallbackForKeyGrab); + timerForKeyGrab = new Timer(timerDelegate, MainWindow, 3000, 0); + } + + private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs e) + { + DebuggingUtils.Dbg("[TVApps.TizenTV.cs] Key Pressed :" + e.KeyName); + if (e.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0) + { + if (notification != null) + { + notification.OnMenuKeyPressed(); + } + } } protected override void OnTerminate() @@ -60,6 +86,8 @@ namespace TVApps.TizenTV notification = null; PackageManagerPort.DeregisterCallbacks(); MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformBackButtonName); + MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName); + } protected override void OnAppControlReceived(AppControlReceivedEventArgs e) diff --git a/TVApps/TVApps/Controls/AppItemCell.xaml b/TVApps/TVApps/Controls/AppItemCell.xaml index 8632379..a5fd78d 100755 --- a/TVApps/TVApps/Controls/AppItemCell.xaml +++ b/TVApps/TVApps/Controls/AppItemCell.xaml @@ -80,7 +80,7 @@