public ProgressStyle setProgress ( int value ) { if ( mProgressStyle == HORIZONTAL ) { if ( mProgress . isIndeterminate ( ) ) mProgress . setIndeterminate ( false ) ; if ( mProgress . getMax ( ) <= value ) mProgress . setMax ( value ) ; mProgress . setProgress ( value ) ; if ( ! mIsPercentageMode ) { mProgressText . setText ( String . format ( "%d %s" , value , mSuffix ) ) ; } else { mProgressText . setVisibility ( View . GONE ) ; int progress = mProgress . getProgress ( ) ; int max = mProgress . getMax ( ) ; float percent = ( ( float ) progress / ( float ) max ) ; int percentNorm = ( int ) ( percent * 100 ) ; mProgressMax . setText ( String . format ( "%d %%" , percentNorm ) ) ; } if ( value >= mProgress . getMax ( ) && mIsCloseOnFinish && mDialogInterface != null ) { new Handler ( ) . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { mDialogInterface . dismiss ( ) ; } } , 300 ) ; } } return this ; }
Set the progress of the progress bar