The patch contains following changes: 05/297605/5
authorShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Mon, 21 Aug 2023 11:09:08 +0000 (16:39 +0530)
committerShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Tue, 22 Aug 2023 08:47:01 +0000 (14:17 +0530)
1. Dark and Light Theme Implementation.
2. Detailed Notifications Option.

Change-Id: Iff6b4059ea8eb5359bed027c01e181aa26558daa
Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
17 files changed:
.gitignore
Notifications/Common/AppConstants.cs
Notifications/CustomBorder.cs
Notifications/Models/NotificationsModel.cs
Notifications/Notifications.cs
Notifications/Notifications.csproj
Notifications/ViewManager.cs [new file with mode: 0644]
Notifications/ViewModels/NotificationsDetailViewModel.cs [new file with mode: 0644]
Notifications/ViewModels/NotificationsViewModel.cs
Notifications/Views/BaseView.cs
Notifications/Views/ViewManager.cs [deleted file]
Notifications/res/images/dark/clear.png [new file with mode: 0644]
Notifications/res/images/minimize.png [new file with mode: 0644]
Notifications/res/themes/dark.xaml [new file with mode: 0644]
Notifications/res/themes/light.xaml [new file with mode: 0644]
Notifications/tizen-manifest.xml
packaging/org.tizen.Notifications-1.0.0.tpk

index ec877b852ab5e864f3501427230bd8bbcb0b8a87..ea0b5abb68fb06cf8bbb30275e3b89180c392fba 100644 (file)
@@ -2,6 +2,7 @@
 .vscode/*
 **/[Bb]in/
 **/[Oo]bj/
