From: Yurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics Date: Thu, 25 Jan 2024 12:48:12 +0000 (+0100) Subject: update main menu component X-Git-Tag: accepted/tizen/unified/20240222.163404~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c32a772d093fa1ce33d185eb0f5a43e2d5245a8;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsettings.git update main menu component --- diff --git a/SettingCore/Views/MainMenuItem.cs b/SettingCore/Views/MainMenuItem.cs index 379d925..1820e45 100644 --- a/SettingCore/Views/MainMenuItem.cs +++ b/SettingCore/Views/MainMenuItem.cs @@ -1,5 +1,6 @@ using Tizen.NUI; using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; namespace SettingCore.Views { @@ -8,26 +9,26 @@ namespace SettingCore.Views private readonly ThemeColor BackgroundColors = new ThemeColor(Color.Transparent, Color.Transparent, new Color("#FF6400").WithAlpha(0.16f), Color.White.WithAlpha(0.16f)); private readonly ThemeColor TextColors = new ThemeColor(new Color("#090E21"), new Color("#FDFDFD"), new Color("#FF6200"), new Color("#FF8A00")); private readonly ThemeColor IconColors = new ThemeColor(Color.White, Color.Black, Color.White, Color.Black); - private readonly ThemeColor IconBackgroundColors; private readonly ImageView icon; + private readonly View iconBackground; private readonly ImageVisual iconVisual; private readonly TextLabel titleTextLabel; - public MainMenuItem(string iconPath, Color iconBackgroungColor, string title) : base() - { - IconBackgroundColors = new ThemeColor(iconBackgroungColor, iconBackgroungColor, iconBackgroungColor, iconBackgroungColor); + public string MenuPath { get; private set; } + public MainMenuItem(string iconPath, Color iconBackgroungColor, string title, string menuPath) : base() + { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center, }; - var iconBackground = new View + iconBackground = new View { CornerRadius = 5.SpToPx(), - BackgroundColor = IconBackgroundColors.Normal, + BackgroundColor = iconBackgroungColor, Size = new Size(32, 32).SpToPx(), Margin = new Extents(16, 16, 16, 16).SpToPx(), }; @@ -60,9 +61,22 @@ namespace SettingCore.Views AccessibilityRole = Role.MenuItem; + MenuPath = menuPath; + Clicked += (s, e) => + { + Logger.Debug($"navigating to menupath {MenuPath}, title: {title}"); + GadgetNavigation.NavigateTo(MenuPath); + }; + ThemeManager.ThemeChanged += ThemeManager_ThemeChanged; } + public void UpdateItem(string title, Color iconBackgroungColor) + { + titleTextLabel.Text = title; + iconBackground.BackgroundColor = iconBackgroungColor; + } + public override void OnChangeSelected(bool selected) { if (selected)