[NUI] Fix wearable style issues (#1847)
authorJiyun Yang <ji.yang@samsung.com>
Wed, 22 Jul 2020 04:30:04 +0000 (13:30 +0900)
committerGitHub <noreply@github.com>
Wed, 22 Jul 2020 04:30:04 +0000 (13:30 +0900)
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
src/Tizen.NUI.Wearable/src/public/CircularProgress.cs
src/Tizen.NUI.Wearable/src/public/CircularScrollbar.cs
src/Tizen.NUI.Wearable/src/public/CircularSlider.cs

index c302013..8402209 100755 (executable)
@@ -36,12 +36,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(float), typeof(CircularProgress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = ((CircularProgress)bindable);
+            instance.CurrentStyle.Thickness = (float)newValue;
             instance.UpdateVisualThickness((float)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (CircularProgress)bindable;
-            return instance.trackVisual == null ? 0 : instance.trackVisual.Thickness;
+            return ((CircularProgress)bindable).CurrentStyle.Thickness;
         });
 
         /// <summary>Bindable property of MaxValue</summary>
@@ -104,11 +104,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(CircularProgress), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (CircularProgress)bindable;
+            instance.CurrentStyle.TrackColor = (Color)newValue;
             instance.UpdateTrackVisualColor((Color)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((CircularProgress)bindable).trackVisual?.MixColor;
+            return ((CircularProgress)bindable).CurrentStyle.TrackColor;
         });
 
         /// <summary>Bindable property of ProgressColor</summary>
@@ -116,11 +117,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty ProgressColorProperty = BindableProperty.Create(nameof(ProgressColor), typeof(Color), typeof(CircularProgress), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (CircularProgress)bindable;
+            instance.CurrentStyle.ProgressColor = (Color)newValue;
             instance.UpdateProgressVisualColor((Color)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((CircularProgress)bindable).progressVisual?.MixColor;
+            return ((CircularProgress)bindable).CurrentStyle.ProgressColor;
         });
 
         /// <summary>Bindable property of IsEnabled</summary>
@@ -358,6 +360,8 @@ namespace Tizen.NUI.Wearable
             }
         }
 
+        private CircularProgressStyle CurrentStyle => ViewStyle as CircularProgressStyle;
+
         #endregion Properties
 
 
index 656fe7e..747f479 100644 (file)
@@ -36,12 +36,14 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(float), typeof(CircularScrollbar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = ((CircularScrollbar)bindable);
-            instance.UpdateVisualThickness((float?)newValue ?? 0);
+            float value = (float?)newValue ?? 0;
+            instance.CurrentStyle.Thickness = value;
+            instance.UpdateVisualThickness(value);
         },
         defaultValueCreator: (bindable) =>
         {
             var instance = (CircularScrollbar)bindable;
-            return instance.trackVisual == null ? 0 : instance.trackVisual.Thickness;
+            return instance.CurrentStyle.Thickness ?? 0;
         });
 
         /// <summary>Bindable property of TrackSweepAngle</summary>
@@ -49,12 +51,14 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty TrackSweepAngleProperty = BindableProperty.Create(nameof(TrackSweepAngle), typeof(float), typeof(CircularScrollbar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = ((CircularScrollbar)bindable);
-            instance.UpdateTrackVisualSweepAngle((float?)newValue ?? 0);
+            float value = (float?)newValue ?? 0;
+            instance.CurrentStyle.TrackSweepAngle = value;
+            instance.UpdateTrackVisualSweepAngle(value);
         },
         defaultValueCreator: (bindable) =>
         {
             var instance = (CircularScrollbar)bindable;
-            return instance.trackVisual == null ? 0 : instance.trackVisual.SweepAngle;
+            return instance.CurrentStyle.TrackSweepAngle ?? 0;
         });
 
         /// <summary>Bindable property of TrackColor</summary>
@@ -62,11 +66,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(CircularScrollbar), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = ((CircularScrollbar)bindable);
+            instance.CurrentStyle.TrackColor = (Color)newValue;
             instance.UpdateTrackVisualColor((Color)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((CircularScrollbar)bindable).trackVisual?.MixColor;
+            return ((CircularScrollbar)bindable).CurrentStyle.TrackColor;
         });
 
         /// <summary>Bindable property of ThumbColor</summary>
@@ -74,11 +79,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(CircularScrollbar), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = ((CircularScrollbar)bindable);
+            instance.CurrentStyle.ThumbColor = (Color)newValue;
             instance.UpdateThumbVisualColor((Color)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((CircularScrollbar)bindable).thumbVisual?.MixColor;
+            return ((CircularScrollbar)bindable).CurrentStyle.ThumbColor;
         });
 
         private ArcVisual trackVisual;
@@ -145,7 +151,7 @@ namespace Tizen.NUI.Wearable
         /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
         /// </remarks>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public new CircularScrollbarStyle Style
+        public CircularScrollbarStyle Style
         {
             get
             {
@@ -199,6 +205,8 @@ namespace Tizen.NUI.Wearable
             set => SetValue(ThumbColorProperty, value);
         }
 
+        private CircularScrollbarStyle CurrentStyle => ViewStyle as CircularScrollbarStyle;
+
         #endregion Properties
 
 
index d7bece1..792ff52 100755 (executable)
@@ -55,12 +55,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(float), typeof(CircularSlider), default(float), propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = ((CircularSlider)bindable);
+            instance.CurrentStyle.Thickness = (float)newValue;
             instance.UpdateVisualThickness((float)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (CircularSlider)bindable;
-            return instance.trackVisual == null ? 0 : instance.trackVisual.Thickness;
+            return ((CircularSlider)bindable).CurrentStyle.Thickness;
         });
 
         /// <summary>Bindable property of MaxValue</summary>
@@ -123,11 +123,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(CircularSlider), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (CircularSlider)bindable;
+            instance.CurrentStyle.TrackColor = (Color)newValue;
             instance.UpdateTrackVisualColor((Color)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((CircularSlider)bindable).trackVisual?.MixColor;
+            return ((CircularSlider)bindable).CurrentStyle.TrackColor;
         });
 
         /// <summary>Bindable property of ProgressColor</summary>
@@ -135,11 +136,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty ProgressColorProperty = BindableProperty.Create(nameof(ProgressColor), typeof(Color), typeof(CircularSlider), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (CircularSlider)bindable;
+            instance.CurrentStyle.ProgressColor = (Color)newValue;
             instance.UpdateProgressVisualColor((Color)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((CircularSlider)bindable).progressVisual?.MixColor;
+            return ((CircularSlider)bindable).CurrentStyle.ProgressColor;
         });
 
         /// <summary>Bindable property of ThumbSize</summary>
@@ -164,11 +166,12 @@ namespace Tizen.NUI.Wearable
         public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(CircularSlider), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (CircularSlider)bindable;
+            instance.CurrentStyle.ThumbColor = (Color)newValue;
             instance.UpdateThumbVisualColor((Color)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((CircularSlider)bindable).thumbVisual?.MixColor;
+            return ((CircularSlider)bindable).CurrentStyle.ThumbColor;
         });
 
         /// <summary>Bindable property of IsEnabled</summary>
@@ -437,6 +440,8 @@ namespace Tizen.NUI.Wearable
             }
         }
 
+        private CircularSliderStyle CurrentStyle => ViewStyle as CircularSliderStyle;
+
         #endregion Properties