| 106 | } |
| 107 | |
| 108 | export class Animation extends AnimationBase { |
| 109 | private _animatorListener: android.animation.Animator.AnimatorListener; |
| 110 | private _nativeAnimatorsArray: any; |
| 111 | private _animatorSet: android.animation.AnimatorSet; |
| 112 | private _animators: Array<android.animation.Animator>; |
| 113 | private _propertyUpdateCallbacks: Array<Function>; |
| 114 | private _propertyResetCallbacks: Array<Function>; |
| 115 | private _valueSource: 'animation' | 'keyframe'; |
| 116 | private _target: View; |
| 117 | private _resetOnFinish = true; |
| 118 | |
| 119 | constructor(animationDefinitions: Array<AnimationDefinitionInternal>, playSequentially?: boolean) { |
| 120 | super(animationDefinitions, playSequentially); |
| 121 | |
| 122 | this._valueSource = 'animation'; |
| 123 | if (animationDefinitions.length > 0 && animationDefinitions[0].valueSource !== undefined) { |
| 124 | this._valueSource = animationDefinitions[0].valueSource; |
| 125 | } |
| 126 | |
| 127 | const that = new WeakRef(this); |
| 128 | this._animatorListener = new android.animation.Animator.AnimatorListener({ |
| 129 | onAnimationStart: function (animator: android.animation.Animator): void { |
| 130 | if (Trace.isEnabled()) { |
| 131 | Trace.write('MainAnimatorListener.onAndroidAnimationStart(' + animator + ')', Trace.categories.Animation); |
| 132 | } |
| 133 | }, |
| 134 | onAnimationRepeat: function (animator: android.animation.Animator): void { |
| 135 | if (Trace.isEnabled()) { |
| 136 | Trace.write('MainAnimatorListener.onAnimationRepeat(' + animator + ')', Trace.categories.Animation); |
| 137 | } |
| 138 | }, |
| 139 | onAnimationEnd: function (animator: android.animation.Animator): void { |
| 140 | if (Trace.isEnabled()) { |
| 141 | Trace.write('MainAnimatorListener.onAnimationEnd(' + animator + ')', Trace.categories.Animation); |
| 142 | } |
| 143 | const thisRef = that?.get(); |
| 144 | if (thisRef) { |
| 145 | thisRef._onAndroidAnimationEnd(); |
| 146 | } |
| 147 | }, |
| 148 | onAnimationCancel: function (animator: android.animation.Animator): void { |
| 149 | if (Trace.isEnabled()) { |
| 150 | Trace.write('MainAnimatorListener.onAnimationCancel(' + animator + ')', Trace.categories.Animation); |
| 151 | } |
| 152 | const thisRef = that?.get(); |
| 153 | if (thisRef) { |
| 154 | thisRef._onAndroidAnimationCancel(); |
| 155 | } |
| 156 | }, |
| 157 | }); |
| 158 | } |
| 159 | |
| 160 | public play(resetOnFinish?: boolean): AnimationPromise { |
| 161 | if (resetOnFinish !== undefined) { |
| 162 | this._resetOnFinish = resetOnFinish; |
| 163 | } |
| 164 | |
| 165 | if (this.isPlaying) { |
nothing calls this directly
no outgoing calls
no test coverage detected