[TNINE-364] Updating Bin Icon Position on resize. 31/305431/1 accepted/tizen/unified/20240202.170017 accepted/tizen/unified/toolchain/20240311.070112 accepted/tizen/unified/x/20240205.064016
authorShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Thu, 1 Feb 2024 12:46:56 +0000 (18:16 +0530)
committerShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Thu, 1 Feb 2024 12:54:12 +0000 (18:24 +0530)
[TNINE-368] Adding Fullstop in Text.
[TNINE-390] Min Size set to prevent overlapping.

Change-Id: I5f3c6f9eb6f221c519d6ebbcffeb0f3b2b750df0
Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Notifications/CustomBorder.cs
Notifications/Models/NotificationsModel.cs
Notifications/TextResources/Resources.en-US.resx
Notifications/TextResources/Resources.ko-KR.resx
Notifications/ViewManager.cs
Notifications/Views/BaseView.cs
Notifications/res/images/minimalize.png [new file with mode: 0644]
Notifications/res/images/minimize.png [deleted file]
packaging/org.tizen.notifications-1.0.0.tpk

index ca5ad5fcca9835b0e8a24a572eeb09333567d1d3..c961b31174ef509a3574d62bb567ff7e6d9e1a4e 100644 (file)
@@ -22,22 +22,20 @@ namespace Notifications
 {
     class CustomBorder : DefaultBorder
     {
-
-        public static readonly float WindowPadding = 6.0f;
-  
-        public static readonly float WindowCornerRadius = 26.0f;
-
         private ImageView minimalizeIcon;
         private ImageView maximalizeIcon;
         private ImageView closeIcon;
         private ImageView leftCornerIcon;
-
         private View borderView;
 
+        private static Size2D IconSize = new Size2D(48, 48);
+        private const int BorderThickness = 4;
+        private const int BottomViewHeight = 48;
+        private const int BorderCornerRadius = 24;
+
         public CustomBorder() : base()
         {
-            ResizePolicy = Window.BorderResizePolicyType.Free;
-            ThemeManager.ThemeChanged += OnThemeChanged;
+            MinSize = new Size2D(380, 280);
         }
 
         private void OnThemeChanged(object sender, ThemeChangedEventArgs e)
@@ -57,6 +55,7 @@ namespace Notifications
                 return;
 
             this.borderView = borderView;
+            ThemeManager.ThemeChanged += OnThemeChanged;
             borderView.BackgroundColor = ThemeManager.PlatformThemeId == AppConstants.LightPlatformThemeId ? AppConstants.LightBorderColor : AppConstants.DarkBorderColor;
         }
 
@@ -71,37 +70,62 @@ namespace Notifications
             {
                 return false;
             }
+            BorderLineThickness = (uint)BorderThickness.SpToPx();
+            bottomView.HeightSpecification = BottomViewHeight.SpToPx();
+            bottomView.Layout = new RelativeLayout()
+            {
+                Padding = new Extents(0, 24, 0, 0).SpToPx(),
+            };
 
             minimalizeIcon = new ImageView()
             {
-                ResourceUrl = Resources.GetImagePath() + "/minimize.png",
+                Size2D = IconSize.SpToPx(),
+                ResourceUrl = Resources.GetImagePath() + "/minimalize.png",
                 AccessibilityHighlightable = true,
             };
 
             maximalizeIcon = new ImageView()
             {
+                Size2D = IconSize.SpToPx(),
                 ResourceUrl = Resources.GetImagePath() + "/maximalize.png",
                 AccessibilityHighlightable = true,
             };
 
             closeIcon = new ImageView()
             {
+                Size2D = IconSize.SpToPx(),
                 ResourceUrl = Resources.GetImagePath() + "/close.png",
                 AccessibilityHighlightable = true,
             };
 
             leftCornerIcon = new ImageView()
             {
+                Size2D = IconSize.SpToPx(),
                 ResourceUrl = Resources.GetImagePath() + "/leftCorner.png",
                 AccessibilityHighlightable = true,
             };
 
+            RelativeLayout.SetRightTarget(minimalizeIcon, maximalizeIcon);
+            RelativeLayout.SetRightRelativeOffset(minimalizeIcon, 0.0f);
+            RelativeLayout.SetHorizontalAlignment(minimalizeIcon, RelativeLayout.Alignment.End);
+
+            RelativeLayout.SetRightTarget(maximalizeIcon, closeIcon);
+            RelativeLayout.SetRightRelativeOffset(maximalizeIcon, 0.0f);
+            RelativeLayout.SetHorizontalAlignment(maximalizeIcon, RelativeLayout.Alignment.End);
+
+            RelativeLayout.SetRightRelativeOffset(closeIcon, 1.0f);
+            RelativeLayout.SetHorizontalAlignment(closeIcon, RelativeLayout.Alignment.End);
+
+            bottomView.Add(leftCornerIcon);
+            bottomView.Add(minimalizeIcon);
+            bottomView.Add(maximalizeIcon);
+            bottomView.Add(closeIcon);
+
             minimalizeIcon.TouchEvent += OnMinimizeIconTouched;
             maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
             closeIcon.TouchEvent += OnCloseIconTouched;
             leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
 
-
             minimalizeIcon.AccessibilityActivated += (s, e) =>
             {
                 MinimizeBorderWindow();
@@ -136,42 +160,10 @@ namespace Notifications
             {
                 e.Name = "Resize";
             };
-
-            BorderLineThickness = (uint)WindowPadding.SpToPx();
-
-            var size = new Size(48, 48).SpToPx();
-            leftCornerIcon.Size = size;
-            minimalizeIcon.Size = size;
-            maximalizeIcon.Size = size;
-            closeIcon.Size = size;
-
-            bottomView.SizeHeight = 48.SpToPx();
-
-            var controls = new View
-            {
-                Layout = new LinearLayout
-                {
-                    LinearOrientation = LinearLayout.Orientation.Horizontal,
-                },
-                Margin = new Extents(0, (ushort)(WindowCornerRadius - WindowPadding), 0, 0).SpToPx(),
-            };
-            controls.Add(minimalizeIcon);
-            controls.Add(maximalizeIcon);
-            controls.Add(closeIcon);
-
-            bottomView.Layout = new FlexLayout
-            {
-                Direction = FlexLayout.FlexDirection.Row,
-                Justification = FlexLayout.FlexJustification.SpaceBetween,
-            };
-            bottomView.Add(leftCornerIcon);
-            bottomView.Add(controls);
-
             minimalizeIcon.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);
-
             return true;
         }
 
