1
1
import { dynamicElevationOffsetProperty , elevationProperty , rippleColorProperty , shapeProperty , themer } from '@nativescript-community/ui-material-core' ;
2
- import { createStateListAnimator , isPostLollipop } from '@nativescript-community/ui-material-core/android/utils' ;
2
+ import { createStateListAnimator , getColorStateList , isPostLollipop } from '@nativescript-community/ui-material-core/android/utils' ;
3
3
import { Background , Color , ImageSource , Length , backgroundInternalProperty , colorProperty } from '@nativescript/core' ;
4
4
import { textProperty } from '@nativescript/core/ui/text-base' ;
5
5
import { FloatingActionButtonBase , expandedProperty , imageSourceProperty , sizeProperty , srcProperty } from './floatingactionbutton-common' ;
@@ -83,7 +83,7 @@ export class FloatingActionButton extends FloatingActionButtonBase {
83
83
} else {
84
84
// if (android.os.Build.VERSION.SDK_INT >= 21) {
85
85
if ( value . color ) {
86
- this . nativeViewProtected . setBackgroundTintList ( android . content . res . ColorStateList . valueOf ( value . color . android ) ) ;
86
+ this . nativeViewProtected . setBackgroundTintList ( getColorStateList ( value . color . android ) ) ;
87
87
}
88
88
// } else {
89
89
// (this as any)._redrawNativeBackground(value);
@@ -92,13 +92,16 @@ export class FloatingActionButton extends FloatingActionButtonBase {
92
92
}
93
93
}
94
94
[ colorProperty . setNative ] ( value : Color ) {
95
- this . nativeViewProtected . setIconTint ( android . content . res . ColorStateList . valueOf ( value . android ) ) ;
95
+ const color = ! value || value instanceof Color ? value : new Color ( value ) ;
96
+ this . nativeViewProtected . setIconTint ( getColorStateList ( color . android ) ) ;
96
97
}
97
- [ rippleColorProperty . setNative ] ( color : Color ) {
98
- this . nativeViewProtected . setRippleColor ( android . content . res . ColorStateList . valueOf ( color . android ) ) ;
98
+ [ rippleColorProperty . setNative ] ( value : Color ) {
99
+ const color = ! value || value instanceof Color ? value : new Color ( value ) ;
100
+ this . nativeViewProtected . setRippleColor ( getColorStateList ( color . android ) ) ;
99
101
}
100
- [ rippleColorProperty . setNative ] ( color : Color ) {
101
- this . nativeViewProtected . setRippleColor ( android . content . res . ColorStateList . valueOf ( color . android ) ) ;
102
+ [ rippleColorProperty . setNative ] ( value : Color ) {
103
+ const color = ! value || value instanceof Color ? value : new Color ( value ) ;
104
+ this . nativeViewProtected . setRippleColor ( getColorStateList ( color . android ) ) ;
102
105
}
103
106
[ expandedProperty . setNative ] ( value : boolean ) {
104
107
if ( value ) {
0 commit comments