From 92d015b8d891b8d48e5831e5cab6e5a1b0b51bf3 Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Thu, 6 Apr 2017 14:50:40 +0300 Subject: [PATCH] Animations were always played as keyframes and kept overriding the local values. Android setAlpha has deprecated int overload, now it is guided to use the float one. Android background color was animated using css values instead of local or the keyframe one. --- tns-core-modules/ui/animation/animation.android.ts | 3 ++- tns-core-modules/ui/animation/animation.ios.ts | 1 + tns-core-modules/ui/core/view/view.android.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/ui/animation/animation.android.ts b/tns-core-modules/ui/animation/animation.android.ts index 08e538cd4..13c55e9dd 100644 --- a/tns-core-modules/ui/animation/animation.android.ts +++ b/tns-core-modules/ui/animation/animation.android.ts @@ -92,6 +92,7 @@ export class Animation extends AnimationBase { constructor(animationDefinitions: Array, playSequentially?: boolean) { super(animationDefinitions, playSequentially); + this._valueSource = "animation"; if (animationDefinitions.length > 0 && animationDefinitions[0].valueSource !== undefined) { this._valueSource = animationDefinitions[0].valueSource; } @@ -275,7 +276,7 @@ export class Animation extends AnimationBase { animator.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener({ onAnimationUpdate(animator: android.animation.ValueAnimator) { let argb = (animator.getAnimatedValue()).intValue(); - propertyAnimation.target.style[backgroundColorProperty.cssName] = new Color(argb); + propertyAnimation.target.style[setLocal ? backgroundColorProperty.name : backgroundColorProperty.keyframe] = new Color(argb); } })); diff --git a/tns-core-modules/ui/animation/animation.ios.ts b/tns-core-modules/ui/animation/animation.ios.ts index 74346d4a6..e54c66912 100644 --- a/tns-core-modules/ui/animation/animation.ios.ts +++ b/tns-core-modules/ui/animation/animation.ios.ts @@ -153,6 +153,7 @@ export class Animation extends AnimationBase { constructor(animationDefinitions: Array, playSequentially?: boolean) { super(animationDefinitions, playSequentially); + this._valueSource = "animation"; if (animationDefinitions.length > 0 && animationDefinitions[0].valueSource !== undefined) { this._valueSource = animationDefinitions[0].valueSource; } diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index e746e5f99..3372762b9 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -339,7 +339,7 @@ export class View extends ViewCommon { return this.nativeView.getAlpha(); } [opacityProperty.setNative](value: number) { - this.nativeView.setAlpha(value); + this.nativeView.setAlpha(float(value)); } [horizontalAlignmentProperty.getDefault](): HorizontalAlignment {