Adding Notifications App in Taskbar 46/295646/1
authorShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Wed, 12 Jul 2023 06:08:32 +0000 (11:38 +0530)
committerShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Wed, 12 Jul 2023 06:08:32 +0000 (11:38 +0530)
Change-Id: I163167ee0fcdc7bc365372c068dc38e93cca1fbc
Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
TaskBar/Models/AppInfoModel.cs
TaskBar/TaskBar.csproj
TaskBar/ViewModels/QuickAccessViewModel.cs
TaskBar/Views/MainView.cs
TaskBar/res/images/dark/notifications.png [new file with mode: 0644]
TaskBar/res/images/dark/notifications_new.png [new file with mode: 0644]
TaskBar/res/images/light/notifications.png [new file with mode: 0644]
TaskBar/res/images/light/notifications_new.png [new file with mode: 0644]
TaskBar/tizen-manifest.xml
packaging/org.tizen.taskbar-1.0.0.tpk

index f46804e..1808def 100644 (file)
@@ -99,6 +99,10 @@ namespace TaskBar.Models
             {
                 TaskBarAppsLauncher.LaunchApplication(ApplicationId);
             }
+            if (Name == "notifications")
+            {
+                IconUrl = Resources.GetCurrentThemePath() + "notifications.png";
+            }
         }
 
         private void OnMenuItemSelect(object selectedItemText)
index 2e22956..671604d 100644 (file)
@@ -25,7 +25,7 @@
     <PackageReference Include="SQLitePCLRaw.bundle_sqlite3" Version="2.1.4">
       <TreatAsUsed>true</TreatAsUsed>
     </PackageReference>
-    <PackageReference Include="Tizen.NET" Version="11.0.0.17808">
+    <PackageReference Include="Tizen.NET" Version="11.0.0.17895">
       <TreatAsUsed>true</TreatAsUsed>
     </PackageReference>
   </ItemGroup>
index f07eebf..107295c 100644 (file)
@@ -2,6 +2,7 @@
 using System.Collections;
 using System.Collections.Generic;
 using Tizen.Applications;
+using Tizen.Applications.NotificationEventListener;
 using Tizen.NUI;
 using TaskBar.Common;
 using TaskBar.Models;
@@ -20,6 +21,10 @@ namespace TaskBar.ViewModels
             ThemeManager.ThemeChanged += OnThemeChanged;
             ApplicationManager.ApplicationLaunched += OnApplicationLaunched;
             ApplicationManager.ApplicationTerminated += OnApplicationTerminated;
+
+            NotificationListenerManager.Added += OnNotificationAdded;
+            NotificationListenerManager.Deleted += OnNotificationDeleted;
+
             Tizen.Log.Info(Resources.LogTag, "QuickAccessViewModel");
         }
 
@@ -66,6 +71,39 @@ namespace TaskBar.ViewModels
             }
         }
 
+        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)
@@ -83,9 +121,9 @@ namespace TaskBar.ViewModels
             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
         }
 
@@ -140,6 +178,8 @@ namespace TaskBar.ViewModels
             ThemeManager.ThemeChanged -= OnThemeChanged;
             ApplicationManager.ApplicationLaunched -= OnApplicationLaunched;
             ApplicationManager.ApplicationTerminated -= OnApplicationTerminated;
+            NotificationListenerManager.Added -= OnNotificationAdded;
+            NotificationListenerManager.Deleted -= OnNotificationDeleted;
             Tizen.Log.Info(Resources.LogTag, "Dispose QuickAccessViewModel");
         }
 
index d61e665..49bbbd1 100644 (file)
@@ -29,7 +29,6 @@ namespace TaskBar.Views
 
         public MainView() : base()
         {
-            StyleName = "MainViewBackground";
             Size2D = Window.Instance.Size;
             CornerRadius = new Vector4(24, 24, 0, 0);
             Layout = new LinearLayout()
diff --git a/TaskBar/res/images/dark/notifications.png b/TaskBar/res/images/dark/notifications.png
new file mode 100644 (file)
index 0000000..0140f0a
Binary files /dev/null and b/TaskBar/res/images/dark/notifications.png differ
diff --git a/TaskBar/res/images/dark/notifications_new.png b/TaskBar/res/images/dark/notifications_new.png
new file mode 100644 (file)
index 0000000..e2d5f7a
Binary files /dev/null and b/TaskBar/res/images/dark/notifications_new.png differ
diff --git a/TaskBar/res/images/light/notifications.png b/TaskBar/res/images/light/notifications.png
new file mode 100644 (file)
index 0000000..7c37b5d
Binary files /dev/null and b/TaskBar/res/images/light/notifications.png differ
diff --git a/TaskBar/res/images/light/notifications_new.png b/TaskBar/res/images/light/notifications_new.png
new file mode 100644 (file)
index 0000000..116d55c
Binary files /dev/null and b/TaskBar/res/images/light/notifications_new.png differ
index 2cec0c3..5c426de 100644 (file)
@@ -14,6 +14,7 @@
       <privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
       <privilege>http://tizen.org/privilege/inputgenerator</privilege>
       <privilege>http://tizen.org/privilege/mediastorage</privilege>
+      <privilege>http://tizen.org/privilege/notification</privilege>
       <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
       <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
       <privilege>http://tizen.org/privilege/systemsettings</privilege>
index d9a752d..4bb23dc 100644 (file)
Binary files a/packaging/org.tizen.taskbar-1.0.0.tpk and b/packaging/org.tizen.taskbar-1.0.0.tpk differ