Fixed: animations crash on Android

This commit is contained in:
Tsvetan Raikov
2016-04-12 14:29:46 +03:00
parent a61dffa3a3
commit df2ad08773
2 changed files with 15 additions and 8 deletions

View File

@ -34,7 +34,7 @@ export class Animation extends common.Animation implements definition.Animation
private _valueSource: number;
public play(): definition.AnimationPromise {
var animationFinishedPromise = super.play();
let animationFinishedPromise = super.play();
let i: number;
let length: number;
@ -58,11 +58,13 @@ export class Animation extends common.Animation implements definition.Animation
this._animatorSet = new android.animation.AnimatorSet();
this._animatorSet.addListener(this._animatorListener);
if (this._playSequentially) {
this._animatorSet.playSequentially(this._nativeAnimatorsArray);
}
else {
this._animatorSet.playTogether(this._nativeAnimatorsArray);
if (length > 0) {
if (this._playSequentially) {
this._animatorSet.playSequentially(this._nativeAnimatorsArray);
}
else {
this._animatorSet.playTogether(this._nativeAnimatorsArray);
}
}
trace.write("Starting " + this._nativeAnimatorsArray.length + " animations " + (this._playSequentially ? "sequentially." : "together."), trace.categories.Animation);
@ -127,6 +129,11 @@ export class Animation extends common.Animation implements definition.Animation
}
private _createAnimators(propertyAnimation: common.PropertyAnimation): void {
if (!propertyAnimation.target._nativeView) {
return;
}
trace.write("Creating ObjectAnimator(s) for animation: " + common.Animation._getAnimationInfo(propertyAnimation) + "...", trace.categories.Animation);
if (types.isNullOrUndefined(propertyAnimation.target)) {

View File

@ -88,7 +88,7 @@ export class CssSelector {
}
}
});
if (this.animations && view.isLoaded) {
if (this.animations && view.isLoaded && view._nativeView !== undefined) {
for (let animationInfo of this.animations) {
let animation = keyframeAnimation.KeyframeAnimation.keyframeAnimationFromInfo(animationInfo, modifier);
if (animation) {