@@ -47,11 +47,11 @@ export class RootLayout extends RootLayoutBase {
47
47
48
48
if ( nativeView ) {
49
49
nativeView . setAlpha ( options . opacity ) ;
50
- org . nativescript . widgets . ViewHelper . setScaleX ( nativeView , float ( options . scaleX ) ) ;
51
- org . nativescript . widgets . ViewHelper . setScaleY ( nativeView , float ( options . scaleY ) ) ;
52
- org . nativescript . widgets . ViewHelper . setTranslateX ( nativeView , layout . toDevicePixels ( options . translateX ) ) ;
53
- org . nativescript . widgets . ViewHelper . setTranslateY ( nativeView , layout . toDevicePixels ( options . translateY ) ) ;
54
- org . nativescript . widgets . ViewHelper . setRotate ( nativeView , float ( options . rotate ) ) ;
50
+ nativeView . setScaleX ( float ( options . scaleX ) ) ;
51
+ nativeView . setScaleY ( float ( options . scaleY ) ) ;
52
+ nativeView . setTranslationX ( layout . toDevicePixels ( options . translateX ) ) ;
53
+ nativeView . setTranslationY ( layout . toDevicePixels ( options . translateY ) ) ;
54
+ nativeView . setRotation ( float ( options . rotate ) ) ;
55
55
}
56
56
}
57
57
@@ -61,6 +61,19 @@ export class RootLayout extends RootLayoutBase {
61
61
...shadeOptions ,
62
62
} ;
63
63
const duration = options . animation ?. enterFrom ?. duration || defaultShadeCoverOptions . animation . enterFrom . duration ;
64
+ const isBackgroundGradient = options . color && options . color . startsWith ( 'linear-gradient' ) ;
65
+
66
+ if ( isBackgroundGradient ) {
67
+ if ( view . backgroundColor ) {
68
+ view . backgroundColor = undefined ;
69
+ }
70
+ const parsedGradient = parseLinearGradient ( options . color ) ;
71
+ view . backgroundImage = LinearGradient . parse ( parsedGradient . value ) ;
72
+ } else {
73
+ if ( view . backgroundImage ) {
74
+ view . backgroundImage = undefined ;
75
+ }
76
+ }
64
77
65
78
return this . _playAnimation (
66
79
this . _getAnimationSet (
@@ -73,7 +86,7 @@ export class RootLayout extends RootLayoutBase {
73
86
rotate : 0 ,
74
87
opacity : options . opacity ,
75
88
} ,
76
- options . color ,
89
+ isBackgroundGradient ? null : options . color ,
77
90
) ,
78
91
duration ,
79
92
) ;
@@ -88,30 +101,16 @@ export class RootLayout extends RootLayoutBase {
88
101
}
89
102
90
103
private _getAnimationSet ( view : View , shadeCoverAnimation : TransitionAnimation , backgroundColor ?: string ) : Array < android . animation . Animator > {
91
- const isBackgroundGradient = backgroundColor && backgroundColor . startsWith ( 'linear-gradient' ) ;
92
-
93
- const animationSet = Array . create ( android . animation . Animator , ! backgroundColor || isBackgroundGradient ? 6 : 7 ) ;
94
- animationSet [ 0 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'translationX' , [ shadeCoverAnimation . translateX ] ) ;
95
- animationSet [ 1 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'translationY' , [ shadeCoverAnimation . translateY ] ) ;
104
+ const animationSet = Array . create ( android . animation . Animator , backgroundColor ? 7 : 6 ) ;
105
+ animationSet [ 0 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'translationX' , [ layout . toDevicePixels ( shadeCoverAnimation . translateX ) ] ) ;
106
+ animationSet [ 1 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'translationY' , [ layout . toDevicePixels ( shadeCoverAnimation . translateY ) ] ) ;
96
107
animationSet [ 2 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'scaleX' , [ shadeCoverAnimation . scaleX ] ) ;
97
108
animationSet [ 3 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'scaleY' , [ shadeCoverAnimation . scaleY ] ) ;
98
109
animationSet [ 4 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'rotation' , [ shadeCoverAnimation . rotate ] ) ;
99
110
animationSet [ 5 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'alpha' , [ shadeCoverAnimation . opacity ] ) ;
100
111
101
- if ( isBackgroundGradient ) {
102
- if ( view . backgroundColor ) {
103
- view . backgroundColor = undefined ;
104
- }
105
- const parsedGradient = parseLinearGradient ( backgroundColor ) ;
106
- view . backgroundImage = LinearGradient . parse ( parsedGradient . value ) ;
107
- } else {
108
- if ( view . backgroundImage ) {
109
- view . backgroundImage = undefined ;
110
- }
111
-
112
- if ( backgroundColor ) {
113
- animationSet [ 6 ] = this . _getBackgroundColorAnimator ( view , backgroundColor ) ;
114
- }
112
+ if ( backgroundColor ) {
113
+ animationSet [ 6 ] = this . _getBackgroundColorAnimator ( view , backgroundColor ) ;
115
114
}
116
115
return animationSet ;
117
116
}
0 commit comments