+**/*.csproj.user
 [Bb]uild/
 [Dd]ebug/
 .gn
index 2fedf8f950d48a518d7a6b0dc6d4568296ef262f..501c7f1b59d7156e4e14e23a5c91476365f40b84 100644 (file)
@@ -8,20 +8,22 @@ namespace Notifications.Common
         public const string LightPlatformThemeId = "org.tizen.default-light-theme";
         public const string DarkPlatformThemeId = "org.tizen.default-dark-theme";
 
+        public static Color LightBorderColor = new Color(0.9804f, 0.9804f, 0.9804f, 0.35f);
+        public static Color DarkBorderColor = new Color(0.0863f, 0.0745f, 0.0980f, 0.50f);
+
         public static Size2D DefaultWindowSize = new Size2D(960, 540);
-        public static Size2D IconSize = new Size2D(48, 48);
-        public static Size2D SmallIconSize = new Size2D(32, 32);
-        public static Size2D TextButtonSize = new Size2D(150, 48);
 
         public static Position2D DefaultWindowPosition = new Position2D(480, 170);
 
         public const int BorderHeight = 52;
         public const int HeaderHeight = 64;
-        public const int TitlePixelSize = 24;
+        public const int NotificationItemHeight = 80;
 
+        public static Vector4 BorderCornerRadius = new Vector4(24, 24, 24, 24);
         public static Vector4 BaseViewCornerRadius = new Vector4(24, 24, 24, 24);
 
         public static Extents BaseViewPadding = new Extents(0, 0, 20, 20);
         public static Extents HeaderPadding = new Extents(16, 16, 8, 8);
+        public static Extents DetailContentMargin = new Extents(64, 64, 8, 8);
     }
 }
index bd7b293a2870d005dcda5374a5761dc14371f06a..d51f75dc5f99105d8121a272c8b7f606d0d580b8 100644 (file)
@@ -6,6 +6,7 @@ namespace Notifications
 {
     class CustomBorder : DefaultBorder
     {
+        private ImageView minimizeIcon;
         private ImageView maximalizeIcon;
         private ImageView closeIcon;
         private ImageView leftCornerIcon;
@@ -14,14 +15,26 @@ namespace Notifications
 
         public CustomBorder() : base()
         {
+            ThemeManager.ThemeChanged += OnThemeChanged;
+        }
+
+        private void OnThemeChanged(object sender, ThemeChangedEventArgs e)
+        {
+            if (e.IsPlatformThemeChanged)
+            {
+                if (borderView != null)
+                {
+                    borderView.BackgroundColor = ThemeManager.PlatformThemeId == AppConstants.LightPlatformThemeId ? AppConstants.LightBorderColor : AppConstants.DarkBorderColor;
+                }
+            }
         }
 
         public override void CreateBorderView(View borderView)
         {
             this.borderView = borderView;
-            borderView.CornerRadius = new Vector4(24, 24, 24, 24);
+            borderView.CornerRadius = AppConstants.BorderCornerRadius;
             borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
-            borderView.BackgroundColor = new Color(1, 1, 1, 0.3f);
+            borderView.BackgroundColor = ThemeManager.PlatformThemeId == AppConstants.LightPlatformThemeId ? AppConstants.LightBorderColor : AppConstants.DarkBorderColor;
         }
 
         public override bool CreateBottomBorderView(View bottomView)
@@ -31,6 +44,14 @@ namespace Notifications
                 return false;
             }
             bottomView.Layout = new RelativeLayout();
+
+            minimizeIcon = new ImageView()
+            {
+                Focusable = true,
+                ResourceUrl = Resources.GetImagePath() + "/minimize.png",
+                AccessibilityHighlightable = true,
+            };
+
             maximalizeIcon = new ImageView()
             {
                 Focusable = true,
@@ -59,6 +80,10 @@ namespace Notifications
                 AccessibilityHighlightable = true,
             };
 
+            RelativeLayout.SetRightTarget(minimizeIcon, maximalizeIcon);
+            RelativeLayout.SetRightRelativeOffset(minimizeIcon, 0.0f);
+            RelativeLayout.SetHorizontalAlignment(minimizeIcon, RelativeLayout.Alignment.End);
+
             RelativeLayout.SetRightTarget(maximalizeIcon, closeIcon);
             RelativeLayout.SetRightRelativeOffset(maximalizeIcon, 0.0f);
             RelativeLayout.SetHorizontalAlignment(maximalizeIcon, RelativeLayout.Alignment.End);
@@ -71,15 +96,23 @@ namespace Notifications
             RelativeLayout.SetHorizontalAlignment(rightCornerIcon, RelativeLayout.Alignment.End);
 
             bottomView.Add(leftCornerIcon);
+            bottomView.Add(minimizeIcon);
             bottomView.Add(maximalizeIcon);
             bottomView.Add(closeIcon);
             bottomView.Add(rightCornerIcon);
 
+            minimizeIcon.TouchEvent += OnMinimizeIconTouched;
             maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
             closeIcon.TouchEvent += OnCloseIconTouched;
             leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
             rightCornerIcon.TouchEvent += OnRightBottomCornerIconTouched;
 
+
+            minimizeIcon.AccessibilityActivated += (s, e) =>
+            {
+                MinimizeBorderWindow();
+            };
+
             maximalizeIcon.AccessibilityActivated += (s, e) =>
             {
                 MaximizeBorderWindow();
@@ -90,6 +123,11 @@ namespace Notifications
                 CloseBorderWindow();
             };
 
+            minimizeIcon.AccessibilityNameRequested += (s, e) =>
+            {
+                e.Name = "Minimize";
+            };
+
             maximalizeIcon.AccessibilityNameRequested += (s, e) =>
             {
                 e.Name = "Maximize";
@@ -110,6 +148,7 @@ namespace Notifications
                 e.Name = "Resize";
             };
 
+            minimizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
             maximalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
             closeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
             leftCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
index 541d273d56690321935070f4afd03055b471c149..072910abff96f70d7c5259f0b7f98d04676a69e5 100644 (file)
@@ -10,13 +10,10 @@ namespace Notifications.Models
     {
         public event PropertyChangedEventHandler PropertyChanged;
 
-        private readonly string appId;
-        private readonly int uniqueNumber;
-
         public NotificationsModel(string appId, int uniqueNumber, string title, string content)
         {
-            this.appId = appId;
-            this.uniqueNumber = uniqueNumber;
+            AppId = appId;
+            UniqueNumber = uniqueNumber;
             this.title = title ?? string.Empty;
             subTitle = content ?? string.Empty;
             ClearNotificationCommand = new Command(OnNotificationCleared);
@@ -27,6 +24,9 @@ namespace Notifications.Models
             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
         }
 
+        public string AppId { get; internal set; }
+        public int UniqueNumber { get; internal set; }
+
         private string title;
         public string Title
         {
@@ -64,7 +64,7 @@ namespace Notifications.Models
         {
             try
             {
-                NotificationListenerManager.Delete(appId, uniqueNumber);
+                NotificationListenerManager.Delete(AppId, UniqueNumber);
             }
             catch (Exception ex)
             {
index aabc806d20297bf08f84d01f09760101280bdfac..4af2278b283847f615613d0909f56fb1a47c6d31 100644 (file)
@@ -1,8 +1,7 @@
 using System.Collections.Generic;
+using Tizen.Applications;
 using Tizen.NUI;
 using Notifications.Common;
-using Notifications.Views;
-using Tizen.Applications;
 
 namespace Notifications
 {
@@ -10,9 +9,11 @@ namespace Notifications
     {
         private Window window;
         private ViewManager viewManager;
+
         public Program() : base(AppConstants.DefaultWindowSize, AppConstants.DefaultWindowPosition, ThemeOptions.PlatformThemeEnabled, new CustomBorder())
         {
         }
+
         protected override void OnCreate()
         {
             base.OnCreate();
@@ -37,11 +38,8 @@ namespace Notifications
             UpdateWindowSize();
             UpdateWindowPosition();
             window.BackgroundColor = Color.Transparent;
-            window.KeyEvent += OnKeyEvent;
-            window.Resized += OnWindowResized;
             window.OrientationChanged += OnWindowOrientationChanged;
             viewManager = new ViewManager();
-            Tizen.Log.Info(AppConstants.LogTag, "Show Window");
         }
 
         private void UpdateWindowSize()
@@ -71,27 +69,12 @@ namespace Notifications
             Tizen.Log.Info(AppConstants.LogTag, "position Y is: " + window.WindowPosition.Y);
         }
 
-        private void OnWindowResized(object sender, Window.ResizedEventArgs e)
-        {
-            Tizen.Log.Debug(AppConstants.LogTag, "Resized Event");
-            viewManager.UpdateViewOnResize();
-        }
-
         private void OnWindowOrientationChanged(object sender, WindowOrientationChangedEventArgs e)
         {
             Tizen.Log.Debug(AppConstants.LogTag, "orientation changed" + e.WindowOrientation);
             DeviceInfo.UpdateDeviceInfo();
             UpdateWindowSize();
             UpdateWindowPosition();
-            viewManager.UpdateViewOnResize();
-        }
-
-        public void OnKeyEvent(object sender, Window.KeyEventArgs e)
-        {
-            if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
-            {
-                Exit();
-            }
         }
 
         protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
@@ -112,4 +95,4 @@ namespace Notifications
             app.Run(args);
         }
     }
-}
+}
\ No newline at end of file
index 1a32e8292d6c31c4432f5ea3cc7e37041d8114be..255472ed14c98a727beb1d7f7dab2c8a932aa4a9 100644 (file)
@@ -3,6 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>tizen11.0</TargetFramework>
+    <AssemblyName>Notifications</AssemblyName>
   </PropertyGroup>
 
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>None</DebugType>
   </PropertyGroup>
-  
+
   <ItemGroup>
-    <Folder Include="lib\" />
-    <Folder Include="res\images\" />
+    <None Update="res\themes\dark.xaml">
+      <Generator>MSBuild:Compile</Generator>
+    </None>
+    <None Update="res\themes\light.xaml">
+      <Generator>MSBuild:Compile</Generator>
+    </None>
   </ItemGroup>
 
 </Project>
diff --git a/Notifications/ViewManager.cs b/Notifications/ViewManager.cs
new file mode 100644 (file)
index 0000000..34b313c
--- /dev/null
@@ -0,0 +1,103 @@
+using System;
+using System.IO;
+using Tizen.Applications.NotificationEventListener;
+using Tizen.NUI;
+using Tizen.NUI.Xaml;
+using Notifications.Common;
+using Notifications.ViewModels;
+using Notifications.Views;
+
+namespace Notifications
+{
+    class ViewManager
+    {
+        private NotificationsViewModel notificationsViewModel;
+        private NotificationsDetailViewModel notificationsDetailViewModel;
+        private BaseView baseView;
+        public ViewManager()
+        {
+            notificationsViewModel = new NotificationsViewModel();
+            notificationsViewModel.NotificationSelected += OnNotificationSelected;
+            UpdateTheme(ThemeManager.PlatformThemeId);
+            baseView = new BaseView();
+            baseView.BindingContext = notificationsViewModel;
+            baseView.BackKeyPressed += OnBackKeyPressed;
+            Window.Instance.Add(baseView);
+
+            ThemeManager.ThemeChanged += OnThemeChanged;
+        }
+
+        private void OnThemeChanged(object sender, ThemeChangedEventArgs e)
+        {
+            if (e.IsPlatformThemeChanged)
+            {
+                Tizen.Log.Info(AppConstants.LogTag, "Theme Changed: " + e.ThemeId);
+                UpdateTheme(e.PlatformThemeId);
+            }
+        }
+
+        private void OnBackKeyPressed(object sender, EventArgs e)
+        {
+            if(baseView.BackKeyEventEmitted() == true)
+            {
+                Tizen.Applications.Application.Current.Exit();
+            }
+        }
+
+        private void OnNotificationSelected(object sender, NotificationEventArgs e)
+        {
+            notificationsDetailViewModel = new NotificationsDetailViewModel(e.AppID, e.Content);
+            notificationsDetailViewModel.DetailContentRemoved += OnDetailContentRemoved;
+            baseView.BindingContext = notificationsDetailViewModel;
+            baseView.AddDetailContentView();
+        }
+
+        private void OnDetailContentRemoved()
+        {
+            notificationsDetailViewModel.DetailContentRemoved -= OnDetailContentRemoved;
+            baseView.BindingContext = notificationsViewModel;
+            baseView.UpdateContent();
+        }
+
+        private void SetTheme(string path)
+        {
+            try
+            {
+                Theme theme = new Theme(path);
+                ThemeManager.ApplyTheme(theme);
+            }
+            catch (ArgumentNullException e)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "ArgumentNullException: " + e.ParamName);
+            }
+            catch (IOException e)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "IOException: " + e.Message);
+            }
+            catch (XamlParseException e)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "XamlParseException: " + e.Message);
+                if (e.XmlInfo != null)
+                {
+                    Tizen.Log.Error(AppConstants.LogTag, "XamlParseException, LineNo." + e.XmlInfo.LineNumber + " Pos: " + e.XmlInfo.LinePosition + " HasInfo: " + e.XmlInfo.HasLineInfo().ToString());
+                }
+            }
+        }
+        private void UpdateTheme(string platformThemeId)
+        {
+            if (platformThemeId == null)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "Platform theme id is null");
+                return;
+            }
+            if (platformThemeId.Equals(AppConstants.LightPlatformThemeId))
+            {
+                SetTheme(Resources.GetThemePath() + "light.xaml");
+            }
+            else if (platformThemeId.Equals(AppConstants.DarkPlatformThemeId))
+            {
+                SetTheme(Resources.GetThemePath() + "dark.xaml");
+            }
+        }
+    }
+}
diff --git a/Notifications/ViewModels/NotificationsDetailViewModel.cs b/Notifications/ViewModels/NotificationsDetailViewModel.cs
new file mode 100644 (file)
index 0000000..9cb5611
--- /dev/null
@@ -0,0 +1,84 @@
+using System;
+using System.ComponentModel;
+using Tizen.Applications;
+using Tizen.NUI.Binding;
+using Notifications.Common;
+
+namespace Notifications.ViewModels
+{
+    class NotificationsDetailViewModel : INotifyPropertyChanged
+    {
+        public event PropertyChangedEventHandler PropertyChanged;
+        public event Action DetailContentRemoved;
+
+        public NotificationsDetailViewModel(string appId, string text)
+        {
+            AppId = appId;
+            DetailContent = text ?? "Detail Content Absent";
+            BackCommand = new Command(OnBackPressed);
+            AppLaunchCommand = new Command(OnAppLaunched);
+        }
+
+        public string AppId { get; internal set; }
+
+        private void OnPropertyChanged(string propertyName)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+
+        private string detailContent;
+        public string DetailContent
+        {
+            get => detailContent;
+            set
+            {
+                detailContent = value;
+                OnPropertyChanged("DetailContent");
+            }
+        }
+
+        private Command backCommand;
+        public Command BackCommand
+        {
+            get => backCommand;
+            set
+            {
+                backCommand = value;
+                OnPropertyChanged("BackCommand");
+            }
+        }
+
+        private void OnBackPressed()
+        {
+            DetailContentRemoved.Invoke();
+        }
+
+        private Command appLaunchCommand;
+        public Command AppLaunchCommand
+        {
+            get => appLaunchCommand;
+            set
+            {
+                appLaunchCommand = value;
+                OnPropertyChanged("AppLaunchCommand");
+            }
+        }
+
+        private void OnAppLaunched()
+        {
+            AppControl appControl = new AppControl()
+            {
+                ApplicationId = AppId,
+                Operation = AppControlOperations.Default,
+            };
+            try
+            {
+                AppControl.SendLaunchRequest(appControl);
+            }
+            catch (Exception ex)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "exception: " + ex.Message);
+            }
+        }
+    }
+}
index 5d7e0514d56a645cb29c00cff8ea3b9678688713..8423fc59309fc7d4723e48b48074363cda7e82a2 100644 (file)
@@ -3,12 +3,15 @@ using System.ComponentModel;
 using Tizen.Applications.NotificationEventListener;
 using Tizen.NUI;
 using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using Notifications.Models;
 
 namespace Notifications.ViewModels
 {
     class NotificationsViewModel : IDisposable, INotifyPropertyChanged
     {
         public event PropertyChangedEventHandler PropertyChanged;
+        public event EventHandler<NotificationEventArgs> NotificationSelected;
 
         public NotificationsViewModel()
         {
@@ -17,6 +20,7 @@ namespace Notifications.ViewModels
 
             BackCommand = new Command(OnBackPressed);
             ClearAllNotificationsCommand = new Command(OnAllNotificationsCleared);
+            SelectionChangedCommand = new Command(OnSelectionChanged);
 
             NotificationListenerManager.Added += OnNotificationAdded;
             NotificationListenerManager.Deleted += OnNotificationDeleted;
@@ -99,5 +103,34 @@ namespace Notifications.ViewModels
         {
             NotificationListenerManager.DeleteAll();
         }
+
+        private Command selectionChangedCommand;
+        public Command SelectionChangedCommand
+        {
+            get => selectionChangedCommand;
+            set
+            {
+                selectionChangedCommand = value;
+                OnPropertyChanged("SelectionChangedCommand");
+            }
+        }
+
+        private void OnSelectionChanged(object selectionChangedParameter)
+        {
+            if (selectionChangedParameter is SelectionChangedEventArgs e)
+            {
+                if (e.CurrentSelection.Count != 0 && e.CurrentSelection[0] is NotificationsModel notificationsModel)
+                {
+                    var notificationsList = NotificationListenerManager.GetList();
+                    foreach (NotificationEventArgs notificationArgs in notificationsList)
+                    {
+                        if (notificationArgs.UniqueNumber == notificationsModel.UniqueNumber)
+                        {
+                            NotificationSelected?.Invoke(this, notificationArgs);
+                        }
+                    }
+                }
+            }
+        }
     }
 }
index bb44e71a5e8bc04a3089fccd7ead930025300280..3c38778ea77a432dedf66d92868d2640d0aebe70 100644 (file)
@@ -25,15 +25,16 @@ namespace Notifications.Views
         private View topView;
         private Button backButton;
         private TextLabel titleText;
-        private CollectionView notificationsView;
-        private View bottomView;
         private Button clearAllButton;
+        private CollectionView notificationsView;
         private TextLabel noNotificationsText;
+        private Button detailContentView;
 
         public BaseView() : base()
         {
-            Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height);
-            BackgroundColor = new Color("#FAFAFA");
+            StyleName = "BaseView";
+            WidthResizePolicy = ResizePolicyType.FillToParent;
+            HeightResizePolicy = ResizePolicyType.FillToParent;
             CornerRadius = AppConstants.BaseViewCornerRadius;
             Layout = new LinearLayout()
             {
@@ -47,6 +48,50 @@ namespace Notifications.Views
             this.SetBinding(IsContentAvailableProperty, "IsNotificationsPresent");
         }
 
+        public void UpdateContent()
+        {
+            RemoveContent();
+
+            if (IsContentAvailable == true)
+            {
+                AddNotificationsView();
+                AddClearAllButton();
+            }
+            else
+            {
+                AddNoNotificationsText();
+            }
+        }
+
+        public void AddDetailContentView()
+        {
+
+            RemoveContent();
+            if (detailContentView == null)
+            {
+                detailContentView = new Button()
+                {
+                    StyleName = "DetailContentView",
+                    WidthSpecification = LayoutParamPolicies.MatchParent,
+                    HeightSpecification = LayoutParamPolicies.WrapContent,
+                    Margin = AppConstants.DetailContentMargin.SpToPx(),
+                };
+                detailContentView.SetBinding(Button.TextProperty, "DetailContent");
+                detailContentView.SetBinding(Control.CommandProperty, "AppLaunchCommand");
+            }
+            Add(detailContentView);
+        }
+
+        public bool BackKeyEventEmitted()
+        {
+            if (detailContentView != null && detailContentView.GetParent() == this)
+            {
+                backButton.Command.Execute(null);
+                return false;
+            }
+            return true;
+        }
+
         private void AddTopView()
         {
             topView = new View()
@@ -64,13 +109,7 @@ namespace Notifications.Views
 
         private void AddTopViewElements()
         {
-            backButton = new Button()
-            {
-                Size2D = AppConstants.IconSize.SpToPx(),
-                IconURL = Resources.GetImagePath() + "/light/back.png",
-                BackgroundColor = Color.Transparent,
-            };
-            backButton.Icon.Size2D = AppConstants.IconSize.SpToPx();
+            backButton = new Button("BackButton");
             RelativeLayout.SetVerticalAlignment(backButton, RelativeLayout.Alignment.Center);
             RelativeLayout.SetHorizontalAlignment(backButton, RelativeLayout.Alignment.Start);
             backButton.SetBinding(Control.CommandProperty, "BackCommand");
@@ -78,38 +117,22 @@ namespace Notifications.Views
 
             titleText = new TextLabel()
             {
+                StyleName = "TitleText",
                 Text = "Notifications",
                 HeightSpecification = LayoutParamPolicies.MatchParent,
                 VerticalAlignment = VerticalAlignment.Center,
-                FontFamily = "BreezeSans",
-                PixelSize = AppConstants.TitlePixelSize.SpToPx(),
-                TextColor = new Color("#090E21"),
             };
             RelativeLayout.SetLeftTarget(titleText, backButton);
             RelativeLayout.SetLeftRelativeOffset(titleText, 1.0f);
             topView.Add(titleText);
         }
 
-        private void UpdateContent()
-        {
-            RemoveContent();
-
-            if (IsContentAvailable == true)
-            {
-                AddNotificationsView();
-                AddBottomView();
-            }
-            else
-            {
-                AddNoNotificationsText();
-            }
-        }
-
         private void RemoveContent()
         {
             Remove(noNotificationsText);
             Remove(notificationsView);
-            Remove(bottomView);
+            Remove(detailContentView);
+            topView?.Remove(clearAllButton);
         }
 
         private void AddNotificationsView()
@@ -123,19 +146,16 @@ namespace Notifications.Views
                     {
                         DefaultLinearItem item = new DefaultLinearItem();
                         item.WidthSpecification = LayoutParamPolicies.MatchParent;
+                        item.HeightSpecification = AppConstants.NotificationItemHeight.SpToPx();
+                        item.Label.StyleName = "TitleText";
                         item.Label.SetBinding(TextLabel.TextProperty, "Title");
                         item.Label.HorizontalAlignment = HorizontalAlignment.Begin;
-                        item.Label.FontFamily = "BreezeSans";
+                        item.Label.VerticalAlignment = VerticalAlignment.Bottom;
+                        item.SubLabel.StyleName = "TitleText";
                         item.SubLabel.SetBinding(TextLabel.TextProperty, "SubTitle");
                         item.SubLabel.HorizontalAlignment = HorizontalAlignment.Begin;
-                        item.SubLabel.FontFamily = "BreezeSans";
-                        item.Extra = new Button()
-                        {
-                            Size2D = AppConstants.SmallIconSize.SpToPx().SpToPx(),
-                            IconURL = Resources.GetImagePath() + "/light/clear.png",
-                            BackgroundColor = Color.Transparent,
-                        };
-                        (item.Extra as Button).Icon.Size2D = AppConstants.SmallIconSize.SpToPx().SpToPx();
+                        item.SubLabel.VerticalAlignment = VerticalAlignment.Top;
+                        item.Extra = new Button("ClearButton");
                         item.Extra.SetBinding(Control.CommandProperty, "ClearNotificationCommand");
                         return item;
                     }),
@@ -145,41 +165,22 @@ namespace Notifications.Views
                     SelectionMode = ItemSelectionMode.Single,
                 };
                 notificationsView.SetBinding(RecyclerView.ItemsSourceProperty, "NotificationsListSource");
+                notificationsView.SetBinding(CollectionView.SelectionChangedCommandProperty, "SelectionChangedCommand");
             }
+            notificationsView.SelectedItem = null;
             Add(notificationsView);
         }
 
-        private void AddBottomView()
+        private void AddClearAllButton()
         {
-            if (bottomView == null)
-            {
-                bottomView = new View()
-                {
-                    WidthSpecification = LayoutParamPolicies.MatchParent,
-                    HeightSpecification = AppConstants.HeaderHeight.SpToPx(),
-                    Layout = new RelativeLayout()
-                    {
-                        Padding = AppConstants.HeaderPadding.SpToPx(),
-                    },
-                };
-            }
             if (clearAllButton == null)
             {
-                clearAllButton = new Button()
-                {
-                    Size2D = AppConstants.TextButtonSize.SpToPx(),
-                    Text = "Clear All",
-                    TextColor = new Color("#FF6200"),
-                    FontFamily = "BreezeSans",
-                    BackgroundColor = Color.Transparent,
-                    TextAlignment = HorizontalAlignment.Center,
-                };
+                clearAllButton = new Button("ClearAllButton");
                 RelativeLayout.SetVerticalAlignment(clearAllButton, RelativeLayout.Alignment.Center);
                 RelativeLayout.SetHorizontalAlignment(clearAllButton, RelativeLayout.Alignment.End);
                 clearAllButton.SetBinding(Control.CommandProperty, "ClearAllNotificationsCommand");
-                bottomView.Add(clearAllButton);
             }
-            Add(bottomView);
+            topView?.Add(clearAllButton);
         }
 
         private void AddNoNotificationsText()
@@ -188,14 +189,12 @@ namespace Notifications.Views
             {
                 noNotificationsText = new TextLabel()
                 {
+                    StyleName = "TitleText",
                     Text = "You don't have notifications",
-                    HorizontalAlignment = HorizontalAlignment.Center,
-                    VerticalAlignment = VerticalAlignment.Center,
-                    FontFamily = "BreezeSans",
-                    PixelSize = AppConstants.TitlePixelSize.SpToPx(),
-                    TextColor = new Color("#090E21"),
                     WidthSpecification = LayoutParamPolicies.MatchParent,
                     HeightSpecification = LayoutParamPolicies.MatchParent,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center,
                 };
             }
             Add(noNotificationsText);
diff --git a/Notifications/Views/ViewManager.cs b/Notifications/Views/ViewManager.cs
deleted file mode 100644 (file)
index 8dd76d7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-using Tizen.NUI;
-using Notifications.ViewModels;
-
-namespace Notifications.Views
-{
-    class ViewManager
-    {
-        public NotificationsViewModel notificationsViewModel;
-        private BaseView baseView;
-        public ViewManager()
-        {
-            notificationsViewModel = new NotificationsViewModel();
-            baseView = new BaseView();
-            baseView.BindingContext = notificationsViewModel;
-            Window.Instance.Add(baseView);
-        }
-
-        public void UpdateViewOnResize()
-        {
-            if (baseView != null)
-            {
-                baseView.Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height);
-            }
-        }
-    }
-}
diff --git a/Notifications/res/images/dark/clear.png b/Notifications/res/images/dark/clear.png
new file mode 100644 (file)
index 0000000..095b683
Binary files /dev/null and b/Notifications/res/images/dark/clear.png differ
diff --git a/Notifications/res/images/minimize.png b/Notifications/res/images/minimize.png
new file mode 100644 (file)
index 0000000..266d548
Binary files /dev/null and b/Notifications/res/images/minimize.png differ
diff --git a/Notifications/res/themes/dark.xaml b/Notifications/res/themes/dark.xaml
new file mode 100644 (file)
index 0000000..cc25f78
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="DarkTheme">
+
+    <ViewStyle x:Key="BaseView" ThemeChangeSensitive="true" BackgroundColor="#16131A" />
+
+    <TextLabelStyle x:Key="TitleText" ThemeChangeSensitive="true" FontFamily="BreezeSans"  TextColor="#FDFDFD" PixelSize="24sp" />
+
+    <c:ButtonStyle x:Key="BackButton" ThemeChangeSensitive="true" Size="48sp, 48sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/back.png" />
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="ClearButton" ThemeChangeSensitive="true" Size="32sp, 32sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="32sp, 32sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/clear.png" />
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="ClearAllButton" ThemeChangeSensitive="true" Size="150sp, 48sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Text>
+            <TextLabelStyle  FontFamily="BreezeSans" TextColor="#FF8A00" Text="Clear All" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+        </c:ButtonStyle.Text>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="DetailContentView" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Text>
+            <TextLabelStyle FontFamily="BreezeSans" TextColor="#FDFDFD" HorizontalAlignment="Begin" MultiLine="true" />
+        </c:ButtonStyle.Text>
+    </c:ButtonStyle>
+
+</Theme>
\ No newline at end of file
diff --git a/Notifications/res/themes/light.xaml b/Notifications/res/themes/light.xaml
new file mode 100644 (file)
index 0000000..be3f645
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="LightTheme">
+
+    <ViewStyle x:Key="BaseView" ThemeChangeSensitive="true" BackgroundColor="#FAFAFA" />
+
+    <TextLabelStyle x:Key="TitleText" ThemeChangeSensitive="true" FontFamily="BreezeSans"  TextColor="#090E21" PixelSize="24sp" />
+
+    <c:ButtonStyle x:Key="BackButton" ThemeChangeSensitive="true" Size="48sp, 48sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/back.png" />
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="ClearButton" ThemeChangeSensitive="true" Size="32sp, 32sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="32sp, 32sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/clear.png" />
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="ClearAllButton" ThemeChangeSensitive="true" Size="150sp, 48sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Text>
+            <TextLabelStyle  FontFamily="BreezeSans" TextColor="#FF6200" Text="Clear All" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+        </c:ButtonStyle.Text>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="DetailContentView" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+        <c:ButtonStyle.Text>
+            <TextLabelStyle  FontFamily="BreezeSans" TextColor="#090E21" HorizontalAlignment="Begin" MultiLine="true" />
+        </c:ButtonStyle.Text>
+    </c:ButtonStyle>
+
+</Theme>
\ No newline at end of file
index 9df3358ca7462d576d98976b36f6c500020eb63b..1a21a4854bc1237cd249c9a1039389cb74c951e9 100644 (file)
@@ -1,12 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="7.0" package="org.tizen.Notifications" version="1.0.0">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="7.0" package="org.tizen.notifications" version="1.0.0">
   <profile name="common" />
-  <ui-application appid="org.tizen.Notifications" exec="Notifications.dll" type="dotnet" multiple="false" taskmanage="true" nodisplay="false" launch_mode="single" api-version="11">
+  <ui-application appid="org.tizen.notifications" exec="Notifications.dll" type="dotnet" multiple="false" taskmanage="true" nodisplay="true" launch_mode="single" api-version="11">
     <label>Notifications</label>
     <icon>Notifications.png</icon>
     <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
   </ui-application>
   <privileges>
     <privilege>http://tizen.org/privilege/notification</privilege>
+    <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
+    <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
   </privileges>
 </manifest>
index c58b8f2a9b01f5f78e98a150b2cbc834aceff510..bca8b0f42a343df86cf234384705249130085a9b 100644 (file)
Binary files a/packaging/org.tizen.Notifications-1.0.0.tpk and b/packaging/org.tizen.Notifications-1.0.0.tpk differ