From: amitpatel Date: Mon, 23 Oct 2023 08:13:41 +0000 (+0530) Subject: Removed right icon for resize in custom window X-Git-Tag: accepted/tizen/unified/20231116.175521^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fedf3148e0a1051ef6e060faa059bb4ac8249a8;p=profile%2Fiot%2Fapps%2Fdotnet%2Fnotifications.git Removed right icon for resize in custom window Change-Id: I781f17f8991153a01e8299f212d54bcc9564585a --- diff --git a/Notifications/CustomBorder.cs b/Notifications/CustomBorder.cs index afc613a..ca5ad5f 100644 --- a/Notifications/CustomBorder.cs +++ b/Notifications/CustomBorder.cs @@ -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(); } } } diff --git a/packaging/org.tizen.notifications-1.0.0.tpk b/packaging/org.tizen.notifications-1.0.0.tpk index fdece1f..8e47f9c 100644 Binary files a/packaging/org.tizen.notifications-1.0.0.tpk and b/packaging/org.tizen.notifications-1.0.0.tpk differ