@@ -2,6 +2,8 @@ import { Color } from '../../../color';
2
2
import { View } from '../../core/view' ;
3
3
import { RootLayoutBase , defaultShadeCoverOptions } from './root-layout-common' ;
4
4
import { TransitionAnimation , ShadeCoverOptions } from '.' ;
5
+ import { parseLinearGradient } from '../../../css/parser' ;
6
+ import { LinearGradient } from '../../styling/linear-gradient' ;
5
7
6
8
export * from './root-layout-common' ;
7
9
@@ -74,14 +76,28 @@ export class RootLayout extends RootLayoutBase {
74
76
}
75
77
76
78
private _getAnimationSet ( view : View , shadeCoverAnimation : TransitionAnimation , backgroundColor : string = defaultShadeCoverOptions . color ) : Array < android . animation . Animator > {
77
- const animationSet = Array . create ( android . animation . Animator , 7 ) ;
79
+ const backgroundIsGradient = backgroundColor . startsWith ( 'linear-gradient' ) ;
80
+
81
+ const animationSet = Array . create ( android . animation . Animator , backgroundIsGradient ? 6 : 7 ) ;
78
82
animationSet [ 0 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'translationX' , [ shadeCoverAnimation . translateX ] ) ;
79
83
animationSet [ 1 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'translationY' , [ shadeCoverAnimation . translateY ] ) ;
80
84
animationSet [ 2 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'scaleX' , [ shadeCoverAnimation . scaleX ] ) ;
81
85
animationSet [ 3 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'scaleY' , [ shadeCoverAnimation . scaleY ] ) ;
82
86
animationSet [ 4 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'rotation' , [ shadeCoverAnimation . rotate ] ) ;
83
87
animationSet [ 5 ] = android . animation . ObjectAnimator . ofFloat ( view . nativeViewProtected , 'alpha' , [ shadeCoverAnimation . opacity ] ) ;
84
- animationSet [ 6 ] = this . _getBackgroundColorAnimator ( view , backgroundColor ) ;
88
+
89
+ if ( backgroundIsGradient ) {
90
+ if ( view . backgroundColor ) {
91
+ view . backgroundColor = undefined ;
92
+ }
93
+ const parsedGradient = parseLinearGradient ( backgroundColor ) ;
94
+ view . backgroundImage = LinearGradient . parse ( parsedGradient . value ) ;
95
+ } else {
96
+ if ( view . backgroundImage ) {
97
+ view . backgroundImage = undefined ;
98
+ }
99
+ animationSet [ 6 ] = this . _getBackgroundColorAnimator ( view , backgroundColor ) ;
100
+ }
85
101
return animationSet ;
86
102
}
87
103
0 commit comments