using System.Collections;
using System.Collections.Generic;
using Tizen.Applications;
+using Tizen.Applications.NotificationEventListener;
using Tizen.NUI;
using TaskBar.Common;
using TaskBar.Models;
ThemeManager.ThemeChanged += OnThemeChanged;
ApplicationManager.ApplicationLaunched += OnApplicationLaunched;
ApplicationManager.ApplicationTerminated += OnApplicationTerminated;
+
+ NotificationListenerManager.Added += OnNotificationAdded;
+ NotificationListenerManager.Deleted += OnNotificationDeleted;
+
Tizen.Log.Info(Resources.LogTag, "QuickAccessViewModel");
}
}
}
+ private void OnNotificationDeleted(object sender, NotificationDeleteEventArgs e)
+ {
+ var notificationsList = NotificationListenerManager.GetList();
+ if (notificationsList == null || notificationsList.Count == 0)
+ {
+ UpdateNotificationsIcon(false);
+ }
+ }
+
+ private void OnNotificationAdded(object sender, NotificationEventArgs e)
+ {
+ UpdateNotificationsIcon(true);
+ }
+
+ private void UpdateNotificationsIcon(bool isNotificationPresent)
+ {
+ foreach (AppInfoModel item in ButtonsInfo)
+ {
+ if (item.Name != "notifications")
+ {
+ continue;
+ }
+ if (isNotificationPresent == true)
+ {
+ item.IconUrl = Resources.GetCurrentThemePath() + "notifications_new.png";
+ }
+ else
+ {
+ item.IconUrl = Resources.GetCurrentThemePath() + "notifications.png";
+ }
+ }
+ }
+
private void UpdateRunningStatus(string appId, bool isRunning)
{
foreach(var item in ButtonsInfo)
appInfo.Add("back", string.Empty);
appInfo.Add("home", "org.tizen.homescreen-nui");
appInfo.Add("apps", "org.tizen.Apps");
- appInfo.Add("settings", "org.tizen.SettingView");
+ appInfo.Add("settings", "org.tizen.cssettings");
appInfo.Add("volume", "org.tizen.volume-nui");
- //appInfo.Add("notifications", "org.tizen.notifications"); //Will be added Later
+ appInfo.Add("notifications", "org.tizen.notifications");
//appInfo.Add("power", "org.tizen.powerkey-syspopup"); //Will be added Later
}
ThemeManager.ThemeChanged -= OnThemeChanged;
ApplicationManager.ApplicationLaunched -= OnApplicationLaunched;
ApplicationManager.ApplicationTerminated -= OnApplicationTerminated;
+ NotificationListenerManager.Added -= OnNotificationAdded;
+ NotificationListenerManager.Deleted -= OnNotificationDeleted;
Tizen.Log.Info(Resources.LogTag, "Dispose QuickAccessViewModel");
}