using Tizen.System;
using System;
using SettingMainGadget.Common.Views;
+using SettingMainGadget.Common;
namespace Setting.Menu
{
private Button renameButton;
private string deviceName;
- private Window window = NUIApplication.GetDefaultWindow();
-
- private bool isLightTheme => ThemeManager.PlatformThemeId == "org.tizen.default-light-theme";
-
- private bool isPortrait => window.WindowSize.Width < window.WindowSize.Height;
-
- private static Color CancelButtonColor = new Color("#dc3545");
- private static Color CancelButtonTextColor = new Color("#ffffff");
-
- private static Color EnabledRenameButtonColor = new Color("#28a745");
- private static Color EnabledRenameButtonTextColor = new Color("#ffffff");
-
- private static Color DisabledRenameButtonColor = new Color("#a9d5b4");
- private static Color DisabledRenameButtonTextColor = new Color("#6c757d");
-
public override Color ProvideIconColor() => new Color(IsLightTheme ? "#301A4B" : "#CAB4E5");
public override string ProvideIconPath() => GetResourcePath("about.svg");
StyleName = "InputLine",
HeightSpecification = 2.SpToPx(),
WidthSpecification = LayoutParamPolicies.MatchParent,
- BackgroundColor= isLightTheme ? Color.Black : Color.White,
+ BackgroundColor= AppAttributes.IsLightTheme ? Color.Black : Color.White,
};
contentArea.Add(inputBaseLine);
PropertyMap placeholder = new PropertyMap();
- placeholder.Add("color", new PropertyValue(isLightTheme ? new Color("#CACACA") : new Color("#666666")));
+ placeholder.Add("color", new PropertyValue(AppAttributes.IsLightTheme ? new Color("#CACACA") : new Color("#666666")));
placeholder.Add("fontFamily", new PropertyValue("BreezeSans"));
placeholder.Add("pixelSize", new PropertyValue(24.SpToPx()));
placeholder.Add("text", new PropertyValue("Enter Device Name"));
}
}; ;
- Button cancelButton = new Button()
+ Button cancelButton = new Button("Tizen.NUI.Components.Button.Outlined")
{
- Size2D = new Size2D(180, 56).SpToPx(),
+ Size2D = AppAttributes.PopupActionButtonSize,
Name = "AlertDialogCreateButton",
- PointSize = 18.SpToPx(),
- CornerRadius = 24.SpToPx(),
- BackgroundColor = CancelButtonColor,
- TextColor = CancelButtonTextColor,
+ CornerRadius = AppAttributes.PopupActionButtonCornerRadius,
Text = "Cancel"
};
buttonArea.Add(cancelButton);
renameButton= new Button()
{
- Size2D = new Size2D(180, 56).SpToPx(),
+ Size2D = AppAttributes.PopupActionButtonSize,
Name = "AlertDialogCreateButton",
- PointSize = 18.SpToPx(),
- CornerRadius = 24.SpToPx(),
+ CornerRadius = AppAttributes.PopupActionButtonCornerRadius,
Text = "Rename",
- BackgroundColor = EnabledRenameButtonColor,
- TextColor = EnabledRenameButtonTextColor,
};
buttonArea.Add(renameButton);
{
ThemeChangeSensitive = true,
StyleName = "Dialogs",
- WidthSpecification = isPortrait ? window.Size.Width - 64.SpToPx() : (int)(window.Size.Width * 0.7f),
+ WidthSpecification = AppAttributes.IsPortrait ? AppAttributes.WindowWidth - 64.SpToPx() : (int)(AppAttributes.WindowWidth * 0.7f),
HeightSpecification = LayoutParamPolicies.WrapContent,
Layout = new LinearLayout()
{
},
Content = contentArea,
ActionContent = buttonArea,
- BoxShadow = isLightTheme ? new Shadow(8.0f, new Color(0.0f, 0.0f, 0.0f, 0.16f), new Vector2(0.0f, 2.0f)) : new Shadow(6.0f, new Color("#FFFFFF29"), new Vector2(0.0f, 1.0f)),
+ BoxShadow = AppAttributes.PopupBoxShadow,
};
if (cancelButton.SizeWidth > renameAlertDialog.SizeWidth / 2 - 40.SpToPx())
{
cancelButton.SizeWidth = renameAlertDialog.SizeWidth / 2 - 40.SpToPx();
renameButton.SizeWidth = renameAlertDialog.SizeWidth / 2 - 40.SpToPx();
}
- window.Add(renameAlertDialog);
+ AppAttributes.DefaultWindow.Add(renameAlertDialog);
cancelButton.Clicked += (object o, ClickedEventArgs e) =>
{
}
}
DeleteChildren(actionContentChilds);
- window.Remove(dialog);
+ AppAttributes.DefaultWindow.Remove(dialog);
dialog.Dispose();
}
{
renameButton.IsEnabled = false;
}
-
- if (renameButton.IsEnabled)
- {
- renameButton.BackgroundColor = EnabledRenameButtonColor;
- renameButton.TextColor = EnabledRenameButtonTextColor;
- }
- else
- {
- renameButton.BackgroundColor = DisabledRenameButtonColor;
- renameButton.TextColor= DisabledRenameButtonTextColor;
- }
}
private void cancelTextButton_Clicked(object sender, ClickedEventArgs e)
--- /dev/null
+using Tizen.Network.Connection;
+using Tizen.NUI;
+
+namespace SettingMainGadget.Common
+{
+ public static class AppAttributes
+ {
+ public static readonly Window DefaultWindow = NUIApplication.GetDefaultWindow();
+
+ public static readonly Size2D WindowSize = DefaultWindow.Size;
+ public static readonly int WindowWidth = WindowSize.Width;
+ public static readonly int WindowHeight = WindowSize.Height;
+
+ public static readonly bool IsPortrait = WindowWidth < WindowHeight;
+
+ public static readonly bool IsLightTheme = ThemeManager.PlatformThemeId == "org.tizen.default-light-theme";
+
+ public static readonly Size2D PopupActionButtonSize = new (252, 48);
+ public static readonly Vector4 PopupActionButtonCornerRadius = 24.SpToPx();
+ public static readonly Shadow PopupBoxShadow = IsLightTheme ? new Shadow(8.0f, new Color(0.0f, 0.0f, 0.0f, 0.16f), new Vector2(0.0f, 2.0f)) : new Shadow(6.0f, new Color("#FFFFFF29"), new Vector2(0.0f, 1.0f));
+ }
+}