1
- import { Color } from '@nativescript/core' ;
1
+ import { Color , Property , booleanConverter } from '@nativescript/core' ;
2
2
import { AnimatedCircleCommon , barColorProperty , rimColorProperty , spinBarColorProperty } from './common' ;
3
3
4
4
declare const at ;
5
5
6
+ export const animatedProperty = new Property < AnimatedCircle , boolean > ( {
7
+ name : 'animated' ,
8
+ valueChanged : ( target , old , newValue ) => {
9
+ target . updateAnimatedCircle ( ) ;
10
+ } ,
11
+ defaultValue : false ,
12
+ valueConverter : booleanConverter
13
+ } ) ;
14
+
6
15
export class AnimatedCircle extends AnimatedCircleCommon {
7
16
private _android : any ;
8
17
private _progress = 0 ;
@@ -69,7 +78,12 @@ export class AnimatedCircle extends AnimatedCircleCommon {
69
78
70
79
set progress ( value : number ) {
71
80
this . _progress = value ;
72
- this . android ?. setValueAnimated ( this . _progress ) ;
81
+ if ( this . animated ) {
82
+ this . android ?. setValueAnimated ( this . _progress ) ;
83
+ }
84
+ else {
85
+ this . android ?. setValue ( this . _progress ) ;
86
+ }
73
87
}
74
88
75
89
get progress ( ) : number {
@@ -94,15 +108,6 @@ export class AnimatedCircle extends AnimatedCircleCommon {
94
108
return this . _animationDuration ;
95
109
}
96
110
97
- set animated ( value : boolean ) {
98
- this . _animated = Boolean ( value ) ;
99
- this . updateAnimatedCircle ( ) ;
100
- }
101
-
102
- get animated ( ) : boolean {
103
- return this . _animated ;
104
- }
105
-
106
111
set maxValue ( value : number ) {
107
112
this . _maxValue = value ;
108
113
this . android ?. setMaxValue ( this . maxValue ) ;
@@ -318,3 +323,5 @@ export class AnimatedCircle extends AnimatedCircleCommon {
318
323
}
319
324
}
320
325
}
326
+
327
+ animatedProperty . register ( AnimatedCircle ) ;
0 commit comments