add disabled colors for rb list item
authorYurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <y.zinchuk@samsung.com>
Thu, 13 Apr 2023 15:14:39 +0000 (17:14 +0200)
committerPiotr Czaja/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Tue, 18 Apr 2023 09:37:34 +0000 (11:37 +0200)
SettingCore/Views/RadioButtonListItem.cs

index d26780d70bbe2388ae63169373f166fce5a8e10a..1e2ab62e421009c0276a3e539ebc01dff23bfab1 100644 (file)
@@ -1,4 +1,4 @@
-using System.Text;
+using System;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
@@ -8,7 +8,7 @@ namespace SettingCore.Views
     public class RadioButtonListItem : BaseComponent
     {
         private readonly ThemeColor BackgroundColors = new ThemeColor(Color.Transparent, Color.Transparent, new Color("#FF6400").WithAlpha(0.16f), new Color("#FFFFFF").WithAlpha(0.16f));
-        private readonly ThemeColor TextColors = new ThemeColor(new Color("#090E21"), new Color("#FDFDFD"), new Color("#FF6200"), new Color("#FF8A00"));
+        private readonly ThemeColor TextColors = new ThemeColor(new Color("#090E21"), new Color("#FDFDFD"), new Color("#FF6200"), new Color("#FF8A00"), new Color("#CACACA"), new Color("#666666"));
 
         public RadioButton RadioButton { get; private set; }
 
@@ -73,6 +73,15 @@ namespace SettingCore.Views
                 RadioButton.ApplyStyle(isLightTheme ? style_light : style_dark);
                 OnChangeSelected(false);
             };
+
+            Relayout += RadioButtonListItem_Relayout;
+        }
+
+        private void RadioButtonListItem_Relayout(object sender, EventArgs e)
+        {
+            if (!IsEnabled) OnDisabledStateChanged(false);
+
+            Relayout -= RadioButtonListItem_Relayout;
         }
 
         public override void OnChangeSelected(bool selected)
@@ -91,6 +100,20 @@ namespace SettingCore.Views
             }
         }
 
+        public override void OnDisabledStateChanged(bool isEnabled)
+        {
+            RadioButton.IsEnabled = isEnabled;
+
+            if (isEnabled)
+            {
+                RadioButton.TextColor = TextColors.Normal;
+            }
+            else
+            {
+                RadioButton.TextColor = TextColors.Disabled;
+            }
+        }
+
         private string GetIconPath(string name)
         {
             return System.IO.Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, $"radiobutton/{name}");