@@ -19,8 +19,8 @@ export class AnimatedCircle extends AnimatedCircleCommon {
19
19
private _text = '' ;
20
20
private _textColor = new Color ( 'orange' ) ;
21
21
private _textSize = 8 ;
22
+ private _fillColor : Color ;
22
23
clockwise = true ;
23
- fillColor : any ;
24
24
25
25
constructor ( ) {
26
26
super ( ) ;
@@ -107,7 +107,11 @@ export class AnimatedCircle extends AnimatedCircleCommon {
107
107
108
108
set rimColor ( value : any ) {
109
109
this . _rimColor = value ;
110
- this . updateAnimatedCircle ( ) ;
110
+ if ( value instanceof Color ) {
111
+ this . android . setRimColor ( value . argb ) ;
112
+ } else {
113
+ this . android . setRimColor ( new Color ( value ) . argb ) ;
114
+ }
111
115
}
112
116
113
117
get rimColor ( ) {
@@ -119,7 +123,11 @@ export class AnimatedCircle extends AnimatedCircleCommon {
119
123
}
120
124
set barColor ( value : Color ) {
121
125
this . _barColor = value ;
122
- this . updateAnimatedCircle ( ) ;
126
+ if ( value instanceof Color ) {
127
+ this . android . setBarColor ( [ value . argb ] ) ;
128
+ } else {
129
+ this . android . setBarColor ( [ new Color ( value ) . argb ] ) ;
130
+ }
123
131
}
124
132
125
133
set rimWidth ( value : number ) {
@@ -133,38 +141,28 @@ export class AnimatedCircle extends AnimatedCircleCommon {
133
141
134
142
set spinBarColor ( value : any ) {
135
143
this . _spinBarColor = value ;
136
- this . updateAnimatedCircle ( ) ;
144
+ if ( value instanceof Color ) {
145
+ this . android . setSpinBarColor ( value . argb ) ;
146
+ } else {
147
+ this . android . setSpinBarColor ( new Color ( this . spinBarColor ) . argb ) ;
148
+ }
137
149
}
138
150
139
151
get spinBarColor ( ) {
140
152
return this . _spinBarColor ;
141
153
}
142
154
143
- [ rimColorProperty . setNative ] ( value : any ) {
144
- this . _rimColor = value ;
145
- this . updateAnimatedCircle ( ) ;
155
+ get fillColor ( ) {
156
+ return this . _fillColor ;
146
157
}
147
158
148
- [ rimColorProperty . getDefault ] ( ) {
149
- return this . _rimColor ;
150
- }
151
-
152
- [ barColorProperty . setNative ] ( value : any ) {
153
- this . _barColor = value ;
154
- this . updateAnimatedCircle ( ) ;
155
- }
156
-
157
- [ barColorProperty . getDefault ] ( ) {
158
- return this . _barColor ;
159
- }
160
-
161
- [ spinBarColorProperty . setNative ] ( value : any ) {
162
- this . _spinBarColor = value ;
163
- this . updateAnimatedCircle ( ) ;
164
- }
165
-
166
- [ spinBarColorProperty . getDefault ] ( ) {
167
- return this . _spinBarColor ;
159
+ set fillColor ( value : any ) {
160
+ this . _fillColor = value ;
161
+ if ( value instanceof Color ) {
162
+ this . android . setFillCircleColor ( value . argb ) ;
163
+ } else {
164
+ this . android . setFillCircleColor ( new Color ( value ) . argb ) ;
165
+ }
168
166
}
169
167
170
168
set startAngle ( value : number ) {
@@ -196,23 +194,62 @@ export class AnimatedCircle extends AnimatedCircleCommon {
196
194
197
195
set textColor ( value : string ) {
198
196
this . _textColor = new Color ( value ) ;
199
- this . updateAnimatedCircle ( ) ;
197
+ this . android . setTextColor ( this . _textColor . argb ) ;
200
198
}
201
199
202
200
set textSize ( value : number ) {
203
201
this . _textSize = value ;
204
- this . updateAnimatedCircle ( ) ;
202
+ this . android . setTextSize ( value ) ;
205
203
}
206
204
207
205
get textSize ( ) {
208
206
return this . android . getTextSize ( ) ;
209
207
}
210
208
209
+ // CSS Properties
210
+
211
+ [ rimColorProperty . setNative ] ( value : any ) {
212
+ this . _rimColor = value ;
213
+ if ( value instanceof Color ) {
214
+ this . android ?. setRimColor ( value . argb ) ;
215
+ } else {
216
+ this . android ?. setRimColor ( new Color ( value ) . argb ) ;
217
+ }
218
+ }
219
+
220
+ [ rimColorProperty . getDefault ] ( ) {
221
+ return this . _rimColor ;
222
+ }
223
+
224
+ [ barColorProperty . setNative ] ( value : any ) {
225
+ this . _barColor = value ;
226
+ if ( value instanceof Color ) {
227
+ this . android ?. setBarColor ( [ value . argb ] ) ;
228
+ } else {
229
+ this . android ?. setBarColor ( [ new Color ( value ) . argb ] ) ;
230
+ }
231
+ }
232
+
233
+ [ barColorProperty . getDefault ] ( ) {
234
+ return this . _barColor ;
235
+ }
236
+
237
+ [ spinBarColorProperty . setNative ] ( value : any ) {
238
+ this . _spinBarColor = value ;
239
+ if ( value instanceof Color ) {
240
+ this . android ?. setSpinBarColor ( value . argb ) ;
241
+ } else {
242
+ this . android ?. setSpinBarColor ( new Color ( this . spinBarColor ) . argb ) ;
243
+ }
244
+ }
245
+
246
+ [ spinBarColorProperty . getDefault ] ( ) {
247
+ return this . _spinBarColor ;
248
+ }
249
+
211
250
private updateAnimatedCircle ( ) : void {
212
251
if ( this . android ) {
213
252
this . android . setText ( this . _text ) ;
214
- this . android . setTextColor ( this . _textColor . argb ) ;
215
- this . android . setTextSize ( this . _textSize ) ;
216
253
if ( this . animated ) {
217
254
if ( this . animateFrom ) {
218
255
this . android . setValueAnimated ( this . animateFrom , this . progress , this . animationDuration ) ;
@@ -227,12 +264,7 @@ export class AnimatedCircle extends AnimatedCircleCommon {
227
264
this . android . setValue ( this . progress ) ;
228
265
}
229
266
this . android . setMaxValue ( this . maxValue ) ;
230
- if ( this . rimColor ) {
231
- this . android . setRimColor ( new Color ( this . rimColor ) . argb ) ;
232
- }
233
- if ( this . spinBarColor ) {
234
- this . android . setSpinBarColor ( new Color ( this . spinBarColor ) . argb ) ;
235
- }
267
+
236
268
if ( this . startAngle ) {
237
269
this . android . setStartAngle ( this . startAngle ) ;
238
270
}
@@ -247,12 +279,6 @@ export class AnimatedCircle extends AnimatedCircleCommon {
247
279
if ( this . rimWidth ) {
248
280
this . android . setRimWidth ( this . rimWidth ) ;
249
281
}
250
- if ( this . barColor ) {
251
- this . android . setBarColor ( [ this . barColor . argb ] ) ;
252
- }
253
- if ( this . fillColor ) {
254
- this . android . setFillCircleColor ( new Color ( this . fillColor ) . argb ) ;
255
- }
256
282
257
283
this . android . setDirection ( this . clockwise ? at . grabner . circleprogress . Direction . CW : at . grabner . circleprogress . Direction . CCW ) ;
258
284
}
0 commit comments