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.Notifications
19 internal static class ProgressBinder
21 internal static void BindObject(Notification notification)
25 Notification.ProgressType progress = notification.Progress;
27 if (progress.Category == ProgressCategory.PendingBar)
29 Interop.Notification.SetProgressType(notification.Handle, ProgressCategory.Percent);
33 else if (progress.Category == ProgressCategory.Percent)
35 Interop.Notification.SetProgressType(notification.Handle, progress.Category);
36 current = progress.ProgressCurrent / 100;
37 max = progress.ProgressMax;
41 Interop.Notification.SetProgressType(notification.Handle, progress.Category);
42 current = progress.ProgressCurrent;
43 max = progress.ProgressMax;
46 Interop.Notification.SetProgress(notification.Handle, current);
47 Interop.Notification.SetProgressSize(notification.Handle, max);
48 Interop.Notification.SetLayout(notification.Handle, NotificationLayout.Progress);
49 Interop.Notification.SetOngoingFlag(notification.Handle, true);
52 internal static void BindSafeHandle(Notification notification)
54 NotificationLayout layout;
55 Interop.Notification.GetLayout(notification.Handle, out layout);
57 if (layout == NotificationLayout.Progress)
59 ProgressCategory category;
62 Interop.Notification.GetProgressType(notification.Handle, out category);
63 Interop.Notification.GetProgress(notification.Handle, out current);
64 Interop.Notification.GetProgressSize(notification.Handle, out max);
66 if (category == ProgressCategory.Percent)
71 notification.Progress = new Notification.ProgressType(category, current, max);