From 9f7b87741dce0d260273a3c7db41ce55902f6d05 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Thu, 15 Apr 2021 01:13:05 +0900 Subject: [PATCH] Make Dialog APIs public This is ACR patch to make Dialog APIs public. This pull request includes properties and methods of DialogPage, Dialog, AlertDialog and AlertDialogStyle classes. --- src/Tizen.NUI.Components/Controls/AlertDialog.cs | 60 ++++++++++++++++------ src/Tizen.NUI.Components/Controls/Dialog.cs | 16 +++--- .../Controls/Navigation/DialogPage.cs | 43 +++++++++++----- src/Tizen.NUI.Components/Style/AlertDialogStyle.cs | 26 +++++----- 4 files changed, 93 insertions(+), 52 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/AlertDialog.cs b/src/Tizen.NUI.Components/Controls/AlertDialog.cs index b1b3ee5..0bf56a8 100755 --- a/src/Tizen.NUI.Components/Controls/AlertDialog.cs +++ b/src/Tizen.NUI.Components/Controls/AlertDialog.cs @@ -25,7 +25,7 @@ namespace Tizen.NUI.Components /// /// AlertDialog class shows a dialog with title, message and action buttons. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public class AlertDialog : Control { private string title = null; @@ -50,16 +50,33 @@ namespace Tizen.NUI.Components /// /// Creates a new instance of AlertDialog. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public AlertDialog() : base() { Initialize(); } /// - /// Dispose AlertDialog and all children on it. + /// Creates a new instance of AlertDialog. + /// + /// Creates AlertDialog by special style defined in UX. + /// 9 + public AlertDialog(string style) : base(style) + { + Initialize(); + } + + /// + /// Creates a new instance of AlertDialog. /// - /// Dispose type. + /// Creates AlertDialog by style customized by user. + /// 9 + public AlertDialog(AlertDialogStyle alertDialogStyle) : base(alertDialogStyle) + { + Initialize(); + } + + /// [EditorBrowsable(EditorBrowsableState.Never)] protected override void Dispose(DisposeTypes type) { @@ -100,7 +117,7 @@ namespace Tizen.NUI.Components /// Applies style to AlertDialog. /// /// The style to apply. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public override void ApplyStyle(ViewStyle viewStyle) { styleApplied = false; @@ -133,8 +150,10 @@ namespace Tizen.NUI.Components /// /// Title text of AlertDialog. + /// Title text is set to TitleContent's Text if TitleContent is TextLabel. + /// If TitleContent's Text is set manually by user, then it is not guaranteed that TitleContent's Text is the same with Title text. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public string Title { get @@ -158,9 +177,12 @@ namespace Tizen.NUI.Components } /// - /// Title content of AlertDialog. TitleContent is added to Children automatically. + /// Title content of AlertDialog. + /// TitleContent is added as a child of AlertDialog automatically. + /// Title text is set to TitleContent's Text if TitleContent is TextLabel. + /// If TitleContent's Text is set manually by user, then it is not guaranteed that TitleContent's Text is the same with Title text. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public View TitleContent { get @@ -196,8 +218,10 @@ namespace Tizen.NUI.Components /// /// Message text of AlertDialog. + /// Message text is set to Content's Text if Content is TextLabel. + /// If Content's Text is set manually by user, then it is not guaranteed that Content's Text is the same with Message text. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public string Message { get @@ -221,9 +245,12 @@ namespace Tizen.NUI.Components } /// - /// Content of AlertDialog. Content is added to Children automatically. + /// Content of AlertDialog. + /// Content is added as a child of AlertDialog automatically. + /// Message text is set to Content's Text if Content is TextLabel. + /// If Content's Text is set manually by user, then it is not guaranteed that Content's Text is the same with Message text. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public View Content { get @@ -259,9 +286,10 @@ namespace Tizen.NUI.Components /// /// Action views of AlertDialog. - /// Action views are added to ActionContent of AlertDialog. + /// Action views are added as children of ActionContent. + /// When Actions are set, previous Actions are removed from ActionContent. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public IEnumerable Actions { get @@ -302,9 +330,11 @@ namespace Tizen.NUI.Components } /// - /// Action content of AlertDialog. ActionContent is added to Children automatically. + /// Action content of AlertDialog. + /// ActionContent is added as a child of AlertDialog automatically. + /// Actions are added as children of ActionContent. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public View ActionContent { get diff --git a/src/Tizen.NUI.Components/Controls/Dialog.cs b/src/Tizen.NUI.Components/Controls/Dialog.cs index 5abe7eb..4ca15dd 100644 --- a/src/Tizen.NUI.Components/Controls/Dialog.cs +++ b/src/Tizen.NUI.Components/Controls/Dialog.cs @@ -22,9 +22,9 @@ using Tizen.NUI.BaseComponents; namespace Tizen.NUI.Components { /// - /// Dialog class shows a popup content with background scrim. + /// Dialog class shows a dialog with content. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public class Dialog : Control { private View content = null; @@ -32,7 +32,7 @@ namespace Tizen.NUI.Components /// /// Creates a new instance of Dialog. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public Dialog() : base() { Layout = new AbsoluteLayout(); @@ -40,10 +40,7 @@ namespace Tizen.NUI.Components this.Relayout += OnRelayout; } - /// - /// Dispose Dialog and all children on it. - /// - /// Dispose type. + /// [EditorBrowsable(EditorBrowsableState.Never)] protected override void Dispose(DisposeTypes type) { @@ -66,9 +63,10 @@ namespace Tizen.NUI.Components } /// - /// Popup content of Dialog. Content is added to Children automatically. + /// Popup content of Dialog. + /// Content is added as a child of Dialog automatically. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public View Content { get diff --git a/src/Tizen.NUI.Components/Controls/Navigation/DialogPage.cs b/src/Tizen.NUI.Components/Controls/Navigation/DialogPage.cs index ff032a8..47444c3 100755 --- a/src/Tizen.NUI.Components/Controls/Navigation/DialogPage.cs +++ b/src/Tizen.NUI.Components/Controls/Navigation/DialogPage.cs @@ -25,7 +25,7 @@ namespace Tizen.NUI.Components /// The DialogPage class is a class which shows a dialog on the page. /// DialogPage contains dialog and dimmed scrim behind the dialog. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public class DialogPage : Page { private View content = null; @@ -35,7 +35,7 @@ namespace Tizen.NUI.Components /// /// Creates a new instance of a DialogPage. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public DialogPage() : base() { Layout = new AbsoluteLayout(); @@ -80,9 +80,11 @@ namespace Tizen.NUI.Components } /// - /// Content of DialogPage. Content is added to Children automatically. + /// Content of DialogPage. + /// Content is used as dialog, so Content is displayed above the dimmed scrim. + /// Content is added as a child of DialogPage automatically. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public View Content { get @@ -111,15 +113,24 @@ namespace Tizen.NUI.Components if (Scrim != null) { - content.RaiseAbove(Scrim); + foreach (var child in Children) + { + if (child != Scrim) + { + // All children are above Scrim not to be covered by Scrim. + child.RaiseAbove(Scrim); + } + } } } } /// - /// Scrim of DialogPage. Scrim is added to Children automatically. + /// Scrim of DialogPage. + /// Scrim is the dimmed screen region behind dialog. + /// Scrim is added as a child of DialogPage automatically. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 protected View Scrim { get @@ -146,9 +157,13 @@ namespace Tizen.NUI.Components Add(scrim); - if (Content != null) + foreach (var child in Children) { - Content.RaiseAbove(scrim); + if (child != scrim) + { + // All children are above Scrim not to be covered by Scrim. + child.RaiseAbove(scrim); + } } if (EnableScrim != Scrim.Visibility) @@ -168,7 +183,7 @@ namespace Tizen.NUI.Components /// /// Indicates to show scrim behind dialog. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public bool EnableScrim { get @@ -201,13 +216,13 @@ namespace Tizen.NUI.Components /// /// Indicates to dismiss dialog by touching on scrim. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public bool EnableDismissOnScrim { get; set; } = true; /// /// The color of scrim. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public Color ScrimColor { get @@ -246,7 +261,7 @@ namespace Tizen.NUI.Components /// Shows a dialog by pushing a dialog page containing dialog to default navigator. /// /// The content of Dialog. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "The pushed views are added to NavigationPages and are disposed in Navigator.Dispose().")] @@ -270,7 +285,7 @@ namespace Tizen.NUI.Components /// The title of AlertDialog. /// The message of AlertDialog. /// The action views of AlertDialog. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "The pushed views are added to NavigationPages and are disposed in Navigator.Dispose().")] diff --git a/src/Tizen.NUI.Components/Style/AlertDialogStyle.cs b/src/Tizen.NUI.Components/Style/AlertDialogStyle.cs index 0cc8ed8..eb4b0f7 100755 --- a/src/Tizen.NUI.Components/Style/AlertDialogStyle.cs +++ b/src/Tizen.NUI.Components/Style/AlertDialogStyle.cs @@ -21,27 +21,28 @@ using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// AlertDialogStyle is a class which saves AlertDialog's ux data. + /// AlertDialogStyle is a class which saves AlertDialog's UX data. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public class AlertDialogStyle : ButtonStyle { [EditorBrowsable(EditorBrowsableState.Never)] static AlertDialogStyle() { } /// - /// Creates a new instance of a AlertDialogStyle. + /// Creates a new instance of an AlertDialogStyle. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public AlertDialogStyle() : base() { } /// - /// Creates a new instance of a AlertDialogStyle with style. + /// Creates a new instance of an AlertDialogStyle with style. + /// The given style is copied to the new instance. /// /// Create AlertDialogStyle by style customized by user. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public AlertDialogStyle(AlertDialogStyle style) : base(style) { } @@ -50,27 +51,24 @@ namespace Tizen.NUI.Components /// Gets or sets the AlertDialog Title TextLabel style. /// This style is applied if AlertDialog TitleContent is a TextLabel. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public TextLabelStyle TitleTextLabel { get; set; } = new TextLabelStyle(); /// /// Gets or sets the AlertDialog Message TextLabel style. /// This style is applied if AlertDialog Content is a TextLabel. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public TextLabelStyle MessageTextLabel { get; set; } = new TextLabelStyle(); /// /// Gets or sets the AlertDialog ActionContent style. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public ViewStyle ActionContent { get; set; } = new ViewStyle(); - /// - /// Style's clone function. - /// - /// The style that need to copy. - [EditorBrowsable(EditorBrowsableState.Never)] + /// + /// 9 public override void CopyFrom(BindableObject bindableObject) { base.CopyFrom(bindableObject); -- 2.7.4