@@ -187,31 +179,38 @@ namespace Notifications
             UpdateIcons();
         }
 
+        public override void OnRequestMove()
+        {
+            base.OnRequestMove();
+            minimalizeIcon.TouchEvent -= OnMinimizeIconTouched;
+            maximalizeIcon.TouchEvent -= OnMaximizeIconTouched;
+            closeIcon.TouchEvent -= OnCloseIconTouched;
+            leftCornerIcon.TouchEvent -= OnLeftBottomCornerIconTouched;
+        }
+
+        public override void OnMoveCompleted(int x, int y)
+        {
+            base.OnMoveCompleted(x, y);
+            minimalizeIcon.TouchEvent += OnMinimizeIconTouched;
+            maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
+            closeIcon.TouchEvent += OnCloseIconTouched;
+            leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
+        }
+
         private void UpdateIcons()
         {
-            if(BorderWindow == null || borderView == null)
+            if (BorderWindow == null || borderView == null)
             {
                 return;
             }
-
             borderView.CornerRadiusPolicy = VisualTransformPolicyType.Absolute;
+            borderView.CornerRadius = BorderCornerRadius.SpToPx();
 
-            if (BorderWindow.IsMaximized() == true)
+            if (maximalizeIcon == null)
             {
-                if (maximalizeIcon != null)
-                {
-                    maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/smallwindow.png";
-                    borderView.CornerRadius = 0;
-                }
-            }
-            else
-            {
-                if (maximalizeIcon != null)
-                {
-                    maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/maximalize.png";
-                    borderView.CornerRadius = WindowCornerRadius.SpToPx();
-                }
+                return;
             }
+            maximalizeIcon.ResourceUrl = Resources.GetImagePath() + (BorderWindow.IsMaximized() == true ? "/smallwindow.png" : "/maximalize.png");
         }
     }
 }
index 6e480f58301ec51c9bd874fea1f09cd38c42dc19..4dc620df2f62f62957863905f514e431cce36718 100644 (file)
@@ -30,8 +30,8 @@ namespace Notifications.Models
         {
             AppId = appId;
             UniqueNumber = uniqueNumber;
-            this.title = title ?? string.Empty;
-            subTitle = content ?? string.Empty;
+            this.title = title ?? " ";
+            subTitle = content ?? " ";
             ClearNotificationCommand = new Command(OnNotificationCleared);
         }
 
index 2e09afee84ed2cce849800b7539dd1356370badd..13db5792dc78a9b443b53d2998d9b0e4c871751c 100644 (file)
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <data name="IDS_ST_BODY_NO_NOTIFICATIONS_MSG" xml:space="preserve">
-    <value>You don't have notifications</value>
+    <value>You don't have notifications.</value>
   </data>
   <data name="IDS_ST_BUTTON_CLEAR_ALL" xml:space="preserve">
     <value>Clear All</value>
index f74ef5c03663849850f17c2699f123cccb9fe358..74e11e2ec8a56fc1e639f7f894c1824e9aae46b1 100644 (file)
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <data name="IDS_ST_BODY_NO_NOTIFICATIONS_MSG" xml:space="preserve">
-    <value>알림이 없습니다</value>
+    <value>알림이 없습니다.</value>
   </data>
   <data name="IDS_ST_BUTTON_CLEAR_ALL" xml:space="preserve">
     <value>클리어 올</value>
