import { themer } from '@nativescript-community/ui-material-core' ; import { Color , PercentLength , heightProperty } from '@nativescript/core' ; import { ProgressBase , busyProperty , indeterminateProperty , progressBackgroundColorProperty , progressColorProperty } from './progress-common' ; export class Progress extends ProgressBase { constructor ( ) { super ( ) ; this . color = themer . getPrimaryColor ( ) as Color ; } nativeViewProtected : com . google . android . material . progressindicator . LinearProgressIndicator ; createNativeView ( ) { return new com . google . android . material . progressindicator . LinearProgressIndicator ( this . _context ) ; } [ progressColorProperty . setNative ] ( color ) { this . nativeViewProtected . setProgressTintList ( color ? android . content . res . ColorStateList . valueOf ( color . android ) : null ) ; } [ progressBackgroundColorProperty . setNative ] ( color ) { this . nativeViewProtected . setProgressBackgroundTintList ( color ? android . content . res . ColorStateList . valueOf ( color . android ) : null ) ; } [ indeterminateProperty . setNative ] ( value ) { if ( this . nativeViewProtected . getVisibility ( ) === android . view . View . VISIBLE ) { this . nativeViewProtected . setVisibility ( android . view . View . GONE ) ; this . nativeViewProtected . setIndeterminate ( value ) ; this . nativeViewProtected . setVisibility ( this . busy ? android . view . View . VISIBLE : android . view . View . INVISIBLE ) ; } else { this . nativeViewProtected . setIndeterminate ( value ) ; } } [ busyProperty . getDefault ] ( ) { return false ; } [ busyProperty . setNative ] ( value ) { this . nativeViewProtected . setVisibility ( value ? android . view . View . VISIBLE : android . view . View . INVISIBLE ) ; } [ heightProperty . setNative ] ( value ) { this . nativeViewProtected . setTrackThickness ( PercentLength . toDevicePixels ( value ) ) ; } public startAnimating ( ) { this . busy = true ; } public stopAnimating ( ) { this . busy = false ; } }