{
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;
}
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();
};
CloseBorderWindow();
};
- minimizeIcon.AccessibilityNameRequested += (s, e) =>
+ minimalizeIcon.AccessibilityNameRequested += (s, e) =>
{
e.Name = "Minimize";
};
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()
return;
}
+ borderView.CornerRadiusPolicy = VisualTransformPolicyType.Absolute;
+
if (BorderWindow.IsMaximized() == true)
{
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();
}
}
}