2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 namespace Tizen.Applications.NotificationEventListener
21 internal static class NotificationStyleArgBinder
23 internal static void BindObject(NotificationEventArgs eventargs)
29 SafeAppControlHandle appcontrol = null;
31 Interop.NotificationEventListener.GetStyleList(eventargs.Handle, out styleList);
33 if ((styleList & (int)NotificationDisplayApplist.Active) != 0)
35 NotificationEventArgs.ActiveStyleArgs activeStyle = new NotificationEventArgs.ActiveStyleArgs();
36 eventargs.Style.Add(activeStyle.Key, activeStyle);
38 for (int i = (int)ClickEventType.FirstButton; i <= (int)ClickEventType.ThirdButton; i++)
40 NotificationButtonActionArgBinder.BindObject(eventargs, i);
43 Interop.NotificationEventListener.GetAutoRemove(eventargs.Handle, out autoRemove);
44 activeStyle.IsAutoRemove = autoRemove;
46 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Background, out path);
47 activeStyle.BackgroundImage = path;
50 Interop.NotificationEventListener.GetDefaultButton(eventargs.Handle, out index);
51 activeStyle.DefaultButton = (ButtonIndex)(index - 1);
53 Interop.NotificationEventListener.GetHideTimeout(eventargs.Handle, out timeout);
54 activeStyle.HideTimeout = timeout;
58 Interop.NotificationEventListener.GetDeleteTimeout(eventargs.Handle, out timeout);
60 catch (TypeLoadException)
62 //To support in API version 3.0
65 activeStyle.DeleteTimeout = timeout;
68 Interop.NotificationEventListener.GetExtensionAction(eventargs.Handle, UserEventType.HiddenByUser, out appcontrol);
69 if (appcontrol != null && appcontrol.IsInvalid == false)
71 activeStyle.HiddenByUserAction = new AppControl(appcontrol);
75 Interop.NotificationEventListener.GetExtensionAction(eventargs.Handle, UserEventType.HiddenByTimeout, out appcontrol);
76 if (appcontrol != null && appcontrol.IsInvalid == false)
78 activeStyle.HiddenByTimeoutAction = new AppControl(appcontrol);
82 Interop.NotificationEventListener.GetExtensionAction(eventargs.Handle, UserEventType.HiddenByExternal, out appcontrol);
83 if (appcontrol != null && appcontrol.IsInvalid == false)
85 activeStyle.HiddenByExternalAction = new AppControl(appcontrol);
88 NotificationReplyActionArgBinder.BindObject(eventargs);
91 if ((styleList & (int)NotificationDisplayApplist.Lock) != 0)
93 NotificationEventArgs.LockStyleArgs lockStyle = new NotificationEventArgs.LockStyleArgs();
94 eventargs.Style.Add(lockStyle.Key, lockStyle);
96 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Lockscreen, out path);
97 lockStyle.IconPath = path;
99 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.ThumbnailLockscreen, out path);
100 lockStyle.Thumbnail = path;
103 if ((styleList & (int)NotificationDisplayApplist.Ticker) != 0 || (styleList & (int)NotificationDisplayApplist.Indicator) != 0)
105 NotificationEventArgs.IndicatorStyleArgs indicatorStyle = new NotificationEventArgs.IndicatorStyleArgs();
106 eventargs.Style.Add(indicatorStyle.Key, indicatorStyle);
108 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Indicator, out path);
109 indicatorStyle.IconPath = path;
111 Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.FirstMainText, out path);
112 indicatorStyle.SubText = path;