diff options
author | Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com> | 2023-11-06 12:10:44 +0530 |
---|---|---|
committer | Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com> | 2023-11-06 15:01:54 +0530 |
commit | d2cf2e093d62b393aa7f13407b4bb1726cda4569 (patch) | |
tree | 36d13dd28ae6eeaa3e7c96887f91f25f1628aaa6 | |
parent | 1b00549f203eb1afb24fce1a470e1cc3375dd186 (diff) | |
download | tray-d2cf2e093d62b393aa7f13407b4bb1726cda4569.tar.gz tray-d2cf2e093d62b393aa7f13407b4bb1726cda4569.tar.bz2 tray-d2cf2e093d62b393aa7f13407b4bb1726cda4569.zip |
Updating CustomBorder as per UX.accepted/tizen/unified/20231109.181243
Change-Id: If7c4a3fac6b484b9faf99504a4ae4b99f059685d
Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
-rwxr-xr-x | Apps/Apps.cs | 8 | ||||
-rwxr-xr-x | Apps/Views/CustomBorder.cs | 125 | ||||
-rwxr-xr-x | packaging/org.tizen.Apps-1.0.0.tpk | bin | 83707 -> 84119 bytes |
3 files changed, 85 insertions, 48 deletions
diff --git a/Apps/Apps.cs b/Apps/Apps.cs index 0d18b3b..c4b2a58 100755 --- a/Apps/Apps.cs +++ b/Apps/Apps.cs @@ -118,10 +118,6 @@ namespace Apps { int positionX, positionY; int width, height; - Tizen.Log.Info(Resources.LogTag, "width is: " + window.WindowSize.Width); - Tizen.Log.Info(Resources.LogTag, "height is: " + window.WindowSize.Height); - Tizen.Log.Info(Resources.LogTag, "position X is: " + window.WindowPosition.X); - Tizen.Log.Info(Resources.LogTag, "position Y is: " + window.WindowPosition.Y); width = (DeviceInfo.IsPortrait ? DeviceInfo.DisplayHeight : DeviceInfo.DisplayWidth) / 2; height = ((DeviceInfo.IsPortrait ? DeviceInfo.DisplayWidth : DeviceInfo.DisplayHeight) / 2) - TaskbarHeight.SpToPx(); positionX = (DeviceInfo.DisplayWidth - width) / 2; @@ -131,6 +127,10 @@ namespace Apps positionY = 0; } window.WindowPositionSize = new Rectangle(positionX, positionY, width, height); + Tizen.Log.Info(Resources.LogTag, "width is: " + window.WindowSize.Width); + Tizen.Log.Info(Resources.LogTag, "height is: " + window.WindowSize.Height); + Tizen.Log.Info(Resources.LogTag, "position X is: " + window.WindowPosition.X); + Tizen.Log.Info(Resources.LogTag, "position Y is: " + window.WindowPosition.Y); } public void OnKeyEvent(object sender, Window.KeyEventArgs e) diff --git a/Apps/Views/CustomBorder.cs b/Apps/Views/CustomBorder.cs index 5f117c3..7b4a48b 100755 --- a/Apps/Views/CustomBorder.cs +++ b/Apps/Views/CustomBorder.cs @@ -22,22 +22,36 @@ namespace Apps.Views { class CustomBorder : DefaultBorder { + private ImageView minimalizeIcon; private ImageView maximalizeIcon; private ImageView closeIcon; private ImageView leftCornerIcon; - private ImageView rightCornerIcon; 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() { + MinSize = new Size2D(320, 280); } public override void CreateBorderView(View borderView) { this.borderView = borderView; - borderView.CornerRadius = new Vector4(0.03f, 0.03f, 0.03f, 0.03f); - borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative; - borderView.BackgroundColor = new Color(1, 1, 1, 0.3f); + borderView.BackgroundColor = ThemeManager.PlatformThemeId == Resources.LightPlatformThemeId ? new Color("rgba(250, 250, 250, 0.35)") : new Color("rgba(22, 19, 25, 0.5)"); + ThemeManager.ThemeChanged += OnThemeChanged; + } + + private void OnThemeChanged(object sender, ThemeChangedEventArgs e) + { + if (borderView == null) + { + return; + } + borderView.BackgroundColor = ThemeManager.PlatformThemeId == Resources.LightPlatformThemeId ? new Color("rgba(250, 250, 250, 0.35)") : new Color("rgba(22, 19, 25, 0.5)"); } public override bool CreateBottomBorderView(View bottomView) @@ -46,55 +60,66 @@ namespace Apps.Views { return false; } - bottomView.Layout = new RelativeLayout(); + BorderLineThickness = (uint)BorderThickness.SpToPx(); + bottomView.HeightSpecification = BottomViewHeight.SpToPx(); + bottomView.Layout = new RelativeLayout() + { + Padding = new Extents(0, 24, 0, 0).SpToPx(), + }; + + minimalizeIcon = new ImageView() + { + Size2D = IconSize.SpToPx(), + ResourceUrl = Resources.GetImagePath() + "/minimalize.png", + AccessibilityHighlightable = true, + }; + maximalizeIcon = new ImageView() { - Focusable = true, + Size2D = IconSize.SpToPx(), ResourceUrl = Resources.GetImagePath() + "/maximalize.png", AccessibilityHighlightable = true, }; closeIcon = new ImageView() { - Focusable = true, + Size2D = IconSize.SpToPx(), ResourceUrl = Resources.GetImagePath() + "/close.png", AccessibilityHighlightable = true, }; leftCornerIcon = new ImageView() { - Focusable = true, + Size2D = IconSize.SpToPx(), ResourceUrl = Resources.GetImagePath() + "/leftCorner.png", AccessibilityHighlightable = true, }; - rightCornerIcon = new ImageView() - { - Focusable = true, - ResourceUrl = Resources.GetImagePath() + "/rightCorner.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.SetRightTarget(closeIcon, rightCornerIcon); - RelativeLayout.SetRightRelativeOffset(closeIcon, 0.0f); + RelativeLayout.SetRightRelativeOffset(closeIcon, 1.0f); RelativeLayout.SetHorizontalAlignment(closeIcon, RelativeLayout.Alignment.End); - RelativeLayout.SetRightRelativeOffset(rightCornerIcon, 1.0f); - RelativeLayout.SetHorizontalAlignment(rightCornerIcon, RelativeLayout.Alignment.End); - bottomView.Add(leftCornerIcon); + bottomView.Add(minimalizeIcon); bottomView.Add(maximalizeIcon); bottomView.Add(closeIcon); - bottomView.Add(rightCornerIcon); + minimalizeIcon.TouchEvent += OnMinimizeIconTouched; maximalizeIcon.TouchEvent += OnMaximizeIconTouched; closeIcon.TouchEvent += OnCloseIconTouched; leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched; - rightCornerIcon.TouchEvent += OnRightBottomCornerIconTouched; + + minimalizeIcon.AccessibilityActivated += (s, e) => + { + MinimizeBorderWindow(); + }; maximalizeIcon.AccessibilityActivated += (s, e) => { @@ -106,6 +131,11 @@ namespace Apps.Views CloseBorderWindow(); }; + minimalizeIcon.AccessibilityNameRequested += (s, e) => + { + e.Name = "Minimize"; + }; + maximalizeIcon.AccessibilityNameRequested += (s, e) => { e.Name = "Maximize"; @@ -120,16 +150,10 @@ namespace Apps.Views { e.Name = "Resize"; }; - - rightCornerIcon.AccessibilityNameRequested += (s, e) => - { - e.Name = "Resize"; - }; - + 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; } @@ -142,25 +166,38 @@ namespace Apps.Views } } + 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.IsMaximized() == true) - { - if (maximalizeIcon != null) - { - maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/smallwindow.png"; - } - } - else - { - if (maximalizeIcon != null) - { - maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/maximalize.png"; - } - } + if (BorderWindow == null || borderView == null) + { + return; + } + borderView.CornerRadiusPolicy = VisualTransformPolicyType.Absolute; + borderView.CornerRadius = BorderCornerRadius.SpToPx(); + + if (maximalizeIcon == null) + { + return; } + maximalizeIcon.ResourceUrl = Resources.GetImagePath() + (BorderWindow.IsMaximized() == true ? "/smallwindow.png" : "/maximalize.png"); } } } diff --git a/packaging/org.tizen.Apps-1.0.0.tpk b/packaging/org.tizen.Apps-1.0.0.tpk Binary files differindex 9d6258f..2ff7091 100755 --- a/packaging/org.tizen.Apps-1.0.0.tpk +++ b/packaging/org.tizen.Apps-1.0.0.tpk |