1
1
import { themer } from '@nativescript-community/ui-material-core' ;
2
- import { Color , colorProperty } from '@nativescript/core' ;
3
- import { ProgressBase , progressBackgroundColorProperty , progressColorProperty } from './progress-common' ;
2
+ import { Color , colorProperty , visibilityProperty } from '@nativescript/core' ;
3
+ import { Visibility } from '@nativescript/core/ui/enums' ;
4
+ import { ProgressBase , busyProperty , indeterminateProperty , progressBackgroundColorProperty , progressColorProperty } from './progress-common' ;
4
5
5
6
export class Progress extends ProgressBase {
6
7
constructor ( ) {
@@ -15,4 +16,36 @@ export class Progress extends ProgressBase {
15
16
[ progressBackgroundColorProperty . setNative ] ( color : Color ) {
16
17
this . nativeViewProtected . setProgressBackgroundTintList ( color ? android . content . res . ColorStateList . valueOf ( color . android ) : null ) ;
17
18
}
19
+ [ indeterminateProperty . setNative ] ( value : boolean ) {
20
+ this . nativeViewProtected . setIndeterminate ( value ) ;
21
+ }
22
+ [ busyProperty . getDefault ] ( ) {
23
+ return false ;
24
+ }
25
+ [ busyProperty . setNative ] ( value ) {
26
+ // if (value) {
27
+ this . nativeViewProtected . setVisibility ( value ? android . view . View . VISIBLE : android . view . View . INVISIBLE ) ;
28
+ // }
29
+ }
30
+ // [visibilityProperty.setNative](value) {
31
+ // switch (value) {
32
+ // case Visibility.VISIBLE:
33
+ // this.nativeViewProtected.setVisibility(this.busy ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
34
+ // break;
35
+ // case Visibility.HIDDEN:
36
+ // this.nativeViewProtected.setVisibility(android.view.View.INVISIBLE);
37
+ // break;
38
+ // case Visibility.COLLAPSE:
39
+ // this.nativeViewProtected.setVisibility(android.view.View.GONE);
40
+ // break;
41
+ // default:
42
+ // throw new Error(`Invalid visibility value: ${value}. Valid values are: "${Visibility.VISIBLE}", "${Visibility.HIDDEN}", "${Visibility.COLLAPSE}".`);
43
+ // }
44
+ // }
45
+ public startAnimating ( ) {
46
+ this . busy = true ;
47
+ }
48
+ public stopAnimating ( ) {
49
+ this . busy = false ;
50
+ }
18
51
}
0 commit comments