diff options
author | Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com> | 2023-11-23 13:50:49 +0530 |
---|---|---|
committer | Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com> | 2023-11-23 13:50:49 +0530 |
commit | a7b2a8c1272459068a296ebe5a4fd60424735d3a (patch) | |
tree | 59532908e212618460b4a9767dabf1484b0fc46d | |
parent | d2cf2e093d62b393aa7f13407b4bb1726cda4569 (diff) | |
download | tray-a7b2a8c1272459068a296ebe5a4fd60424735d3a.tar.gz tray-a7b2a8c1272459068a296ebe5a4fd60424735d3a.tar.bz2 tray-a7b2a8c1272459068a296ebe5a4fd60424735d3a.zip |
Updating Theme Individually on Theme Changes.accepted/tizen/unified/riscv/20231215.050444accepted/tizen/unified/20231128.175129
Change-Id: Ic6ef88ef73e50456e1110e6fbeaf36a54a1d5fb4
Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
-rwxr-xr-x | Apps/Apps.csproj | 9 | ||||
-rw-r--r-- | Apps/Common/AppConstants.cs | 40 | ||||
-rwxr-xr-x | Apps/Common/Resources.cs | 6 | ||||
-rwxr-xr-x | Apps/ViewManager.cs | 56 | ||||
-rw-r--r-- | Apps/Views/AppItemLayout.cs | 45 | ||||
-rwxr-xr-x | Apps/Views/AppView.cs | 92 | ||||
-rwxr-xr-x | Apps/Views/CustomBorder.cs | 4 | ||||
-rw-r--r-- | Apps/Views/SelectAppItemLayout.cs | 42 | ||||
-rw-r--r-- | Apps/Views/SelectAppsView.cs | 14 | ||||
-rw-r--r-- | Apps/Views/SelectAppsViewHeader.cs | 43 | ||||
-rw-r--r-- | Apps/res/themes/dark.xaml | 68 | ||||
-rw-r--r-- | Apps/res/themes/light.xaml | 68 | ||||
-rwxr-xr-x | packaging/org.tizen.Apps-1.0.0.tpk | bin | 84119 -> 83327 bytes |
13 files changed, 241 insertions, 246 deletions
diff --git a/Apps/Apps.csproj b/Apps/Apps.csproj index e86a27b..0529c43 100755 --- a/Apps/Apps.csproj +++ b/Apps/Apps.csproj @@ -20,15 +20,6 @@ </ItemGroup> <ItemGroup> - <None Update="res\themes\dark.xaml"> - <Generator>MSBuild:Compile</Generator> - </None> - <None Update="res\themes\light.xaml"> - <Generator>MSBuild:Compile</Generator> - </None> - </ItemGroup> - - <ItemGroup> <Folder Include="res\images\light\" /> <Folder Include="res\images\dark\" /> </ItemGroup> diff --git a/Apps/Common/AppConstants.cs b/Apps/Common/AppConstants.cs new file mode 100644 index 0000000..d9a7302 --- /dev/null +++ b/Apps/Common/AppConstants.cs @@ -0,0 +1,40 @@ +using Tizen.NUI; + +namespace Apps.Common +{ + public static class AppConstants + { + private static bool IsLightTheme => ThemeManager.PlatformThemeId == Resources.LightPlatformThemeId; + public static Color AppsBackgroundColor => IsLightTheme ? new Color("#FAFAFA") : new Color("#16131A"); + public static Color BorderBackgroundColor => IsLightTheme ? new Color("rgba(250, 250, 250, 0.35)") : new Color("rgba(22, 19, 25, 0.5)"); + public static Color AppsTextColor => IsLightTheme ? new Color("#090E21") : new Color("#FDFDFD"); + public static Color FillButtonTextColor => IsLightTheme ? new Color("#16131A") : new Color("#FDFDFD"); + public static Color FillButtonColor => IsLightTheme ? new Color("#FF6200") : new Color("#FF8A00"); + public static Color DisabledButtonTextColor => IsLightTheme ? new Color("#CACACA") : new Color("#666666"); + public static Color NormalButtonTextColor => IsLightTheme ? new Color("#FF6200") : new Color("#FF8A00"); + public static Color PressedButtonTextColor => IsLightTheme ? new Color("#FFA166") : new Color("#CC6E00"); + + public static string PressedDeleteIconURL => Resources.GetImagePath() + (IsLightTheme ? "light" : "dark") + "/cross_button_selected.png"; + public static string NormalDeleteIconURL => Resources.GetImagePath() + (IsLightTheme ? "light" : "dark") + "/cross_button.png"; + public static string DisabledSelectedCheckboxURL => Resources.GetImagePath() + (IsLightTheme ? "light" : "dark") + "/circle_selected.png"; + public static string DisabledCheckboxURL => Resources.GetImagePath() + (IsLightTheme ? "light" : "dark") + "/circle.png"; + + public const int HeaderHeight = 64; + public const int AppCornerRadius = 24; + public const int AppNamesPixelSize = 16; + public const int TextPixelSize = 24; + public const int ButtonBorderlineWidth = 2; + + public static Extents HeaderPadding = new Extents(16, 16, 8, 8); + public static Extents HeaderMargin = new Extents(22, 22, 10, 0); + public static Size2D PopupButtonSize = new Size2D(252, 48); + public static Size2D TextButtonSize = new Size2D(110, 48); + public static Size2D CrossButtonSize = new Size2D(48, 48); + public static Size2D CheckboxSize = new Size2D(32, 32); + + public static PropertyMap AllNormalFontStyle = new PropertyMap(). + Add("width", new PropertyValue("normal")). + Add("weight", new PropertyValue("normal")). + Add("slant", new PropertyValue("normal")); + } +} diff --git a/Apps/Common/Resources.cs b/Apps/Common/Resources.cs index 100d98d..37a579d 100755 --- a/Apps/Common/Resources.cs +++ b/Apps/Common/Resources.cs @@ -22,15 +22,9 @@ namespace Apps.Common public const string LightPlatformThemeId = "org.tizen.default-light-theme"; public const string DarkPlatformThemeId = "org.tizen.default-dark-theme"; - public static string GetThemePath() - { - return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "themes/"; - } - public static string GetImagePath() { return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/"; } - } } diff --git a/Apps/ViewManager.cs b/Apps/ViewManager.cs index 171243d..e7c992b 100755 --- a/Apps/ViewManager.cs +++ b/Apps/ViewManager.cs @@ -43,8 +43,6 @@ namespace Apps { Task<IEnumerable<ApplicationInfo>> appListTask = CreateAppList(); - UpdateTheme(ThemeManager.PlatformThemeId); - appViewModel = new AppViewModel(); appView = new AppView(); appView.BindingContext = appViewModel; @@ -55,14 +53,11 @@ namespace Apps PackageManager.InstallProgressChanged += OnInstallProgressChanged; PackageManager.UninstallProgressChanged += OnUninstallProgressChanged; - - ThemeManager.ThemeChanged += OnThemeChanged; } public void CleanUp() { PackageManager.InstallProgressChanged -= OnInstallProgressChanged; PackageManager.UninstallProgressChanged -= OnUninstallProgressChanged; - ThemeManager.ThemeChanged -= OnThemeChanged; appView?.Dispose(); selectAppsView?.Dispose(); } @@ -91,15 +86,6 @@ namespace Apps Window.Instance.Add(selectAppsView); } - private void OnThemeChanged(object sender, ThemeChangedEventArgs e) - { - if (e.IsPlatformThemeChanged) - { - Tizen.Log.Info(Resources.LogTag, "Theme Changed: " + e.ThemeId); - UpdateTheme(e.PlatformThemeId); - } - } - private Task<IEnumerable<ApplicationInfo>> CreateAppList() { ApplicationInfoFilter appInfoFilter = new ApplicationInfoFilter(); @@ -151,47 +137,5 @@ namespace Apps Notification.MakeToast(uninstallFailedMessage, Notification.ToastBottom).Post(Notification.ToastShort); } } - - private void SetTheme(string path) - { - try - { - Theme theme = new Theme(path); - ThemeManager.ApplyTheme(theme); - } - catch (ArgumentNullException e) - { - Tizen.Log.Error(Resources.LogTag, "ArgumentNullException: " + e.ParamName); - } - catch (IOException e) - { - Tizen.Log.Error(Resources.LogTag, "IOException: " + e.Message); - } - catch (XamlParseException e) - { - Tizen.Log.Error(Resources.LogTag, "XamlParseException: " + e.Message); - if (e.XmlInfo != null) - { - Tizen.Log.Error(Resources.LogTag, "XamlParseException, LineNo." + e.XmlInfo.LineNumber + " Pos: " + e.XmlInfo.LinePosition + " HasInfo: " + e.XmlInfo.HasLineInfo().ToString()); - } - } - } - - private void UpdateTheme(string platformThemeId) - { - if (platformThemeId == null) - { - Tizen.Log.Error(Resources.LogTag, "Platform theme id is null"); - return; - } - if (platformThemeId.Equals(Resources.LightPlatformThemeId)) - { - SetTheme(Resources.GetThemePath() + "light.xaml"); - } - else if (platformThemeId.Equals(Resources.DarkPlatformThemeId)) - { - SetTheme(Resources.GetThemePath() + "dark.xaml"); - } - } } } diff --git a/Apps/Views/AppItemLayout.cs b/Apps/Views/AppItemLayout.cs index 604a5dd..c5ff551 100644 --- a/Apps/Views/AppItemLayout.cs +++ b/Apps/Views/AppItemLayout.cs @@ -63,7 +63,7 @@ namespace Apps.Views baseView = new View() { ThemeChangeSensitive = true, - StyleName = "TrayBackGround", + BackgroundColor = Color.Transparent, WidthSpecification = 120.SpToPx(), HeightSpecification = 136.SpToPx(), Layout = new RelativeLayout() @@ -96,10 +96,9 @@ namespace Apps.Views appLabel = new TextLabel() { - StyleName = "ItemTitle", FontFamily = "BreezeSans", ThemeChangeSensitive = true, - HeightSpecification = 24.SpToPx(), + PixelSize = AppConstants.AppNamesPixelSize.SpToPx(), WidthSpecification = LayoutParamPolicies.MatchParent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, @@ -115,6 +114,27 @@ namespace Apps.Views { AddCrossButton(); } + UpdateTheme(); + ThemeManager.ThemeChanged += OnAppItemsThemeChanged; + } + + private void OnAppItemsThemeChanged(object sender, ThemeChangedEventArgs e) + { + UpdateTheme(); + } + + private void UpdateTheme() + { + Label.TextColor = AppConstants.AppsTextColor; + if (CrossButton != null) + { + StringSelector images = new StringSelector() + { + Pressed = AppConstants.PressedDeleteIconURL, + Normal = AppConstants.NormalDeleteIconURL, + }; + CrossButton.IconURLSelector = images; + } } private ICommand appSelectCommand; @@ -184,14 +204,26 @@ namespace Apps.Views { if (CrossButton == null) { - CrossButton = new Button("CrossButton") + ButtonStyle buttonStyle = new ButtonStyle() { - Size2D = new Size2D(48, 48).SpToPx(), + Size = AppConstants.CrossButtonSize.SpToPx(), + BackgroundColor = Color.Transparent, + Icon = new ImageViewStyle() + { + Size = AppConstants.CrossButtonSize.SpToPx(), + }, + }; + CrossButton = new Button(buttonStyle) + { + IsSelectable = false, + IsEnabled = true, + AllowOnlyOwnTouch = true, }; baseView.Add(CrossButton); RelativeLayout.SetHorizontalAlignment(CrossButton, RelativeLayout.Alignment.End); RelativeLayout.SetVerticalAlignment(CrossButton, RelativeLayout.Alignment.Start); - CrossButton.Clicked += (object sender, ClickedEventArgs e) =>{ + CrossButton.Clicked += (object sender, ClickedEventArgs e) => + { if (isRemoveMode) { RemoveClicked.Invoke(this, new EventArgs()); @@ -220,6 +252,7 @@ namespace Apps.Views { DisposeTimer(); + ThemeManager.ThemeChanged -= OnAppItemsThemeChanged; baseView.Remove(appLabel); appLabel?.Dispose(); appLabel = null; diff --git a/Apps/Views/AppView.cs b/Apps/Views/AppView.cs index 465423d..bdb2a70 100755 --- a/Apps/Views/AppView.cs +++ b/Apps/Views/AppView.cs @@ -44,9 +44,8 @@ namespace Apps.Views public AppView() : base() { Name = "AppView"; - StyleName = "TrayBackGround"; ThemeChangeSensitive = true; - CornerRadius = 24.SpToPx(); + CornerRadius = AppConstants.AppCornerRadius.SpToPx(); WidthResizePolicy = ResizePolicyType.FillToParent; HeightResizePolicy = ResizePolicyType.FillToParent; ItemsLayouter = new GridLayouter(); @@ -55,9 +54,45 @@ namespace Apps.Views removeMode = false; UpdateItemTemplate(removeMode); Header = GetHeader(); + UpdateTheme(); + ThemeManager.ThemeChanged += OnAppViewThemeChanged; Tizen.Log.Info(Resources.LogTag, "AppView"); } + private void OnAppViewThemeChanged(object sender, ThemeChangedEventArgs e) + { + UpdateTheme(); + UpdatePopupTheme(); + } + + private void UpdateTheme() + { + DefaultTitleItem title = Header as DefaultTitleItem; + BackgroundColor = AppConstants.AppsBackgroundColor; + title.Label.TextColor = AppConstants.AppsTextColor; + } + + private void UpdatePopupTheme() + { + if (removePopup == null) + { + return; + } + TextLabel title = removePopup.TitleContent as TextLabel; + TextLabel content = removePopup.Content as TextLabel; + List<Button> buttons = removePopup.Actions as List<Button>; + removePopup.BackgroundColor = AppConstants.AppsBackgroundColor; + title.TextColor = AppConstants.AppsTextColor; + content.TextColor = AppConstants.AppsTextColor; + if (buttons.Count == 2) + { + buttons[0].BorderlineColor = AppConstants.FillButtonColor; + buttons[0].TextColor = AppConstants.FillButtonColor; + buttons[1].BackgroundColor = AppConstants.FillButtonColor; + buttons[1].TextColor = AppConstants.FillButtonTextColor; + } + } + private void OnLongPressed(object sender, EventArgs e) { removeMode = !removeMode; @@ -105,7 +140,6 @@ namespace Apps.Views { Window.WindowOrientation.Landscape, Window.WindowOrientation.LandscapeInverse, - Window.WindowOrientation.NoOrientationPreference, Window.WindowOrientation.Portrait, Window.WindowOrientation.PortraitInverse }; @@ -116,25 +150,38 @@ namespace Apps.Views popupBaseView = new View(); removePopupWindow.Add(popupBaseView); - Button cancelButton = new Button("CancelButton"); + Button cancelButton = new Button() + { + Size2D = AppConstants.PopupButtonSize.SpToPx(), + BackgroundColor = Color.Transparent, + BorderlineWidth = AppConstants.ButtonBorderlineWidth.SpToPx(), + }; + cancelButton.TextLabel.PixelSize = AppConstants.TextPixelSize.SpToPx(); + cancelButton.TextLabel.Text = "Cancel"; Button deleteButton = new Button() { - Size2D = new Size2D(252, 48).SpToPx(), - Text = "Delete", + Size2D = AppConstants.PopupButtonSize.SpToPx(), }; - deleteButton.PointSize = 16.SpToPx(); + deleteButton.TextLabel.PixelSize = AppConstants.TextPixelSize.SpToPx(); + deleteButton.TextLabel.Text = "Delete"; if (removePopup == null) { removePopup = new AlertDialog() { - StyleName = "AlertDialogBackground", Title = "Delete App from the Device", Message = "Do you want to delete this app from the device?", Actions = new List<Button>() { cancelButton, deleteButton }, }; + TextLabel title = removePopup.TitleContent as TextLabel; + title.PixelSize = AppConstants.TextPixelSize.SpToPx(); + title.FontFamily = "BreezeSans"; + TextLabel content = removePopup.Content as TextLabel; + content.PixelSize = AppConstants.TextPixelSize.SpToPx(); + content.FontFamily = "BreezeSans"; } popupBaseView.Add(removePopup); UpdateRemovePopupWindowDimensions(); + UpdatePopupTheme(); removePopupWindow.Resized += (object sender, Window.ResizedEventArgs e) => { UpdateRemovePopupWindowDimensions(); @@ -173,20 +220,18 @@ namespace Apps.Views private RecyclerViewItem GetHeader() { - DefaultTitleItem allAppTitle = new DefaultTitleItem("Header") + DefaultTitleItem allAppTitle = new DefaultTitleItem() { ThemeChangeSensitive = true, - Padding = new Extents(16, 16, 8, 8).SpToPx(), - Margin = new Extents(22, 22, 10, 0).SpToPx(), + Padding = AppConstants.HeaderPadding.SpToPx(), + Margin = AppConstants.HeaderMargin.SpToPx(), Text = "All Apps", - HeightSpecification = 64.SpToPx(), + HeightSpecification = AppConstants.HeaderHeight.SpToPx(), WidthResizePolicy = ResizePolicyType.FillToParent, }; + allAppTitle.Label.PixelSize = AppConstants.TextPixelSize.SpToPx(); allAppTitle.Label.FontFamily = "BreezeSans"; - allAppTitle.Label.FontStyle = new PropertyMap(). - Add("width", new PropertyValue("normal")). - Add("weight", new PropertyValue("normal")). - Add("slant", new PropertyValue("normal")); + allAppTitle.Label.FontStyle = AppConstants.AllNormalFontStyle; return allAppTitle; } @@ -196,6 +241,21 @@ namespace Apps.Views get => (ICommand)GetValue(AppRemoveCommandProperty); set => SetValue(AppRemoveCommandProperty, value); } + + protected override void Dispose(DisposeTypes type) + { + if (Disposed) + { + return; + } + if (type == DisposeTypes.Explicit) + { + ThemeManager.ThemeChanged -= OnAppViewThemeChanged; + RemoveConfirmationPopup(); + } + Tizen.Log.Info(Resources.LogTag, "Dispose AppView"); + base.Dispose(type); + } } } diff --git a/Apps/Views/CustomBorder.cs b/Apps/Views/CustomBorder.cs index 7b4a48b..c8e5a94 100755 --- a/Apps/Views/CustomBorder.cs +++ b/Apps/Views/CustomBorder.cs @@ -41,7 +41,7 @@ namespace Apps.Views public override void CreateBorderView(View borderView) { this.borderView = borderView; - borderView.BackgroundColor = ThemeManager.PlatformThemeId == Resources.LightPlatformThemeId ? new Color("rgba(250, 250, 250, 0.35)") : new Color("rgba(22, 19, 25, 0.5)"); + borderView.BackgroundColor = AppConstants.BorderBackgroundColor; ThemeManager.ThemeChanged += OnThemeChanged; } @@ -51,7 +51,7 @@ namespace Apps.Views { return; } - borderView.BackgroundColor = ThemeManager.PlatformThemeId == Resources.LightPlatformThemeId ? new Color("rgba(250, 250, 250, 0.35)") : new Color("rgba(22, 19, 25, 0.5)"); + borderView.BackgroundColor = AppConstants.BorderBackgroundColor; } public override bool CreateBottomBorderView(View bottomView) diff --git a/Apps/Views/SelectAppItemLayout.cs b/Apps/Views/SelectAppItemLayout.cs index 10badee..7674e0e 100644 --- a/Apps/Views/SelectAppItemLayout.cs +++ b/Apps/Views/SelectAppItemLayout.cs @@ -24,7 +24,7 @@ namespace Apps.Views baseView = new View() { ThemeChangeSensitive = true, - StyleName = "TrayBackGround", + BackgroundColor = Color.Transparent, WidthSpecification = 120.SpToPx(), HeightSpecification = 136.SpToPx(), Layout = new RelativeLayout() @@ -57,10 +57,9 @@ namespace Apps.Views Label = new TextLabel() { - StyleName = "ItemTitle", FontFamily = "BreezeSans", ThemeChangeSensitive = true, - HeightSpecification = 24.SpToPx(), + PixelSize = AppConstants.AppNamesPixelSize.SpToPx(), WidthSpecification = LayoutParamPolicies.MatchParent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, @@ -69,14 +68,46 @@ namespace Apps.Views RelativeLayout.SetHorizontalAlignment(Label, RelativeLayout.Alignment.Center); RelativeLayout.SetVerticalAlignment(Label, RelativeLayout.Alignment.End); - - SelectButton = new CheckBox("CheckBox"); + ButtonStyle buttonStyle = new ButtonStyle() + { + Size = AppConstants.CheckboxSize.SpToPx(), + Margin = new Extents(8, 8, 8, 8).SpToPx(), + BackgroundColor = Color.Transparent, + Icon = new ImageViewStyle() + { + Size = AppConstants.CheckboxSize.SpToPx(), + } + }; + SelectButton = new CheckBox(buttonStyle) + { + IsSelected = false, + IsEnabled = false, + }; baseView.Add(SelectButton); RelativeLayout.SetRightTarget(SelectButton, IconBackground); RelativeLayout.SetRightRelativeOffset(SelectButton, 1.0f); RelativeLayout.SetHorizontalAlignment(SelectButton, RelativeLayout.Alignment.End); AllowOnlyOwnTouch = true; + + UpdateTheme(); + ThemeManager.ThemeChanged += OnAppsItemThemeChanged; + } + + private void OnAppsItemThemeChanged(object sender, ThemeChangedEventArgs e) + { + UpdateTheme(); + } + + private void UpdateTheme() + { + Label.TextColor = AppConstants.AppsTextColor; + StringSelector images = new StringSelector() + { + DisabledSelected = AppConstants.DisabledSelectedCheckboxURL, + Disabled = AppConstants.DisabledCheckboxURL, + }; + SelectButton.IconURLSelector = images; } public TextLabel Label { get; private set; } @@ -96,6 +127,7 @@ namespace Apps.Views } if (type == DisposeTypes.Explicit) { + ThemeManager.ThemeChanged -= OnAppsItemThemeChanged; baseView.Remove(Label); Label?.Dispose(); diff --git a/Apps/Views/SelectAppsView.cs b/Apps/Views/SelectAppsView.cs index 7788f1f..d158c1c 100644 --- a/Apps/Views/SelectAppsView.cs +++ b/Apps/Views/SelectAppsView.cs @@ -22,7 +22,6 @@ namespace Apps.Views public SelectAppsView() : base() { Name = "SelectAppsView"; - StyleName = "TrayBackGround"; ThemeChangeSensitive = true; CornerRadius = 24.SpToPx(); WidthResizePolicy = ResizePolicyType.FillToParent; @@ -43,6 +42,18 @@ namespace Apps.Views ((SelectAppsViewHeader)Header).AddButton.SetBinding(CommandProperty, "AppsSelectedCommand"); ((SelectAppsViewHeader)Header).AddButton.SetBinding(IsEnabledProperty, "IsAppsSelected"); Tizen.Log.Info(Resources.LogTag, "SelectAppsView"); + UpdateTheme(); + ThemeManager.ThemeChanged += OnSelectAppsViewThemeChanged; + } + + private void OnSelectAppsViewThemeChanged(object sender, ThemeChangedEventArgs e) + { + UpdateTheme(); + } + + private void UpdateTheme() + { + BackgroundColor = AppConstants.AppsBackgroundColor; } protected override void Dispose(DisposeTypes type) @@ -53,6 +64,7 @@ namespace Apps.Views } if (type == DisposeTypes.Explicit) { + ThemeManager.ThemeChanged -= OnSelectAppsViewThemeChanged; Header.Dispose(); } Tizen.Log.Info(Resources.LogTag, "Dispose SelectAppsView"); diff --git a/Apps/Views/SelectAppsViewHeader.cs b/Apps/Views/SelectAppsViewHeader.cs index 0d11e01..9b40265 100644 --- a/Apps/Views/SelectAppsViewHeader.cs +++ b/Apps/Views/SelectAppsViewHeader.cs @@ -13,35 +13,58 @@ namespace Apps.Views { ThemeChangeSensitive = true; WidthResizePolicy = ResizePolicyType.FillToParent; - HeightSpecification = 64.SpToPx(); - Padding = new Extents(16, 16, 8, 8).SpToPx(); - Margin = new Extents(22, 22, 10, 0).SpToPx(); + HeightSpecification = AppConstants.HeaderHeight.SpToPx(); + Padding = AppConstants.HeaderPadding.SpToPx(); + Margin = AppConstants.HeaderMargin.SpToPx(); BackgroundColor = Color.Transparent; CornerRadius = new Vector4(24, 24, 0, 0); Layout = new RelativeLayout(); label = new TextLabel() { - StyleName = "HeaderTitle", Text = "All Apps", - FontStyle = new PropertyMap().Add("width", new PropertyValue("normal")). - Add("weight", new PropertyValue("normal")). - Add("slant", new PropertyValue("normal")), + PixelSize = AppConstants.TextPixelSize.SpToPx(), + FontFamily = "BreezeSans", + FontStyle = AppConstants.AllNormalFontStyle, }; Add(label); RelativeLayout.SetVerticalAlignment(label, RelativeLayout.Alignment.Center); RelativeLayout.SetHorizontalAlignment(label, RelativeLayout.Alignment.Start); - AddButton = new Button("TextButton") + AddButton = new Button() { - Text = "Add", + Size2D = AppConstants.TextButtonSize.SpToPx(), IsEnabled = false, + TextAlignment = HorizontalAlignment.Center, + BackgroundColor = Color.Transparent, }; + AddButton.TextLabel.Text = "Add"; + AddButton.TextLabel.PixelSize = AppConstants.TextPixelSize.SpToPx(); + AddButton.TextLabel.FontFamily = "BreezeSans"; Add(AddButton); RelativeLayout.SetVerticalAlignment(AddButton, RelativeLayout.Alignment.Center); RelativeLayout.SetHorizontalAlignment(AddButton, RelativeLayout.Alignment.End); Tizen.Log.Info(Resources.LogTag, "SelectAppsViewHeader"); IsEnabled = false; + UpdateTheme(); + ThemeManager.ThemeChanged += OnHeaderThemeChanged; + } + + private void OnHeaderThemeChanged(object sender, ThemeChangedEventArgs e) + { + UpdateTheme(); + } + + private void UpdateTheme() + { + label.TextColor = AppConstants.AppsTextColor; + ColorSelector colors = new ColorSelector + { + Disabled = AppConstants.DisabledButtonTextColor, + Normal = AppConstants.NormalButtonTextColor, + Pressed = AppConstants.PressedButtonTextColor + }; + AddButton.TextColorSelector = colors; } public Button AddButton { get; private set; } @@ -54,6 +77,8 @@ namespace Apps.Views } if (type == DisposeTypes.Explicit) { + ThemeManager.ThemeChanged -= OnHeaderThemeChanged; + Remove(label); label?.Dispose(); label = null; diff --git a/Apps/res/themes/dark.xaml b/Apps/res/themes/dark.xaml deleted file mode 100644 index 6bd99a7..0000000 --- a/Apps/res/themes/dark.xaml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Theme -xmlns="http://tizen.org/Tizen.NUI/2018/XAML" -xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" -xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components" -Id="DarkTheme"> - - <ViewStyle x:Key="TrayBackGround" BackgroundColor="#16131A" /> - - <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="True" > - <c:DefaultTitleItemStyle.Label> - <TextLabelStyle PixelSize ="24sp" TextColor ="#FDFDFD" FontFamily="BreezeSans" /> - </c:DefaultTitleItemStyle.Label> - </c:DefaultTitleItemStyle> - - <c:ButtonStyle x:Key="CrossButton" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent"> - <c:ButtonStyle.Icon> - <ImageViewStyle Size="48sp, 48sp"> - <ImageViewStyle.ResourceUrl> - <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/cross_button.png" Pressed="*Resource*/images/light/cross_button_selected.png" /> - </ImageViewStyle.ResourceUrl> - </ImageViewStyle> - </c:ButtonStyle.Icon> - </c:ButtonStyle> - - <c:AlertDialogStyle x:Key="AlertDialogBackground" ThemeChangeSensitive="true" BackgroundColor="#16131A"> - <c:AlertDialogStyle.TitleTextLabel> - <TextLabelStyle TextColor="#FDFDFD" FontFamily="BreezeSans" PixelSize="24sp" /> - </c:AlertDialogStyle.TitleTextLabel> - <c:AlertDialogStyle.MessageTextLabel> - <TextLabelStyle TextColor="#FDFDFD" FontFamily="BreezeSans" PixelSize="24sp" /> - </c:AlertDialogStyle.MessageTextLabel> - </c:AlertDialogStyle> - - <c:ButtonStyle x:Key="CancelButton" ThemeChangeSensitive="true" Size="252sp, 48sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" > - <c:ButtonStyle.Icon> - <ImageViewStyle Size="252sp, 48sp"> - <ImageViewStyle.ResourceUrl> - <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/cancel_button.png" /> - </ImageViewStyle.ResourceUrl> - </ImageViewStyle> - </c:ButtonStyle.Icon> - </c:ButtonStyle> - - <TextLabelStyle x:Key="ItemTitle" ThemeChangeSensitive="true" TextColor="#FDFDFD" FontFamily="BreezeSans" PixelSize="16sp"/> - - <TextLabelStyle x:Key="HeaderTitle" ThemeChangeSensitive="true" TextColor="#FDFDFD" FontFamily="BreezeSans" PixelSize="24sp"/> - - <c:ButtonStyle x:Key="TextButton" ThemeChangeSensitive="true" Size="110sp, 48sp" BackgroundColor="Transparent" > - <c:ButtonStyle.Text> - <TextLabelStyle FontFamily="BreezeSans" PixelSize="24sp" VerticalAlignment ="Center" HorizontalAlignment ="Center"> - <TextLabelStyle.TextColor> - <Selector x:TypeArguments="Color" Normal="#FF8A00" Pressed="#CC6E00" Disabled="#666666" /> - </TextLabelStyle.TextColor> - </TextLabelStyle> - </c:ButtonStyle.Text> - </c:ButtonStyle> - - <c:ButtonStyle x:Key="CheckBox" ThemeChangeSensitive="true" Size="32sp, 32sp" Margin="8sp, 8sp, 8sp, 8sp" IsSelected="false" IsEnabled="false" BackgroundColor="Transparent"> - <c:ButtonStyle.Icon> - <ImageViewStyle Size="32sp, 32sp"> - <ImageViewStyle.ResourceUrl> - <Selector x:TypeArguments="x:String" Disabled="*Resource*/images/dark/circle.png" DisabledSelected="*Resource*/images/dark/circle_selected.png" /> - </ImageViewStyle.ResourceUrl> - </ImageViewStyle> - </c:ButtonStyle.Icon> - </c:ButtonStyle> -</Theme>
\ No newline at end of file diff --git a/Apps/res/themes/light.xaml b/Apps/res/themes/light.xaml deleted file mode 100644 index ac5b0aa..0000000 --- a/Apps/res/themes/light.xaml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Theme -xmlns="http://tizen.org/Tizen.NUI/2018/XAML" -xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" -xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components" -Id="LightTheme"> - - <ViewStyle x:Key="TrayBackGround" BackgroundColor="#FAFAFA" /> - - <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="True"> - <c:DefaultTitleItemStyle.Label> - <TextLabelStyle PixelSize ="24sp" TextColor ="#090E21" FontFamily="BreezeSans" /> - </c:DefaultTitleItemStyle.Label> - </c:DefaultTitleItemStyle> - - <c:ButtonStyle x:Key="CrossButton" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent"> - <c:ButtonStyle.Icon> - <ImageViewStyle Size="48sp, 48sp"> - <ImageViewStyle.ResourceUrl> - <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/cross_button.png" Pressed="*Resource*/images/light/cross_button_selected.png" /> - </ImageViewStyle.ResourceUrl> - </ImageViewStyle> - </c:ButtonStyle.Icon> - </c:ButtonStyle> - - <c:AlertDialogStyle x:Key="AlertDialogBackground" ThemeChangeSensitive="true" BackgroundColor="#FAFAFA"> - <c:AlertDialogStyle.TitleTextLabel> - <TextLabelStyle TextColor="#090E21" FontFamily="BreezeSans" PixelSize="24sp" /> - </c:AlertDialogStyle.TitleTextLabel> - <c:AlertDialogStyle.MessageTextLabel> - <TextLabelStyle TextColor="#090E21" FontFamily="BreezeSans" PixelSize="24sp" /> - </c:AlertDialogStyle.MessageTextLabel> - </c:AlertDialogStyle> - - <c:ButtonStyle x:Key="CancelButton" ThemeChangeSensitive="true" Size="252sp, 48sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" > - <c:ButtonStyle.Icon> - <ImageViewStyle Size="252sp, 48sp"> - <ImageViewStyle.ResourceUrl> - <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/cancel_button.png" /> - </ImageViewStyle.ResourceUrl> - </ImageViewStyle> - </c:ButtonStyle.Icon> - </c:ButtonStyle> - - <TextLabelStyle x:Key="ItemTitle" ThemeChangeSensitive="true" TextColor="#090E21" FontFamily="BreezeSans" PixelSize="16sp"/> - - <TextLabelStyle x:Key="HeaderTitle" ThemeChangeSensitive="true" TextColor="#090E21" FontFamily="BreezeSans" PixelSize="24sp"/> - - <c:ButtonStyle x:Key="TextButton" ThemeChangeSensitive="true" Size="110sp, 48sp" BackgroundColor="Transparent" > - <c:ButtonStyle.Text> - <TextLabelStyle FontFamily="BreezeSans" PixelSize="24sp" VerticalAlignment ="Center" HorizontalAlignment ="Center"> - <TextLabelStyle.TextColor> - <Selector x:TypeArguments="Color" Normal="#FF6200" Pressed="#FFA166" Disabled="#CACACA" /> - </TextLabelStyle.TextColor> - </TextLabelStyle> - </c:ButtonStyle.Text> - </c:ButtonStyle> - - <c:ButtonStyle x:Key="CheckBox" ThemeChangeSensitive="true" Size="32sp, 32sp" Margin="8sp, 8sp, 8sp, 8sp" IsSelected="false" IsEnabled="false" BackgroundColor="Transparent"> - <c:ButtonStyle.Icon> - <ImageViewStyle Size="32sp, 32sp"> - <ImageViewStyle.ResourceUrl> - <Selector x:TypeArguments="x:String" Disabled="*Resource*/images/light/circle.png" DisabledSelected="*Resource*/images/light/circle_selected.png" /> - </ImageViewStyle.ResourceUrl> - </ImageViewStyle> - </c:ButtonStyle.Icon> - </c:ButtonStyle> -</Theme>
\ No newline at end of file diff --git a/packaging/org.tizen.Apps-1.0.0.tpk b/packaging/org.tizen.Apps-1.0.0.tpk Binary files differindex 2ff7091..59b21de 100755 --- a/packaging/org.tizen.Apps-1.0.0.tpk +++ b/packaging/org.tizen.Apps-1.0.0.tpk |