Animatable TextColor Property for TextLabel 68/141168/8
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 28 Jul 2017 09:53:26 +0000 (10:53 +0100)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Tue, 8 Aug 2017 12:26:43 +0000 (13:26 +0100)
Change-Id: I593c4621a177feeaffbc71ab551d94a75164515c

NUISamples/NUISamples/NUISamples.TizenTV/examples/text-test.cs
Tizen.NUI/src/internal/NDalicPINVOKE.cs
Tizen.NUI/src/public/BaseComponents/TextLabel.cs

index fa509f3..69e442a 100755 (executable)
@@ -26,6 +26,9 @@ namespace TextTest
 {
     class Example : NUIApplication
     {
+        TextLabel _pointLabel;
+        Boolean _colorToggle;
+
         public Example() : base()
         {
         }
@@ -44,6 +47,27 @@ namespace TextTest
             Initialize();
         }
 
+        private bool LabelTouched(object sender, View.TouchEventArgs e)
+        {
+            if (e.Touch.GetState(0) == PointStateType.Down)
+            {
+                Animation textColorAnimation = new Animation(1000);
+                if (_colorToggle)
+                {
+                    textColorAnimation.AnimateTo(_pointLabel, "TextColorAnimatable", Color.Blue );
+                    _colorToggle = false;
+                }
+                else
+                {
+                     textColorAnimation.AnimateTo(_pointLabel, "TextColorAnimatable", Color.Green );
+                    _colorToggle = true;
+                }
+                textColorAnimation.Play();
+            }
+            return true;
+        }
+
+
         public void Initialize()
         {
             Window window = Window.Instance;
@@ -55,11 +79,16 @@ namespace TextTest
             pixelLabel.BackgroundColor = Color.Magenta;
             window.Add(pixelLabel);
 
-            TextLabel pointLabel = new TextLabel("Test Point Size 32.0f");
-            pointLabel.Position2D = new Position2D(10, 100);
-            pointLabel.PointSize = 32.0f;
-            pointLabel.BackgroundColor = Color.Red;
-            window.Add(pointLabel);
+            _pointLabel = new TextLabel("Test Point Size 32.0f");
+            _pointLabel.Position2D = new Position2D(10, 100);
+            _pointLabel.PointSize = 32.0f;
+            _pointLabel.BackgroundColor = Color.Red;
+            _pointLabel.TextColorAnimatable = Color.Green; // Set initial text color using animatable property
+            _pointLabel.TouchEvent += LabelTouched;
+            _colorToggle = true;
+
+            window.Add(_pointLabel);
+
 
             TextLabel ellipsis = new TextLabel("Ellipsis of TextLabel is enabled.");
             ellipsis.Size2D = new Size2D(100, 80);
@@ -145,4 +174,4 @@ namespace TextTest
             example.Run(args);
         }
     }
-}
+}
\ No newline at end of file
index 6e3640e..1939974 100755 (executable)
@@ -9281,6 +9281,9 @@ class NDalicPINVOKE {
   [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_TEXT_COLOR_get")]
   public static extern int TextLabel_Property_TEXT_COLOR_get();
 
+  [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_TEXT_COLOR_ANIMATABLE_get")]
+  public static extern int TextLabel_Property_TEXT_COLOR_ANIMATABLE_get();
+
   [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_SHADOW_OFFSET_get")]
   public static extern int TextLabel_Property_SHADOW_OFFSET_get();
 
index b4045b5..0339ac0 100755 (executable)
@@ -101,6 +101,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int ELLIPSIS = NDalicManualPINVOKE.TextLabel_Property_ELLIPSIS_get();
             internal static readonly int AUTO_SCROLL_STOP_MODE = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get();
             internal static readonly int AUTO_SCROLL_LOOP_DELAY = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
+            internal static readonly int TEXT_COLOR_ANIMATABLE = NDalicPINVOKE.TextLabel_Property_TEXT_COLOR_ANIMATABLE_get();
 
         }
 
@@ -708,5 +709,24 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// TextColorAnimatable property.<br>
+        /// The color of the text that can be animatated.<br>
+        /// Animation framework can be used to change the color of the text when not using mark up.<br>
+        /// Not possible when text is auto scrolling. <br>
+        /// </summary>
+        public Color TextColorAnimatable
+        {
+            get
+            {
+                Color animatableColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
+                GetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE).Get(animatableColor);
+                return animatableColor;
+            }
+            set
+            {
+                SetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE, new Tizen.NUI.PropertyValue(value));
+            }
+        }
     }
 }