providerImage.Show();
int propertyCount = transition.AnimationDataList.Count;
animation = new Animation(transition.DurationMilliSeconds+80);
- animation.Properties = new string[propertyCount];
- animation.DestValue = new string[propertyCount];
- animation.StartTime = new int[propertyCount];
- animation.EndTime = new int[propertyCount];
for (int i = 0; i < propertyCount; i++)
{
- animation.Properties[i] = transition.AnimationDataList[i].Property;
- animation.DestValue[i] = transition.AnimationDataList[i].DestinationValue;
- animation.StartTime[i] = 80+transition.AnimationDataList[i].StartTime;
- animation.EndTime[i] = 80+transition.AnimationDataList[i].EndTime;
+ animation.PropertyList.Add(transition.AnimationDataList[i].Property);
+ animation.DestValueList.Add(transition.AnimationDataList[i].DestinationValue);
+ animation.StartTimeList.Add(80 +transition.AnimationDataList[i].StartTime);
+ animation.EndTimeList.Add(80 +transition.AnimationDataList[i].EndTime);
}
animation.PlayAnimateTo(providerImage);
animation.Finished += Ani_Finished;
using Tizen.NUI.Binding;
using System.Globalization;
using Tizen.NUI.Xaml.Internals;
+ using System.Diagnostics.CodeAnalysis;
/// <summary>
/// Animation can be used to animate the properties of any number of objects, typically view.<br />
private int[] _startTime = null;
private int[] _endTime = null;
+ private List<string> propertyList = null;
+ private List<string> destValueList = null;
+ private List<int> startTimeList = null;
+ private List<int> endTimeList = null;
+
/// <summary>
/// Creates an initialized animation.<br />
/// The animation will not loop.<br />
/// <summary>
/// Gets or sets the properties of the animation.
/// </summary>
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use PropertyList instead")]
+ [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public string[] Properties
{
get
/// <summary>
/// Gets or sets the destination value for each property of the animation.
/// </summary>
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use DestValueList instead")]
+ [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public string[] DestValue
{
get
/// <summary>
/// Gets or sets the start time for each property of the animation.
/// </summary>
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use StartTimeList instead")]
+ [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public int[] StartTime
{
get
/// <summary>
/// Gets or sets the end time for each property of the animation.
/// </summary>
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use EndTimeList instead")]
+ [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public int[] EndTime
{
get
}
}
+ /// <summary>
+ /// Get the list of the properties of the animation.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<string> PropertyList
+ {
+ get
+ {
+ if (null == propertyList)
+ {
+ propertyList = new List<string>();
+ }
+
+ return propertyList;
+ }
+ }
+
+ /// <summary>
+ /// Get the list of the destination value for each property of the animation.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<string> DestValueList
+ {
+ get
+ {
+ if (null == destValueList)
+ {
+ destValueList = new List<string>();
+ }
+
+ return destValueList;
+ }
+ }
+
+ /// <summary>
+ /// Get the list of the start time for each property of the animation.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<int> StartTimeList
+ {
+ get
+ {
+ if (null == startTimeList)
+ {
+ startTimeList = new List<int>();
+ }
+
+ return startTimeList;
+ }
+ }
+
+ /// <summary>
+ /// Get the list of end time for each property of the animation.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<int> EndTimeList
+ {
+ get
+ {
+ if (null == endTimeList)
+ {
+ endTimeList = new List<int>();
+ }
+
+ return endTimeList;
+ }
+ }
+
private bool DisableAnimation
{
get
}
Clear();
- if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
+
+ if (null != propertyList && null != destValueList && null != startTimeList && null != endTimeList)
{
- int length = _properties.Length;
- for (int index = 0; index < length; index++)
+ if (propertyList.Count == destValueList.Count
+ &&
+ startTimeList.Count == endTimeList.Count
+ &&
+ propertyList.Count == startTimeList.Count)
{
- //object destinationValue = _destValue[index];
- var elementType = target.GetType();
- PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
- //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
- if (propertyInfo != null)
+ int count = propertyList.Count;
+ for (int index = 0; index < count; index++)
{
- object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
+ var elementType = target.GetType();
+ PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == propertyList[index]);
- if (destinationValue != null)
+ if (propertyInfo != null)
{
- AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
+ object destinationValue = ConvertTo(destValueList[index], propertyInfo.PropertyType);
+
+ if (destinationValue != null)
+ {
+ AnimateTo(target, propertyList[index], destinationValue, startTimeList[index], endTimeList[index]);
+ }
+ }
+ }
+ Play();
+ }
+ }
+ else
+ {
+ if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
+ {
+ int length = _properties.Length;
+ for (int index = 0; index < length; index++)
+ {
+ //object destinationValue = _destValue[index];
+ var elementType = target.GetType();
+ PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
+ //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
+ if (propertyInfo != null)
+ {
+ object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
+
+ if (destinationValue != null)
+ {
+ AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
+ }
}
}
+ Play();
}
- Play();
}
}
private float weight = 0.0f; // Weighting of child View in a Layout
private bool backgroundImageSynchronosLoading = false;
private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
- private string[] transitionNames;
private bool controlStatePropagation = false;
private ViewStyle viewStyle;
private bool themeChangeSensitive = false;
}
}
- /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string[] TransitionNames
- {
- get
- {
- return transitionNames;
- }
- set
- {
- transitionNames = value;
- LoadTransitions();
- }
- }
-
/// <summary>
/// Enable/Disable ControlState propagation for children.
/// It is false by default.
}
}
}
+
+ /// <summary>
+ /// Used to restore the transition.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<Transition> TransitionList
+ {
+ get;
+ } = new List<Transition>();
}
}
return view;
}
- private void LoadTransitions()
- {
- foreach (string str in transitionNames)
- {
- string resourceName = str + ".xaml";
- Transition trans = null;
-
- string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
-
- string likelyResourcePath = resource + "animation/" + resourceName;
-
- if (File.Exists(likelyResourcePath))
- {
- trans = Xaml.Extensions.LoadObject<Transition>(likelyResourcePath);
- }
- if (trans != null)
- {
- transDictionary.Add(trans.Name, trans);
- }
- }
- }
-
private void OnScaleChanged(float x, float y, float z)
{
Scale = new Vector3(x, y, z);
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
namespace Tizen.NUI
{
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public class AnimationBehavior
{
private string _key = null;
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string Key
{
private string _property = null;
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string Property
{
private string _destValue = null;
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string DestValue
{
private int _startTime = -1;
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public int StartTime
{
private int _endTime = -1;
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public int EndTime
{
}
}
+
+ /// <summary>
+ /// It is the container to contain the behaviors of Transition.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class BehaviorContainer : List<AnimationBehavior>
+ {
+ private Dictionary<string, AnimationBehavior> behaviors = new Dictionary<string, AnimationBehavior>();
+
+ /// <summary>
+ /// The method for user to add behavior.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Add(object obj)
+ {
+ var behavior = obj as AnimationBehavior;
+
+ if (null != behavior)
+ {
+ behaviors.Add(behavior.Key, behavior);
+ }
+ }
+
+ /// <summary>
+ /// The method for user to get the behavior by the key.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public AnimationBehavior GetAnimationBehavior(string key)
+ {
+ AnimationBehavior behavior = null;
+ behaviors.TryGetValue(key, out behavior);
+
+ return behavior;
+ }
+ }
+
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public class Transition : Animation
{
private string name;
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string Name
{
}
}
- private Dictionary<string, AnimationBehavior> behaviors = new Dictionary<string, AnimationBehavior>();
-
- /// <summary>
- /// Hidden-API (Inhouse-API).
- /// Convert previous "public AnimationBehavior[] Behaviors" property to method.
- /// </summary>
- /// <param name="Behaviors">Array of AnimationBehavior type</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SetBehaviors(AnimationBehavior[] Behaviors)
- {
- if (null != Behaviors)
- {
- foreach (AnimationBehavior behavior in Behaviors)
- {
- behaviors.Add(behavior.Key, behavior);
- }
- }
- }
-
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void AnimateTo(View instance, string behaviorKey)
{
- AnimationBehavior behavior = null;
- behaviors.TryGetValue(behaviorKey, out behavior);
+ AnimationBehavior behavior = Behaviors?.GetAnimationBehavior(behaviorKey);
if (null != instance && null != behavior)
{
}
/// <since_tizen> 5 </since_tizen>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void AnimateBy(View instance, string behaviorKey)
{
- AnimationBehavior behavior = null;
- behaviors.TryGetValue(behaviorKey, out behavior);
+ AnimationBehavior behavior = Behaviors?.GetAnimationBehavior(behaviorKey);
if (null != instance && null != behavior)
{
throw new XamlParseException(string.Format("Behaviors don't have key {0}", behaviorKey), new XmlLineInfo());
}
}
+
+ /// <since_tizen> 5 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BehaviorContainer Behaviors
+ {
+ get;
+ } = new BehaviorContainer();
}
}