diff options
author | Seungha Son <seungha.son@samsung.com> | 2017-05-30 09:19:58 +0900 |
---|---|---|
committer | Son seungha <seungha.son@samsung.com> | 2017-06-12 05:10:33 +0000 |
commit | ac0bf7249091a73e665232aad1a27e97e2e22a7b (patch) | |
tree | 4a5cf090414c089f2882a290f0fa813a7aee1aab | |
parent | 38a0abcdc77941f5043671c0e2fe3a11dfb452d4 (diff) | |
download | application-ac0bf7249091a73e665232aad1a27e97e2e22a7b.tar.gz application-ac0bf7249091a73e665232aad1a27e97e2e22a7b.tar.bz2 application-ac0bf7249091a73e665232aad1a27e97e2e22a7b.zip |
Add default button Property in Notification, EventListener
This patch add Property to display default button on active notification
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: I76d8aaffb2c45da64b3c04a47d11ed206b4457e4
6 files changed, 36 insertions, 0 deletions
diff --git a/Tizen.Applications.Notification/Interop/Interop.Notification.cs b/Tizen.Applications.Notification/Interop/Interop.Notification.cs index 7dd5365..e865ab1 100755 --- a/Tizen.Applications.Notification/Interop/Interop.Notification.cs +++ b/Tizen.Applications.Notification/Interop/Interop.Notification.cs @@ -212,6 +212,12 @@ internal static partial class Interop [DllImport(Libraries.Notification, EntryPoint = "notification_get_args")] internal static extern NotificationError GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args); + [DllImport(Libraries.Notification, EntryPoint = "notification_get_default_button")] + internal static extern NotificationError GetDefaultButton(NotificationSafeHandle handle, out int index); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_default_button")] + internal static extern NotificationError SetDefaultButton(NotificationSafeHandle handle, int index); + internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text) { NotificationError ret; diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs index d986c37..d7b9d7f 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs @@ -61,6 +61,15 @@ namespace Tizen.Applications.Notifications public bool IsAutoRemove { get; set; } = true; /// <summary> + /// Gets or sets the default button to display highlight on the active notification + /// </summary> + /// <remarks> + /// The default button for display highlight is only reflected on Tizen TV. + /// If you use this Property on other profile, this value have no effect + /// </remarks> + public ButtonIndex DefaultButton { get; set; } = ButtonIndex.None; + + /// <summary> /// Gets or sets a ReplyAction to this active notification style. /// </summary> /// <remarks> diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs index b5a1fe1..587c6ef 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs @@ -100,6 +100,11 @@ namespace Tizen.Applications.Notifications throw NotificationErrorFactory.GetException(ret, "unable to set background Image"); } + if (style.DefaultButton != ButtonIndex.None) + { + Interop.Notification.SetDefaultButton(notification.Handle, (int)style.DefaultButton + 1); + } + Interop.Notification.GetApplist(notification.Handle, out flag); Interop.Notification.SetApplist(notification.Handle, flag | (int)NotificationDisplayApplist.Active); @@ -179,6 +184,10 @@ namespace Tizen.Applications.Notifications active.BackgroundImage = path; } + int defaultIndex; + Interop.Notification.GetDefaultButton(notification.Handle, out defaultIndex); + active.DefaultButton = (ButtonIndex)(defaultIndex - 1); + appcontrol = null; Interop.Notification.GetImage(notification.Handle, NotificationImage.TextInputButton, out path); Interop.Notification.GetText(notification.Handle, NotificationText.InputButton, out text); diff --git a/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs b/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs index 3b3e42e..1e8b413 100755 --- a/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs +++ b/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs @@ -159,6 +159,9 @@ internal static partial class Interop [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_event_flag")] internal static extern ErrorCode GetEventFlag(NotificationSafeHandle handle, out bool eventFlag); + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_default_button")] + internal static extern ErrorCode GetDefaultButton(NotificationSafeHandle handle, out int index); + internal static ErrorCode GetAppId(NotificationSafeHandle handle, out string appid) { ErrorCode err; diff --git a/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs b/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs index 674a2b1..7495ffc 100755 --- a/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs +++ b/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs @@ -52,6 +52,11 @@ namespace Tizen.Applications.NotificationEventListener public string BackgroundImage { get; internal set; } /// <summary> + /// Gets the default button to display highlight on the active notification + /// </summary> + public ButtonIndex DefaultButton { get; internal set; } + + /// <summary> /// Gets timeout value in second when the notification can be hidden from the viewer. /// </summary> public int HideTimeout { get; internal set; } diff --git a/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs b/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs index 6ccb63d..f45e4aa 100755 --- a/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs +++ b/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs @@ -45,6 +45,10 @@ namespace Tizen.Applications.NotificationEventListener Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Background, out path); activeStyle.BackgroundImage = path; + int index; + Interop.NotificationEventListener.GetDefaultButton(eventargs.Handle, out index); + activeStyle.DefaultButton = (ButtonIndex)(index - 1); + Interop.NotificationEventListener.GetHideTimeout(eventargs.Handle, out timeout); activeStyle.HideTimeout = timeout; |