[NUI] Update Progress style
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Wed, 7 Apr 2021 11:05:20 +0000 (20:05 +0900)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 20 Apr 2021 06:13:00 +0000 (15:13 +0900)
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
src/Tizen.NUI.Components/Controls/Progress.cs
src/Tizen.NUI.Components/Style/ProgressStyle.cs
src/Tizen.NUI.Components/Theme/DefaultTheme.cs
src/Tizen.NUI.Components/Theme/DefaultThemeCommon.cs
src/Tizen.NUI.Components/res/IoT_progress_indeterminate.png [new file with mode: 0755]
src/Tizen.NUI.Components/res/nui_component_default_progress_indeterminate.png
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/ProgressSample.cs

index 140f30c..9e0e86b 100755 (executable)
@@ -23,12 +23,14 @@ using System.Diagnostics;
 namespace Tizen.NUI.Components
 {
     /// <summary>
-    /// The Progress class of nui component. It's used to show the ongoing status with a long narrow bar.
+    /// The Progress class is used to show the ongoing status with a long narrow bar.
     /// </summary>
     /// <since_tizen> 6 </since_tizen>
     public class Progress : Control
     {
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// MaxValueProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty MaxValueProperty = BindableProperty.Create(nameof(MaxValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -45,7 +47,9 @@ namespace Tizen.NUI.Components
             return instance.maxValue;
         });
 
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// MinValueProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty MinValueProperty = BindableProperty.Create(nameof(MinValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -62,7 +66,9 @@ namespace Tizen.NUI.Components
             return instance.minValue;
         });
 
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// CurrentValueProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty CurrentValueProperty = BindableProperty.Create(nameof(CurrentValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -83,7 +89,9 @@ namespace Tizen.NUI.Components
             return instance.currentValue;
         });
 
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// BufferValueProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty BufferValueProperty = BindableProperty.Create(nameof(BufferValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -104,7 +112,9 @@ namespace Tizen.NUI.Components
             return instance.bufferValue;
         });
 
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// ProgressStateProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty ProgressStateProperty = BindableProperty.Create(nameof(ProgressState), typeof(ProgressStatusType), typeof(Progress), ProgressStatusType.Indeterminate, propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -377,6 +387,10 @@ namespace Tizen.NUI.Components
             InitializeTrack();
             InitializeBuffer();
             InitializeProgress();
+            InitializeIndeterminate();
+
+            indeterminateAnimation?.Stop();
+            indeterminateAnimation = null;
         }
 
         /// <inheritdoc/>
@@ -394,6 +408,11 @@ namespace Tizen.NUI.Components
                 trackImage.ApplyStyle(progressStyle.Track);
                 progressImage.ApplyStyle(progressStyle.Progress);
                 bufferImage.ApplyStyle(progressStyle.Buffer);
+
+                if (null != indeterminateImage && null != progressStyle.Indeterminate)
+                {
+                    indeterminateImage.URL = progressStyle.Indeterminate;
+                }
             }
         }
 
@@ -547,18 +566,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        private void Initialize()
-        {
-            // create necessary components
-            InitializeTrack();
-            InitializeBuffer();
-            InitializeProgress();
-            InitializeIndeterminate();
-
-            indeterminateAnimation?.Stop();
-            indeterminateAnimation = null;
-        }
-
         private void InitializeTrack()
         {
             if (null == trackImage)
@@ -616,13 +623,16 @@ namespace Tizen.NUI.Components
                 SizePolicy = VisualTransformPolicyType.Relative,
                 Origin = Visual.AlignType.Center,
                 AnchorPoint = Visual.AlignType.Center,
-                Opacity = 1.0f,
+                Opacity = 0.0f,
                 Size = new Size2D(1, 1),
                 URL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "nui_component_default_progress_indeterminate.png"
             };
             AddVisual("Indeterminate", indeterminateImage);
 
-            // TODO : Need to update Style for indeterminate state.
+            if (state == ProgressStatusType.Indeterminate)
+            {
+                indeterminateImage.Opacity = 1.0f;
+            }
         }
     }
 }
index f2d6b3f..c2376e0 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,24 +46,30 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Get or set track image.
+        /// Gets or sets track image.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>
         public ImageViewStyle Track { get; set; } = new ImageViewStyle();
 
         /// <summary>
-        /// Get or set progress image.
+        /// Gets or sets progress image.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>
         public ImageViewStyle Progress { get; set; } = new ImageViewStyle();
 
         /// <summary>
-        /// Get or set buffer image.
+        /// Gets or sets buffer image.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>
         public ImageViewStyle Buffer { get; set; } = new ImageViewStyle();
 
         /// <summary>
+        /// Gets or sets indeterminate progress resource.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Indeterminate { get; set; }
+
+        /// <summary>
         /// Style's clone function.
         /// </summary>
         /// <param name="bindableObject">The style that need to copy.</param>
@@ -77,6 +83,7 @@ namespace Tizen.NUI.Components
                 Track.CopyFrom(progressStyle.Track);
                 Progress.CopyFrom(progressStyle.Progress);
                 Buffer.CopyFrom(progressStyle.Buffer);
+                Indeterminate = progressStyle.Indeterminate;
             }
         }
     }
index 7622397..e6d4ffa 100755 (executable)
@@ -74,7 +74,8 @@ namespace Tizen.NUI.Components
                     .AddSelector("/Progress/Background", (ViewStyle style, Selector<Color> value) => ((ProgressStyle)style).Progress.BackgroundColor = value)
                     .AddSelector("/Track/ResourceUrl", (ViewStyle style, Selector<string> value) => ((ProgressStyle)style).Track.ResourceUrl = value)
                     .AddSelector("/Buffer/ResourceUrl", (ViewStyle style, Selector<string> value) => ((ProgressStyle)style).Buffer.ResourceUrl = value)
