diff --git a/src/Tizen.Applications.Notification/Interop/Interop.Notification.cs b/src/Tizen.Applications.Notification/Interop/Interop.Notification.cs old mode 100644 new mode 100755 index 46988c4ce1d..0381b7dc29a --- a/src/Tizen.Applications.Notification/Interop/Interop.Notification.cs +++ b/src/Tizen.Applications.Notification/Interop/Interop.Notification.cs @@ -253,6 +253,13 @@ internal static class Notification [DllImport(Libraries.Notification, EntryPoint = "notification_get_pairing_type")] internal static extern NotificationError GetPairingType(NotificationSafeHandle handle, out bool pairing); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_image_size")] + internal static extern NotificationError SetExtensionImageSize(NotificationSafeHandle handle, int height); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_image_size")] + internal static extern NotificationError GetExtensionImageSize(NotificationSafeHandle handle, out int height); + internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text) { NotificationError ret; diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs index dbe43211294..f48d48383bc 100755 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs @@ -215,6 +215,12 @@ public int Count [EditorBrowsable(EditorBrowsableState.Never)] public bool PairingType { get; set; } = false; + [EditorBrowsable(EditorBrowsableState.Never)] + public string GroupTitle { get; set; } = string.Empty; + + [EditorBrowsable(EditorBrowsableState.Never)] + public string GroupContent { get; set; } = string.Empty; + /// /// Gets or sets NotificationSafeHandle. /// @@ -542,6 +548,7 @@ internal Notification Build() IndicatorBinder.BindSafeHandle(this); ActiveBinder.BindSafeHandle(this); LockBinder.BindSafehandle(this); + ExtensionBinder.BindSafehandle(this); return this; } diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs index 20fb9950148..8261dbfd9ce 100644 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs @@ -62,7 +62,7 @@ public ActiveStyle() /// IsAutoRemove option lets the active notification to be removed several seconds after it shows. /// When 'IsAutoRemove' is set as false, the active notification will not be removed as long as the user removes /// it or the application, which posted the active notification. - /// > + /// /// 3 public bool IsAutoRemove { get; set; } = true; diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs index 750914b164e..81af89dc35e 100755 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs @@ -134,6 +134,14 @@ private static void BindNotificationText(Notification notification) Interop.Notification.SetImage(notification.Handle, NotificationImage.Icon, notification.Icon); Interop.Notification.SetImage(notification.Handle, NotificationImage.SubIcon, notification.SubIcon); Interop.Notification.SetText(notification.Handle, NotificationText.EventCount, notification.Count.ToString(), null, -1); + + if (string.IsNullOrEmpty(notification.GroupTitle) == false) { + Interop.Notification.SetText(notification.Handle, NotificationText.GroupTitle, notification.GroupTitle, null, -1); + } + + if (string.IsNullOrEmpty(notification.GroupContent) == false) { + Interop.Notification.SetText(notification.Handle, NotificationText.GroupContent, notification.GroupContent, null, -1); + } } private static void BindNotificationTime(Notification notification) diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs index d014d0652e1..a5c8cfe34b0 100755 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs @@ -158,7 +158,7 @@ internal enum NotificationEventType SecondButton, ThirdButton, ClickOnIcon = 6, - ClockOnThumbnail = 7, + ClickOnThumbnail = 7, ClickOnTextInputButton = 8, HiddenByUser = 100, HiddenByTimeout = 101, @@ -184,6 +184,8 @@ internal enum NotificationText FirstSubText, SecondMainText, SecondSubText, + GroupTitle = 10, + GroupContent = 11, FirstButton = 13, SeceondButton = 14, ThirdButton = 15, @@ -204,6 +206,7 @@ internal enum NotificationImage SecondButton, ThirdButton, TextInputButton = 18, + Extension = 19, } internal enum LaunchOption diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationExtensionStyle.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationExtensionStyle.cs new file mode 100644 index 00000000000..b6b1036d5de --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationExtensionStyle.cs @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +namespace Tizen.Applications.Notifications +{ + using System.ComponentModel; + + /// + /// This class contains common properties and methods of notifications. + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class for generating extension style notification. + /// + /// 14 + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class ExtensionStyle : StyleBase + { + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsActive { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public string ExtensionImagePath { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public int ExtensionImageSize { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsThumbnail { get; set; } = false; + + [EditorBrowsable(EditorBrowsableState.Never)] + public string ThumbnailImagePath { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public AppControl ThumbnailAction { get; set; } + + /// + /// Gets the key of Extension. + /// + internal override string Key + { + get + { + return "Extension"; + } + } + + internal override void Make(Notification notification) + { + ExtensionBinder.BindObject(notification); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationResponseEventType.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationResponseEventType.cs old mode 100644 new mode 100755 index 674fcfa6bc0..ece376520b8 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationResponseEventType.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationResponseEventType.cs @@ -25,6 +25,11 @@ public enum NotificationResponseEventType /// ClickOnButton3, + /// + /// Event type : Click on thumbnail. + /// + ClickOnThumbnail = 7, + /// /// Event type : Click on text_input button. /// diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs index 1fd94f0d456..2e6ec5ac71c 100755 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs @@ -317,4 +317,100 @@ internal static void BindSafehandle(Notification notification) } } } + + internal static class ExtensionBinder + { + internal static void BindObject(Notification notification) + { + int applist; + Notification.ExtensionStyle style = (Notification.ExtensionStyle)notification.GetStyle("Extension"); + Interop.Notification.GetApplist(notification.Handle, out applist); + + if (style.IsThumbnail) { + Interop.Notification.SetLayout(notification.Handle, NotificationLayout.Thumbnail); + + if (string.IsNullOrEmpty(style.ThumbnailImagePath) == false) { + Interop.Notification.SetImage(notification.Handle, NotificationImage.Thumbnail, style.ThumbnailImagePath); + } + + if (style.ThumbnailAction != null && style.ThumbnailAction.SafeAppControlHandle.IsInvalid == false) + { + Interop.Notification.SetEventHandler(notification.Handle, (int)NotificationEventType.ClickOnThumbnail, style.ThumbnailAction.SafeAppControlHandle); + } + } else { + Interop.Notification.SetLayout(notification.Handle, NotificationLayout.Extension); + + if (string.IsNullOrEmpty(style.ExtensionImagePath) == false) + { + Interop.Notification.SetImage(notification.Handle, NotificationImage.Extension, style.ExtensionImagePath); + } + Interop.Notification.SetExtensionImageSize(notification.Handle, style.ExtensionImageSize); + } + + if (style.IsActive) + { + applist |= (int)NotificationDisplayApplist.Active; + Interop.Notification.SetApplist(notification.Handle, applist); + } + } + + internal static void BindSafehandle(Notification notification) + { + NotificationLayout layout; + bool isExisted = false; + SafeAppControlHandle appcontrol = null; + string path; + int appList; + + Interop.Notification.GetLayout(notification.Handle, out layout); + Interop.Notification.GetApplist(notification.Handle, out appList); + + Notification.ExtensionStyle style = new Notification.ExtensionStyle(); + if (layout == NotificationLayout.Thumbnail) + { + appcontrol = null; + Interop.Notification.GetEventHandler(notification.Handle, (int)NotificationEventType.ClickOnThumbnail, out appcontrol); + if (appcontrol != null && appcontrol.IsInvalid == false) + { + style.ThumbnailAction = new AppControl(appcontrol); + } + + Interop.Notification.GetImage(notification.Handle, NotificationImage.Thumbnail, out path); + if (string.IsNullOrEmpty(path) == false) + { + style.ThumbnailImagePath = path; + } + style.IsThumbnail = true; + + if ((appList & (int)NotificationDisplayApplist.Active) == 0) + { + style.IsActive = true; + } + + isExisted = true; + } + else if (layout == NotificationLayout.Extension) + { + int size = 0; + Interop.Notification.GetImage(notification.Handle, NotificationImage.Extension, out path); + if (string.IsNullOrEmpty(path) == false) + { + style.ExtensionImagePath = path; + } + Interop.Notification.GetExtensionImageSize(notification.Handle, out size); + style.ExtensionImageSize = size; + style.IsThumbnail = false; + + if ((appList & (int)NotificationDisplayApplist.Active) == 0) + { + style.IsActive = true; + } + + isExisted = true; + } + + if (isExisted) + notification.AddStyle(style); + } + } } diff --git a/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs index 95ad7cd08e5..baf8b7a65d5 100755 --- a/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs +++ b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs @@ -180,7 +180,8 @@ internal enum ErrorCode [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_send_event")] internal static extern ErrorCode SendEventWithNotification(NotificationSafeHandle handle, int evnetType); - + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_extension_image_size")] + internal static extern ErrorCode GetExtensionImageSize(NotificationSafeHandle handle, out int height); internal static ErrorCode GetAppId(NotificationSafeHandle handle, out string appid) { diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs index 487332c71ce..b7e446c825e 100755 --- a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs @@ -136,6 +136,12 @@ public NotificationEventArgs() [EditorBrowsable(EditorBrowsableState.Never)] public bool CheckedValue { get; internal set; } = false; + [EditorBrowsable(EditorBrowsableState.Never)] + public string GroupTitle { get; internal set; } = string.Empty; + + [EditorBrowsable(EditorBrowsableState.Never)] + public string GroupContent { get; internal set; } = string.Empty; + /// /// Gets the AppControl, which is invoked when notification is clicked. /// diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs index 1156f866b10..ed09e71c59d 100755 --- a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs @@ -84,6 +84,18 @@ internal static NotificationEventArgs BindObject(IntPtr notification, bool data) eventargs.SubIcon = text; } + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.GroupTitle, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.GroupTitle = text; + } + + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.GroupContent, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.GroupContent = text; + } + err = Interop.NotificationEventListener.GetTime(eventargs.Handle, out time); if (err != Interop.NotificationEventListener.ErrorCode.None) { diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs index d9b81f47e9a..4a1fbd22deb 100755 --- a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs @@ -145,6 +145,11 @@ public enum UserEventType /// ClickOnButton3, + /// + /// Event type : Click on thumbnail. + /// + ClickOnThumbnail = 7, + /// /// Event type : Click on text_input button. /// @@ -242,6 +247,16 @@ internal enum NotificationText /// SecondSubText, + /// + /// Group title + /// + GroupTitle = 10, + + /// + /// Group contents + /// + GroupContent = 11, + /// /// Text on button 1. /// @@ -327,6 +342,11 @@ internal enum NotificationImage /// Image for message reply. /// TextInputButton = 18, + + /// + /// Image for Extension. + /// + Extension = 19, } /// @@ -358,6 +378,11 @@ internal enum NotificationLayout /// Layout for ongoing notification. Used to display progress. /// OngoingProgress = 5, + + /// + /// Layout for ongoing notification. Used to display progress. + /// + Extension = 6 } /// diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsExtensionStyle.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsExtensionStyle.cs new file mode 100644 index 00000000000..f074aef695a --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsExtensionStyle.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System.ComponentModel; + + /// + /// This class provides methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to generate the extension style notification. + /// + /// 14 + [EditorBrowsable(EditorBrowsableState.Never)] + public class ExtensionStyleArgs : StyleArgs + { + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsActive { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public string ExtensionImagePath { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public int ExtensionImageSize { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsThumbnail { get; set; } = false; + + [EditorBrowsable(EditorBrowsableState.Never)] + public string ThumbnailImagePath { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public AppControl ThumbnailAction { get; set; } + + internal override string Key + { + get + { + return "Extension"; + } + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs index 0ccf9bba9aa..b37b629c26f 100755 --- a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs @@ -111,6 +111,63 @@ internal static void BindObject(NotificationEventArgs eventargs) Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.FirstMainText, out path); indicatorStyle.SubText = path; } - } + + /* for extension */ + bool isExisted = false; + int size = 0; + NotificationLayout layout; + NotificationEventArgs.ExtensionStyleArgs extensionStyle = new NotificationEventArgs.ExtensionStyleArgs(); + + Interop.NotificationEventListener.GetLayout(eventargs.Handle, out layout); + if (layout == NotificationLayout.Thumbnail) + { + appcontrol = null; + Interop.NotificationEventListener.GetEventHandler(eventargs.Handle, (int)ClickEventType.Thumbnail, out appcontrol); + if (appcontrol != null && appcontrol.IsInvalid == false) + { + extensionStyle.ThumbnailAction = new AppControl(appcontrol); + } + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Thumbnail, out path); + if (string.IsNullOrEmpty(path) == false) + { + extensionStyle.ThumbnailImagePath = path; + } + + extensionStyle.IsThumbnail = true; + + if ((styleList & (int)NotificationDisplayApplist.Active) != 0) + { + extensionStyle.IsActive = true; + } + + isExisted = true; + } + else if (layout == NotificationLayout.Extension) + { + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Extension, out path); + if (string.IsNullOrEmpty(path) == false) + { + extensionStyle.ExtensionImagePath = path; + } + + Interop.NotificationEventListener.GetExtensionImageSize(eventargs.Handle, out size); + extensionStyle.ExtensionImageSize = size; + extensionStyle.IsThumbnail = false; + + if ((styleList & (int)NotificationDisplayApplist.Active) != 0) + { + extensionStyle.IsActive = true; + } + + isExisted = true; + } + + if (isExisted) + { + eventargs.Style.Add(extensionStyle.Key, extensionStyle); + } + /* for extension end */ + } } }