{
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)
return;
this.borderView = borderView;
+ ThemeManager.ThemeChanged += OnThemeChanged;
borderView.BackgroundColor = ThemeManager.PlatformThemeId == AppConstants.LightPlatformThemeId ? AppConstants.LightBorderColor : AppConstants.DarkBorderColor;
}
{
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();
{
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;
}
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");
}
}
}
public BaseView() : base()
{
StyleName = "BaseView";
- WidthResizePolicy = ResizePolicyType.FillToParent;
- HeightResizePolicy = ResizePolicyType.FillToParent;
+ Size2D = Window.Instance.Size;
CornerRadius = AppConstants.BaseViewCornerRadius;
Layout = new LinearLayout()
{
Add(detailContentView);
}
+ public void UpdateSize()
+ {
+ Size2D = Window.Instance.Size;
+ UpdateNotificationsViewItemTemplate();
+ }
+
public bool BackKeyEventEmitted()
{
if (detailContentView != null && detailContentView.GetParent() == this)
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");
}
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)