-                    .AddSelector("/Progress/ResourceUrl", (ViewStyle style, Selector<string> value) => ((ProgressStyle)style).Progress.ResourceUrl = value),
+                    .AddSelector("/Progress/ResourceUrl", (ViewStyle style, Selector<string> value) => ((ProgressStyle)style).Progress.ResourceUrl = value)
+                    .Add<string>("/Indeterminate", (ViewStyle style, string value) => ((ProgressStyle)style).Indeterminate = value),
 
                 // Slider
                 (new ExternalThemeKeyList(typeof(Slider), typeof(SliderStyle)))
@@ -83,21 +84,21 @@ namespace Tizen.NUI.Components
                     .AddSelector("/Thumb/Background", (ViewStyle style, Selector<Color> value) => ((SliderStyle)style).Thumb.BackgroundColor = value)
                     .AddSelector("/Thumb/ResourceUrl", (ViewStyle style, Selector<string> value) => ((SliderStyle)style).Thumb.ResourceUrl = value)
                     .AddSelector("/ValueIndicatorImage/ResourceUrl", (ViewStyle style, Selector<string> value) => ((SliderStyle)style).ValueIndicatorImage.ResourceUrl = value),
-                
+
                 // Pagination
                 (new ExternalThemeKeyList(typeof(Pagination), typeof(PaginationStyle)))
                     .AddSelector("/IndicatorImageUrl", (ViewStyle style, Selector<string> value) => ((PaginationStyle)style).IndicatorImageUrl = value),
-                
+
                 // Scrollbar
                 (new ExternalThemeKeyList(typeof(Scrollbar), typeof(ScrollbarStyle)))
                     .Add("/TrackColor", (ViewStyle style, Color value) => ((ScrollbarStyle)style).TrackColor = value)
                     .Add("/ThumbColor", (ViewStyle style, Color value) => ((ScrollbarStyle)style).ThumbColor = value),
-                
+
                 // RecyclerViewItem
                 (new ExternalThemeKeyList(typeof(RecyclerViewItem), typeof(RecyclerViewItemStyle)))
                     .AddBackgroundSelector("/Background", SetBackgroundColor, SetBackgroundImage, ControlState.Selected)
                     .Add<Rectangle>("/BackgroundImageBorder", SetBackgroundBorder),
-                
+
                 // DefaultTitleItem
                 (new ExternalThemeKeyList(typeof(DefaultTitleItem), typeof(DefaultTitleItemStyle)))
                     .AddBackgroundSelector("/Background", SetBackgroundColor, SetBackgroundImage)
index bf2a089..0dbfc0e 100755 (executable)
@@ -132,6 +132,7 @@ namespace Tizen.NUI.Components
                 {
                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
                 },
+                Indeterminate = FrameworkInformation.ResourcePath + "nui_component_default_progress_indeterminate.png",
             });
 
             theme.AddStyleWithoutClone("Tizen.NUI.Components.RadioButton", new ButtonStyle()
diff --git a/src/Tizen.NUI.Components/res/IoT_progress_indeterminate.png b/src/Tizen.NUI.Components/res/IoT_progress_indeterminate.png
new file mode 100755 (executable)
index 0000000..f5a6ff0
Binary files /dev/null and b/src/Tizen.NUI.Components/res/IoT_progress_indeterminate.png differ
index f5a6ff0..df99c15 100755 (executable)
Binary files a/src/Tizen.NUI.Components/res/nui_component_default_progress_indeterminate.png and b/src/Tizen.NUI.Components/res/nui_component_default_progress_indeterminate.png differ
index 2ed312e..291fe4c 100755 (executable)
@@ -6,9 +6,9 @@ namespace Tizen.NUI.Samples
 {
     public class ProgressSample : IExample
     {
-        private TextLabel[] board = new TextLabel[3];
+        private TextLabel[] board = new TextLabel[4];
         private Button[] button = new Button[2];
-        private Progress[] progressBar = new Progress[3];
+        private Progress[] progressBar = new Progress[4];
         private View[] layout = new View[4];
 
         public void Activate()
@@ -67,6 +67,7 @@ namespace Tizen.NUI.Samples
 
             CreatePropElements();
             CreateAttrElements();
+            CreateIndeterminateProgress();
             layout[1].Add(layout[2]);
             layout[1].Add(layout[3]);
 
@@ -188,6 +189,28 @@ namespace Tizen.NUI.Samples
             layout[3].Add(progressBar[2]);
         }
 
+        private void CreateIndeterminateProgress()
+        {
+            board[3] = new TextLabel();
+            board[3].WidthSpecification = 380;
+            board[3].HeightSpecification = 70;
+            board[3].PointSize = 20;
+            board[3].HorizontalAlignment = HorizontalAlignment.Center;
+            board[3].VerticalAlignment = VerticalAlignment.Center;
+            board[3].BackgroundColor = Color.Magenta;
+            board[3].Text = "Indeterminate Progress";
+            layout[3].Add(board[3]);
+            board[3].Focusable = true;
+            board[3].FocusGained += Board_FocusGained; // Not sure to connect this event
+            board[3].FocusLost += Board_FocusLost;
+
+            progressBar[3] = new Progress();
+            progressBar[3].WidthSpecification = 240;
+            progressBar[3].HeightSpecification = 4;
+            progressBar[3].ProgressState = Progress.ProgressStatusType.Indeterminate;
+            layout[3].Add(progressBar[3]);
+        }
+
         private void Board_FocusLost(object sender, global::System.EventArgs e)
         {
             board[0].BackgroundColor = Color.Magenta;