[NUI] Apply IsEnabled feature on Pickers.
authorEverLEEst(SangHyeon Lee) <sh10233.lee@samsung.com>
Mon, 2 May 2022 11:32:02 +0000 (20:32 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 3 May 2022 09:00:21 +0000 (02:00 -0700)
src/Tizen.NUI.Components/Controls/DatePicker.cs
src/Tizen.NUI.Components/Controls/Picker.cs
src/Tizen.NUI.Components/Controls/TimePicker.cs
test/Tizen.NUI.StyleGuide/Examples/DatePickerExample.cs
test/Tizen.NUI.StyleGuide/Examples/TimePickerExample.cs

index bfbe1e7..a113da2 100755 (executable)
@@ -50,7 +50,7 @@ namespace Tizen.NUI.Components
     }
 
     /// <summary>
-    /// DatePicker is a class which provides a function that allows the user to select 
+    /// DatePicker is a class which provides a function that allows the user to select
     /// a date through a scrolling motion by expressing the specified value as a list.
     /// DatePicker expresses the current date using the locale information of the system.
     /// Year range is 1970~2038 (glibc time_t struct min, max value)
@@ -110,6 +110,16 @@ namespace Tizen.NUI.Components
             SetKeyboardNavigationSupport(true);
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnEnabled(bool enabled)
+        {
+            base.OnEnabled(enabled);
+
+            dayPicker.IsEnabled = enabled;
+            monthPicker.IsEnabled = enabled;
+            yearPicker.IsEnabled = enabled;
+        }
 
         /// <summary>
         /// Dispose DatePicker and all children on it.
@@ -237,7 +247,7 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// ToDo : only key navigation is enabled, and value editing is added as an very simple operation. by toggling enter key, it switches edit mode. 
+        /// ToDo : only key navigation is enabled, and value editing is added as an very simple operation. by toggling enter key, it switches edit mode.
         /// ToDo : this should be fixed and changed properly by owner. (And UX SPEC should be referenced also)
         /// </summary>
         /// <param name="currentFocusedView"></param>
index 1b38b39..f462767 100755 (executable)
@@ -49,7 +49,7 @@ namespace Tizen.NUI.Components
     }
 
     /// <summary>
-    /// Picker is a class which provides a function that allows the user to select 
+    /// Picker is a class which provides a function that allows the user to select
     /// a value through a scrolling motion by expressing the specified value as a list.
     /// </summary>
     /// <since_tizen> 9 </since_tizen>
@@ -57,7 +57,7 @@ namespace Tizen.NUI.Components
     {
         //Tizen 6.5 base components Picker guide visible scroll item is 5.
         private const int scrollVisibleItems = 5;
-        //Dummy item count for loop feature. Max value of scrolling distance in 
+        //Dummy item count for loop feature. Max value of scrolling distance in
         //RPI target is bigger than 20 items height. it can adjust depends on the internal logic and device env.
         private const int dummyItemsForLoop = 20;
         private int startScrollOffset;
@@ -112,6 +112,16 @@ namespace Tizen.NUI.Components
         {
         }
 
+
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnEnabled(bool enabled)
+        {
+            base.OnEnabled(enabled);
+
+            pickerScroller.IsEnabled = enabled;
+        }
+
         /// <summary>
         /// Dispose Picker and all children on it.
         /// </summary>
index 49c2c59..aeac65e 100755 (executable)
@@ -49,7 +49,7 @@ namespace Tizen.NUI.Components
     }
 
     /// <summary>
-    /// TimePicker is a class which provides a function that allows the user to select 
+    /// TimePicker is a class which provides a function that allows the user to select
     /// a time through a scrolling motion by expressing the specified value as a list.
     /// TimePicker expresses the current time using the locale information of the system.
     /// </summary>
@@ -261,6 +261,18 @@ namespace Tizen.NUI.Components
             }
         }
 
+
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnEnabled(bool enabled)
+        {
+            base.OnEnabled(enabled);
+
+            hourPicker.IsEnabled = enabled;
+            minutePicker.IsEnabled = enabled;
+            ampmPicker.IsEnabled = enabled;
+        }
+
         /// <summary>
         /// Initialize TimePicker object.
         /// </summary>
@@ -338,7 +350,7 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// ToDo : only key navigation is enabled, and value editing is added as an very simple operation. by toggling enter key, it switches edit mode. 
+        /// ToDo : only key navigation is enabled, and value editing is added as an very simple operation. by toggling enter key, it switches edit mode.
         /// ToDo : this should be fixed and changed properly by owner. (And UX SPEC should be referenced also)
         /// </summary>
         /// <param name="currentFocusedView"></param>
index 27ad9bb..1ab5c7e 100644 (file)
@@ -81,6 +81,17 @@ namespace Tizen.NUI.StyleGuide
             };
             rootContent.Add(label);
 
+            var toggle = new Switch()
+            {
+                Text = "Disable Switch",
+            };
+            toggle.SelectedChanged += (object obj, SelectedChangedEventArgs ev) =>
+            {
+                datePicker.IsEnabled = !(ev.IsSelected);
+                Console.WriteLine($"Picker is {datePicker.IsEnabled}");
+            };
+            rootContent.Add(toggle);
+
             button = new Tizen.NUI.Components.Button
             {
                 WidthSpecification = LayoutParamPolicies.MatchParent,
index ae97508..55bdb7a 100644 (file)
@@ -81,6 +81,17 @@ namespace Tizen.NUI.StyleGuide
             };
             rootContent.Add(label);
 
+            var toggle = new Switch()
+            {
+                Text = "Disable Switch",
+            };
+            toggle.SelectedChanged += (object obj, SelectedChangedEventArgs ev) =>
+            {
+                timePicker.IsEnabled = !(ev.IsSelected);
+                Console.WriteLine($"Picker is {timePicker.IsEnabled}");
+            };
+            rootContent.Add(toggle);
+
             button = new Tizen.NUI.Components.Button
             {
                 WidthSpecification = LayoutParamPolicies.MatchParent,