Removed right icon for resize in custom window 81/300381/4 accepted/tizen/unified/20231116.175521
authoramitpatel <amit.patel@samsung.com>
Mon, 23 Oct 2023 08:13:41 +0000 (13:43 +0530)
committeramitpatel <amit.patel@samsung.com>
Wed, 25 Oct 2023 06:33:37 +0000 (12:03 +0530)
Change-Id: I781f17f8991153a01e8299f212d54bcc9564585a

Notifications/CustomBorder.cs
packaging/org.tizen.notifications-1.0.0.tpk

index afc613aa97e517d3b4133915ef47a47ee1cdd672..ca5ad5fcca9835b0e8a24a572eeb09333567d1d3 100644 (file)
@@ -22,15 +22,21 @@ namespace Notifications
 {
     class CustomBorder : DefaultBorder
     {
-        private ImageView minimizeIcon;
+
+        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 ImageView rightCornerIcon;
+
         private View borderView;
 
         public CustomBorder() : base()
         {
+            ResizePolicy = Window.BorderResizePolicyType.Free;
             ThemeManager.ThemeChanged += OnThemeChanged;
         }
 
@@ -47,84 +53,56 @@ namespace Notifications
 
         public override void CreateBorderView(View borderView)
         {
+            if (borderView == null)
+                return;
+
             this.borderView = borderView;
-            borderView.CornerRadius = AppConstants.BorderCornerRadius;
-            borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
             borderView.BackgroundColor = ThemeManager.PlatformThemeId == AppConstants.LightPlatformThemeId ? AppConstants.LightBorderColor : AppConstants.DarkBorderColor;
         }
 
+        public override void OnCreated(View borderView)
+        {
+            base.OnCreated(borderView);
+        }
+    
         public override bool CreateBottomBorderView(View bottomView)
         {
             if (bottomView == null)
             {
                 return false;
             }
-            bottomView.Layout = new RelativeLayout();
 
-            minimizeIcon = new ImageView()
+            minimalizeIcon = new ImageView()
             {
-                Focusable = true,
                 ResourceUrl = Resources.GetImagePath() + "/minimize.png",
                 AccessibilityHighlightable = true,
             };
 
             maximalizeIcon = new ImageView()
             {
-                Focusable = true,
                 ResourceUrl = Resources.GetImagePath() + "/maximalize.png",
                 AccessibilityHighlightable = true,
             };
 
             closeIcon = new ImageView()
             {
-                Focusable = true,
                 ResourceUrl = Resources.GetImagePath() + "/close.png",
                 AccessibilityHighlightable = true,
             };
 
             leftCornerIcon = new ImageView()
             {
-                Focusable = true,
                 ResourceUrl = Resources.GetImagePath() + "/leftCorner.png",
                 AccessibilityHighlightable = true,
             };
 
-            rightCornerIcon = new ImageView()
-            {
-                Focusable = true,
-                ResourceUrl = Resources.GetImagePath() + "/rightCorner.png",
-                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);
-
-            RelativeLayout.SetRightTarget(closeIcon, rightCornerIcon);
-            RelativeLayout.SetRightRelativeOffset(closeIcon, 0.0f);
-            RelativeLayout.SetHorizontalAlignment(closeIcon, RelativeLayout.Alignment.End);
-
-            RelativeLayout.SetRightRelativeOffset(rightCornerIcon, 1.0f);
-            RelativeLayout.SetHorizontalAlignment(rightCornerIcon, RelativeLayout.Alignment.End);
-
-            bottomView.Add(leftCornerIcon);
-            bottomView.Add(minimizeIcon);
-            bottomView.Add(maximalizeIcon);
-            bottomView.Add(closeIcon);
-            bottomView.Add(rightCornerIcon);
-
-            minimizeIcon.TouchEvent += OnMinimizeIconTouched;
+            minimalizeIcon.TouchEvent += OnMinimizeIconTouched;
             maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
             closeIcon.TouchEvent += OnCloseIconTouched;
             leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
-            rightCornerIcon.TouchEvent += OnRightBottomCornerIconTouched;
 
 
-            minimizeIcon.AccessibilityActivated += (s, e) =>
+            minimalizeIcon.AccessibilityActivated += (s, e) =>
             {
                 MinimizeBorderWindow();
             };
@@ -139,7 +117,7 @@ namespace Notifications
                 CloseBorderWindow();
             };
 
-            minimizeIcon.AccessibilityNameRequested += (s, e) =>
+            minimalizeIcon.AccessibilityNameRequested += (s, e) =>
             {
                 e.Name = "Minimize";
             };
@@ -159,26 +137,54 @@ namespace Notifications
                 e.Name = "Resize";
             };
 
-            rightCornerIcon.AccessibilityNameRequested += (s, e) =>
+            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
             {
-                e.Name = "Resize";
+                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);
 
-            minimizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
+            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);
-            rightCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
+
             return true;
         }
 
         public override void OnResized(int width, int height)
         {
-            if (borderView != null)
+            if (borderView == null)
             {
-                base.OnResized(width, height);
-                UpdateIcons();
+                return;
             }
+
+            base.OnResized(width, height);
+            borderView.BackgroundColor = ThemeManager.PlatformThemeId == AppConstants.LightPlatformThemeId ? AppConstants.LightBorderColor : AppConstants.DarkBorderColor;
+            UpdateIcons();
         }
 
         private void UpdateIcons()
@@ -188,11 +194,14 @@ namespace Notifications
                 return;
             }
 
+            borderView.CornerRadiusPolicy = VisualTransformPolicyType.Absolute;
+
             if (BorderWindow.IsMaximized() == true)
             {
                 if (maximalizeIcon != null)
                 {
                     maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/smallwindow.png";
+                    borderView.CornerRadius = 0;
                 }
             }
             else
@@ -200,6 +209,7 @@ namespace Notifications
                 if (maximalizeIcon != null)
                 {
                     maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/maximalize.png";
+                    borderView.CornerRadius = WindowCornerRadius.SpToPx();
                 }
             }
         }
index fdece1f0fce2f62e76de5a06063f603e372d84e1..8e47f9cd590a6b3f5a0c86406dcd1ca39b579c92 100644 (file)
Binary files a/packaging/org.tizen.notifications-1.0.0.tpk and b/packaging/org.tizen.notifications-1.0.0.tpk differ