From: Agnelo Vaz Date: Fri, 28 Jul 2017 09:53:26 +0000 (+0100) Subject: Animatable TextColor Property for TextLabel X-Git-Tag: accepted/tizen/4.0/unified/20170828.223314~43^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=718152657ea03b6bb2d10dbb2307b5103dce270d;p=platform%2Fcore%2Fcsapi%2Fnui.git Animatable TextColor Property for TextLabel Change-Id: I593c4621a177feeaffbc71ab551d94a75164515c --- diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/text-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/text-test.cs index fa509f3..69e442a 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/text-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/text-test.cs @@ -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 diff --git a/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/Tizen.NUI/src/internal/NDalicPINVOKE.cs index 6e3640e..1939974 100755 --- a/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -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(); diff --git a/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index b4045b5..0339ac0 100755 --- a/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -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 } } + /// + /// TextColorAnimatable property.
+ /// The color of the text that can be animatated.
+ /// Animation framework can be used to change the color of the text when not using mark up.
+ /// Not possible when text is auto scrolling.
+ ///
+ 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)); + } + } } }