1
1
import { cssProperty , rippleColorProperty , themer } from '@nativescript-community/ui-material-core' ;
2
- import { state } from '@nativescript-community/ui-material-core/android/utils' ;
2
+ import { getEnabledColorStateList , state } from '@nativescript-community/ui-material-core/android/utils' ;
3
3
import { CoercibleProperty , Color , Property , View , backgroundColorProperty , backgroundInternalProperty , colorProperty } from '@nativescript/core' ;
4
4
import { thumbColorProperty , trackBackgroundColorProperty , trackFillColorProperty } from './cssproperties' ;
5
5
6
6
let ASlider : typeof com . google . android . material . slider . Slider ;
7
- export function getEnabledColorStateList ( color : Color , alpha = 255 ) {
7
+ export function sliderGetEnabledColorStateList ( color : Color , alpha = 255 ) {
8
8
if ( ! color ) {
9
9
return null ;
10
10
}
11
- const states = Array . create ( '[I' , 2 ) ;
12
- // const SELECTED_PRESSED_STATE_SET = Array.create("int",1);
13
- // SELECTED_PRESSED_STATE_SET[0] = state.enabled;
14
- states [ 0 ] = Array . create ( 'int' , 1 ) ;
15
- states [ 0 ] [ 0 ] = - state . enabled ;
16
- states [ 1 ] = android . util . StateSet . NOTHING ;
17
- // states[1][0] = new java.lang.Integer(-state.enabled);
18
- // const states = [
19
- // getSELECTED_PRESSED_STATE_SET(),
20
- // []]
21
- // ;
22
- const colors = Array . create ( 'int' , 2 ) ;
23
- colors [ 0 ] = new Color ( alpha , 158 , 158 , 158 ) . android ;
24
- colors [ 1 ] = color . android ;
25
- return new android . content . res . ColorStateList ( states , colors ) ;
11
+ return getEnabledColorStateList ( color . android , new Color ( alpha , 158 , 158 , 158 ) . android ) ;
26
12
}
27
13
export const valueProperty = new CoercibleProperty < Slider , number > ( {
28
14
name : 'value' ,
@@ -127,7 +113,7 @@ export class Slider extends View {
127
113
128
114
[ colorProperty . setNative ] ( color : Color ) {
129
115
if ( color ) {
130
- this . nativeViewProtected . setTrackTintList ( getEnabledColorStateList ( color ) ) ;
116
+ this . nativeViewProtected . setTrackTintList ( sliderGetEnabledColorStateList ( color ) ) ;
131
117
if ( ! this . trackBackgroundColor ) {
132
118
this . trackBackgroundColor = new Color ( 61.2 , color . r , color . g , color . b ) ;
133
119
}
@@ -180,7 +166,7 @@ export class Slider extends View {
180
166
this . nativeViewProtected . setHaloTintList ( color ? android . content . res . ColorStateList . valueOf ( color . android ) : null ) ;
181
167
}
182
168
[ thumbColorProperty . setNative ] ( color : Color ) {
183
- this . nativeViewProtected . setThumbTintList ( getEnabledColorStateList ( color ) ) ;
169
+ this . nativeViewProtected . setThumbTintList ( sliderGetEnabledColorStateList ( color ) ) ;
184
170
if ( ! this . rippleColor ) {
185
171
this . rippleColor = color ;
186
172
} else {
@@ -189,10 +175,10 @@ export class Slider extends View {
189
175
}
190
176
}
191
177
[ trackBackgroundColorProperty . setNative ] ( color : Color ) {
192
- this . nativeViewProtected . setTrackInactiveTintList ( getEnabledColorStateList ( color , 61.2 ) ) ;
178
+ this . nativeViewProtected . setTrackInactiveTintList ( sliderGetEnabledColorStateList ( color , 61.2 ) ) ;
193
179
}
194
180
[ trackFillColorProperty . setNative ] ( color : Color ) {
195
- this . nativeViewProtected . setTrackActiveTintList ( getEnabledColorStateList ( color ) ) ;
181
+ this . nativeViewProtected . setTrackActiveTintList ( sliderGetEnabledColorStateList ( color ) ) ;
196
182
}
197
183
198
184
// [elevationProperty.setNative](value: number) {
0 commit comments