index 2dfa510d2020f2415795868dd0f09c2d71066ed0..f346678be76d539bff40ffaf825780d5118c205c 100644 (file)
@@ -39,10 +39,16 @@ namespace Notifications
             baseView.BindingContext = notificationsViewModel;
             baseView.BackKeyPressed += OnBackKeyPressed;
             Window.Instance.Add(baseView);
+            Window.Instance.Resized += OnWindowResized;
 
             ThemeManager.ThemeChanged += OnThemeChanged;
         }
 
+        private void OnWindowResized(object sender, Window.ResizedEventArgs e)
+        {
+            baseView?.UpdateSize();
+        }
+
         public void Dispose()
         {
             if (notificationsViewModel != null)
index 8c82e07b036a3083d8a4c810d48c18de556fb8a3..3dcc331eb4b9f40db55ef6ab8f59f19aa6e4fb78 100644 (file)
@@ -49,8 +49,7 @@ namespace Notifications.Views
         public BaseView() : base()
         {
             StyleName = "BaseView";
-            WidthResizePolicy = ResizePolicyType.FillToParent;
-            HeightResizePolicy = ResizePolicyType.FillToParent;
+            Size2D = Window.Instance.Size;
             CornerRadius = AppConstants.BaseViewCornerRadius;
             Layout = new LinearLayout()
             {
@@ -98,6 +97,12 @@ namespace Notifications.Views
             Add(detailContentView);
         }
 
+        public void UpdateSize()
+        {
+            Size2D = Window.Instance.Size;
+            UpdateNotificationsViewItemTemplate();
+        }
+
         public bool BackKeyEventEmitted()
         {
             if (detailContentView != null && detailContentView.GetParent() == this)
@@ -158,28 +163,11 @@ namespace Notifications.Views
                 notificationsView = new CollectionView()
                 {
                     ItemsLayouter = new LinearLayouter(),
-                    ItemTemplate = new DataTemplate(() =>
-                    {
-                        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.VerticalAlignment = VerticalAlignment.Bottom;
-                        item.SubLabel.StyleName = "TitleText";
-                        item.SubLabel.SetBinding(TextLabel.TextProperty, "SubTitle");
-                        item.SubLabel.HorizontalAlignment = HorizontalAlignment.Begin;
-                        item.SubLabel.VerticalAlignment = VerticalAlignment.Top;
-                        item.Extra = new Button("ClearButton");
-                        item.Extra.SetBinding(Control.CommandProperty, "ClearNotificationCommand");
-                        return item;
-                    }),
                     ScrollingDirection = ScrollableBase.Direction.Vertical,
-                    WidthSpecification = LayoutParamPolicies.MatchParent,
                     HeightSpecification = LayoutParamPolicies.MatchParent,
                     SelectionMode = ItemSelectionMode.Single,
                 };
+                UpdateNotificationsViewItemTemplate();
                 notificationsView.SetBinding(RecyclerView.ItemsSourceProperty, "NotificationsListSource");
                 notificationsView.SetBinding(CollectionView.SelectionChangedCommandProperty, "SelectionChangedCommand");
             }
@@ -187,6 +175,32 @@ namespace Notifications.Views
             Add(notificationsView);
         }
 
+        private void UpdateNotificationsViewItemTemplate()
+        {
+            if (notificationsView == null)
+            {
+                return;
+            }
+            notificationsView.SizeWidth = Window.Instance.Size.Width;
+            notificationsView.ItemTemplate = new DataTemplate(() =>
+            {
+                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.VerticalAlignment = VerticalAlignment.Bottom;
+                item.SubLabel.StyleName = "TitleText";
+                item.SubLabel.SetBinding(TextLabel.TextProperty, "SubTitle");
+                item.SubLabel.HorizontalAlignment = HorizontalAlignment.Begin;
+                item.SubLabel.VerticalAlignment = VerticalAlignment.Top;
+                item.Extra = new Button("ClearButton");
+                item.Extra.SetBinding(Control.CommandProperty, "ClearNotificationCommand");
+                return item;
+            });
+        }
+
         private void AddClearAllButton()
         {
             if (clearAllButton == null)
diff --git a/Notifications/res/images/minimalize.png b/Notifications/res/images/minimalize.png
new file mode 100644 (file)
index 0000000..266d548
Binary files /dev/null and b/Notifications/res/images/minimalize.png differ
diff --git a/Notifications/res/images/minimize.png b/Notifications/res/images/minimize.png
deleted file mode 100644 (file)
index 266d548..0000000
Binary files a/Notifications/res/images/minimize.png and /dev/null differ
index 4fa35bb2c0f4f2586e9181fdc3dfe3a8ca98ee33..424671b2dca437fbd4b64f480c9130fc26f2e615 100644 (file)
Binary files a/packaging/org.tizen.notifications-1.0.0.tpk and b/packaging/org.tizen.notifications-1.0.0.tpk differ