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)
30 Interop.NotificationEventListener.GetStyleList(eventargs.Handle, out styleList);
32 if ((styleList & (int)NotificationDisplayApplist.Active) != 0)
34 NotificationEventArgs.ActiveStyleArgs activeStyle = new NotificationEventArgs.ActiveStyleArgs();
35 eventargs.Style.Add(activeStyle.Key, activeStyle);
37 for (int i = (int)ClickEventType.FirstButton; i <= (int)ClickEventType.ThirdButton; i++)
39 NotificationButtonActionArgBinder.BindObject(eventargs, i);
42 Interop.NotificationEventListener.GetAutoRemove(eventargs.Handle, out autoRemove);
43 activeStyle.IsAutoRemove = autoRemove;
45 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Background, out path);
46 activeStyle.BackgroundImage = path;
49 Interop.NotificationEventListener.GetDefaultButton(eventargs.Handle, out index);
50 activeStyle.DefaultButton = (ButtonIndex)(index - 1);
52 Interop.NotificationEventListener.GetHideTimeout(eventargs.Handle, out timeout);
53 activeStyle.HideTimeout = timeout;
57 Interop.NotificationEventListener.GetDeleteTimeout(eventargs.Handle, out timeout);
59 catch (TypeLoadException)
61 //To support in API version 3.0
64 activeStyle.DeleteTimeout = timeout;
66 NotificationReplyActionArgBinder.BindObject(eventargs);
69 if ((styleList & (int)NotificationDisplayApplist.Lock) != 0)
71 NotificationEventArgs.LockStyleArgs lockStyle = new NotificationEventArgs.LockStyleArgs();
72 eventargs.Style.Add(lockStyle.Key, lockStyle);
74 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Lockscreen, out path);
75 lockStyle.IconPath = path;
77 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.ThumbnailLockscreen, out path);
78 lockStyle.Thumbnail = path;
81 if ((styleList & (int)NotificationDisplayApplist.Ticker) != 0 || (styleList & (int)NotificationDisplayApplist.Indicator) != 0)
83 NotificationEventArgs.IndicatorStyleArgs indicatorStyle = new NotificationEventArgs.IndicatorStyleArgs();
84 eventargs.Style.Add(indicatorStyle.Key, indicatorStyle);
86 Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Indicator, out path);
87 indicatorStyle.IconPath = path;
89 Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.FirstMainText, out path);
90 indicatorStyle.SubText = path;