[NUI] Add AlertDialogStyle class with the latest AlertDialog UX
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Thu, 8 Apr 2021 16:21:07 +0000 (01:21 +0900)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 20 Apr 2021 06:13:00 +0000 (15:13 +0900)
To apply the latest AlertDialog UX, AlertDialogStyle class is added.

src/Tizen.NUI.Components/Theme/DefaultTheme.cs
src/Tizen.NUI.Components/Theme/DefaultThemeCommon.cs

index 84323f2..cdfd732 100755 (executable)
@@ -180,6 +180,26 @@ namespace Tizen.NUI.Components
                     .Add<Position>("/Pickers/Divider/Position", (ViewStyle style, Position value) => ((DatePickerStyle)style).Pickers.Divider.Position = value)
                     .AddSelector("/Pickers/Divider/BackgroundColor", (ViewStyle style, Selector<Color> value) => ((DatePickerStyle)style).Pickers.Divider.BackgroundColor = value, ControlState.Selected)
                     .Add<Size>("/Pickers/StartScrollOffset", (ViewStyle style, Size value) => ((DatePickerStyle)style).Pickers.StartScrollOffset = value),
+
+                // AlertDialog
+                (new ExternalThemeKeyList(typeof(AlertDialog), typeof(AlertDialogStyle)))
+                    .Add<Size>("/Size", (ViewStyle style, Size value) => ((ViewStyle)style).Size = value)
+                    .Add<Extents>("/Padding", (ViewStyle style, Extents value) => ((ViewStyle)style).Padding = value)
+                    .Add<string>("/BackgroundImage", (ViewStyle style, string value) => ((ViewStyle)style).BackgroundImage = value)
+                    .Add<Size>("/TitleTextLabel/Size", (ViewStyle style, Size value) => ((AlertDialogStyle)style).TitleTextLabel.Size = value)
+                    .Add<Extents>("/TitleTextLabel/Margin", (ViewStyle style, Extents value) => ((AlertDialogStyle)style).TitleTextLabel.Margin = value)
+                    .Add<float?>("/TitleTextLabel/PixelSize", (ViewStyle style, float? value) => ((AlertDialogStyle)style).TitleTextLabel.PixelSize = value)
+                    .Add<HorizontalAlignment?>("/TitleTextLabel/HorizontalAlignment", (ViewStyle style, HorizontalAlignment? value) => ((AlertDialogStyle)style).TitleTextLabel.HorizontalAlignment = value)
+                    .Add<VerticalAlignment?>("/TitleTextLabel/VerticalAlignment", (ViewStyle style, VerticalAlignment? value) => ((AlertDialogStyle)style).TitleTextLabel.VerticalAlignment = value)
+                    .AddSelector<Color>("/TitleTextLabel/TextColor", (ViewStyle style, Selector<Color> value) => ((AlertDialogStyle)style).TitleTextLabel.TextColor = value)
+                    .Add<Size>("/MessageTextLabel/Size", (ViewStyle style, Size value) => ((AlertDialogStyle)style).MessageTextLabel.Size = value)
+                    .Add<Extents>("/MessageTextLabel/Margin", (ViewStyle style, Extents value) => ((AlertDialogStyle)style).MessageTextLabel.Margin = value)
+                    .Add<float?>("/MessageTextLabel/PixelSize", (ViewStyle style, float? value) => ((AlertDialogStyle)style).MessageTextLabel.PixelSize = value)
+                    .Add<bool?>("/MessageTextLabel/MultiLine", (ViewStyle style, bool? value) => ((AlertDialogStyle)style).MessageTextLabel.MultiLine = value)
+                    .Add<HorizontalAlignment?>("/MessageTextLabel/HorizontalAlignment", (ViewStyle style, HorizontalAlignment? value) => ((AlertDialogStyle)style).MessageTextLabel.HorizontalAlignment = value)
+                    .Add<VerticalAlignment?>("/MessageTextLabel/VerticalAlignment", (ViewStyle style, VerticalAlignment? value) => ((AlertDialogStyle)style).MessageTextLabel.VerticalAlignment = value)
+                    .AddSelector<Color>("/MessageTextLabel/TextColor", (ViewStyle style, Selector<Color> value) => ((AlertDialogStyle)style).MessageTextLabel.TextColor = value)
+                    .Add<Size>("/ActionContent/Size", (ViewStyle style, Size value) => ((AlertDialogStyle)style).ActionContent.Size = value),
             };
 
             return actionSet;
index c858096..7d8e14c 100755 (executable)
@@ -608,6 +608,42 @@ namespace Tizen.NUI.Components
                 }
             });
 
+            theme.AddStyleWithoutClone("Tizen.NUI.Components.AlertDialog", new AlertDialogStyle()
+            {
+                Size = new Size(-2, -2),
+                Padding = new Extents(80, 80, 0, 0),
+                BackgroundImage = FrameworkInformation.ResourcePath + "nui_component_default_dialog_bg.#.png",
+                TitleTextLabel = new TextLabelStyle()
+                {
+                    Size = new Size(1024, -2),
+                    Margin = new Extents(0, 0, 40, 40),
+                    PixelSize = 40,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center,
+                    TextColor = new Selector<Color>()
+                    {
+                        Normal = new Color("#000C2BFF"),
+                    },
+                },
+                MessageTextLabel = new TextLabelStyle()
+                {
+                    Size = new Size(1024, -2),
+                    Margin = new Extents(0, 0, 0, 64),
+                    PixelSize = 32,
+                    MultiLine = true,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center,
+                    TextColor = new Selector<Color>()
+                    {
+                        Normal = new Color("#000C2BFF"),
+                    },
+                },
+                ActionContent = new ViewStyle()
+                {
+                    Size = new Size(1024, -2),
+                },
+            });
+
             return theme;
         }
     }