public static void showProgressBar(int status,int i){
  if (mRootView != null) {
    ProgressBar pb=(ProgressBar)mRootView.findViewById(R.id.progress_slice);
    TextView tv=(TextView)mRootView.findViewById(R.id.viewer_text_progress_slice);
    TextView tve=(TextView)mRootView.findViewById(R.id.viewer_text_estimated_time);
    TextView tve_title=(TextView)mRootView.findViewById(R.id.viewer_estimated_time_textview);
    if (mSlicingHandler.getLastReference() != null) {
      tve_title.setVisibility(View.VISIBLE);
      pb.setVisibility(View.VISIBLE);
switch (status) {
case StateUtils.SLICER_HIDE:
        if (i < 0) {
          tv.setText(R.string.error);
        }
 else {
          tv.setText(R.string.viewer_text_downloaded);
        }
      pb.setVisibility(View.INVISIBLE);
    break;
case StateUtils.SLICER_UPLOAD:
  String uploadText=mContext.getString(R.string.viewer_text_uploading);
if (i == 0) pb.setIndeterminate(true);
 else {
  pb.setProgress(i);
  pb.setIndeterminate(false);
  uploadText+=" (" + i + "%)";
}
tv.setText(uploadText);
tve.setText(null);
break;
case StateUtils.SLICER_SLICE:
String slicingText=mContext.getString(R.string.viewer_text_slicing);
if (i == 0) {
pb.setIndeterminate(true);
}
 else if (i == 100) {
pb.setIndeterminate(false);
pb.setProgress(100);
slicingText+="  " + mContext.getString(R.string.viewer_text_done);
}
 else {
pb.setProgress(i);
pb.setIndeterminate(false);
slicingText+="  (" + i + "%)";
}
tv.setText(slicingText);
tve.setText(null);
mRootView.invalidate();
break;
case StateUtils.SLICER_DOWNLOAD:
if (i > 0) {
tve.setText(OctoprintConnection.ConvertSecondToHHMMString(String.valueOf(i)));
}
tv.setText(R.string.viewer_text_downloading);
pb.setIndeterminate(true);
break;
default :
break;
}
}
 else {
pb.setVisibility(View.INVISIBLE);
tve_title.setVisibility(View.INVISIBLE);
tv.setText(null);
tve.setText(null);
mRootView.invalidate();
}
}
}

public static void showProgressBar ( int status , int i ) { if ( mRootView != null ) { ProgressBar pb = ( ProgressBar ) mRootView . findViewById ( R . id . progress_slice ) ; TextView tv = ( TextView ) mRootView . findViewById ( R . id . viewer_text_progress_slice ) ; TextView tve = ( TextView ) mRootView . findViewById ( R . id . viewer_text_estimated_time ) ; TextView tve_title = ( TextView ) mRootView . findViewById ( R . id . viewer_estimated_time_textview ) ; if ( mSlicingHandler . getLastReference ( ) != null ) { tve_title . setVisibility ( View . VISIBLE ) ; pb . setVisibility ( View . VISIBLE ) ; switch ( status ) { case StateUtils . SLICER_HIDE : if ( i < 0 ) { tv . setText ( R . string . error ) ; } else { tv . setText ( R . string . viewer_text_downloaded ) ; } pb . setVisibility ( View . INVISIBLE ) ; break ; case StateUtils . SLICER_UPLOAD : String uploadText = mContext . getString ( R . string . viewer_text_uploading ) ; if ( i == 0 ) pb . setIndeterminate ( true ) ; else { pb . setProgress ( i ) ; pb . setIndeterminate ( false ) ; uploadText += " (" + i + "%)" ; } tv . setText ( uploadText ) ; tve . setText ( null ) ; break ; case StateUtils . SLICER_SLICE : String slicingText = mContext . getString ( R . string . viewer_text_slicing ) ; if ( i == 0 ) { pb . setIndeterminate ( true ) ; } else if ( i == 100 ) { pb . setIndeterminate ( false ) ; pb . setProgress ( 100 ) ; slicingText += "  " + mContext . getString ( R . string . viewer_text_done ) ; } else { pb . setProgress ( i ) ; pb . setIndeterminate ( false ) ; slicingText += "  (" + i + "%)" ; } tv . setText ( slicingText ) ; tve . setText ( null ) ; mRootView . invalidate ( ) ; break ; case StateUtils . SLICER_DOWNLOAD : if ( i > 0 ) { tve . setText ( OctoprintConnection . ConvertSecondToHHMMString ( String . valueOf ( i ) ) ) ; } tv . setText ( R . string . viewer_text_downloading ) ; pb . setIndeterminate ( true ) ; break ; default : break ; } } else { pb . setVisibility ( View . INVISIBLE ) ; tve_title . setVisibility ( View . INVISIBLE ) ; tv . setText ( null ) ; tve . setText ( null ) ; mRootView . invalidate ( ) ; } } }
static method to show the progress bar by sending an integer when receiving data from the socket
