11export * from './index-common' ;
2- import { ImageAsset , ImageSource , Screen , Trace , Utils , knownFolders , path } from '@nativescript/core' ;
2+ import { Color , ImageAsset , ImageSource , Screen , Trace , Utils , knownFolders , path } from '@nativescript/core' ;
33import { layout } from '@nativescript/core/utils/layout-helper' ;
44import { isString } from '@nativescript/core/utils/types' ;
55import {
@@ -15,6 +15,8 @@ import {
1515 failureImageUriProperty ,
1616 imageRotationProperty ,
1717 placeholderImageUriProperty ,
18+ progressBarColorProperty ,
19+ showProgressBarProperty ,
1820 srcProperty ,
1921 stretchProperty ,
2022 wrapNativeException
@@ -521,6 +523,21 @@ export class Img extends ImageBase {
521523 } ) ;
522524 }
523525 this . mCacheKey = SDWebImageManager . sharedManager . cacheKeyForURLContext ( uri , context ) ;
526+ if ( this . showProgressBar ) {
527+ try {
528+ if ( this . progressBarColor && Color . isValid ( this . progressBarColor ) ) {
529+ const indicator = new SDWebImageActivityIndicator ( ) ;
530+ indicator . indicatorView . color = new Color ( this . progressBarColor ) . ios ;
531+ this . nativeImageViewProtected . sd_imageIndicator = indicator ;
532+ } else {
533+ this . nativeImageViewProtected . sd_imageIndicator = SDWebImageActivityIndicator . grayIndicator ;
534+ }
535+ }
536+ catch ( ex ) {
537+ console . error ( ex )
538+ }
539+ }
540+
524541 this . nativeImageViewProtected . sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted (
525542 uri ,
526543 this . placeholderImage ,
@@ -551,6 +568,22 @@ export class Img extends ImageBase {
551568 // this.initImage();
552569 }
553570
571+ [ showProgressBarProperty . getDefault ] ( ) : boolean {
572+ return false ;
573+ }
574+
575+ [ showProgressBarProperty . setNative ] ( value ) {
576+ this . showProgressBar = value ;
577+ }
578+
579+ [ progressBarColorProperty . getDefault ] ( ) : string {
580+ return "" ;
581+ }
582+
583+ [ progressBarColorProperty . setNative ] ( value ) {
584+ this . progressBarColor = value ;
585+ }
586+
554587 [ failureImageUriProperty . setNative ] ( ) {
555588 // this.updateHierarchy();
556589 }
0 commit comments