private void setImageUri(Uri uri) {
    mDebugOutput.setText("");
    final ImageListener listener =
        new BaseImageListener() {
          @Override
          public void onFinalImageSet(
              long id,
              int imageOrigin,
              @Nullable ImageInfo imageInfo,
              @Nullable Drawable drawable) {
            if (imageInfo != null) {
              QualityInfo qualityInfo = imageInfo.getQualityInfo();
              logScan(qualityInfo, true);
            }
          }

          @Override
          public void onIntermediateImageSet(long id, @Nullable ImageInfo imageInfo) {
            if (imageInfo != null) {
              QualityInfo qualityInfo = imageInfo.getQualityInfo();
              logScan(qualityInfo, false);
            }
          }

          @Override
          public void onIntermediateImageFailed(long id, @Nullable Throwable throwable) {
            mDebugOutput.append(
                String.format(
                    Locale.getDefault(),
                    "onIntermediateImageFailed, %s\n",
                    throwable.getMessage()));
          }
        };

    ProgressBarDrawable progressBarDrawable = new ProgressBarDrawable();
    progressBarDrawable.setColor(getResources().getColor(R.color.progress_bar_color));
    progressBarDrawable.setBackgroundColor(
        getResources().getColor(R.color.progress_bar_background));

    VitoView.show(
        uri,
        ImageOptions.create()
            .progress(progressBarDrawable)
            .progressiveRendering(mProgressiveRenderingEnabled)
            .build(),
        CALLER_CONTEXT,
        listener,
        mImageView);
  }
Progressive JPEG example that logs which frames of a progressive JPEG are rendered
samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imageformat/pjpeg/ImageFormatProgressiveJpegFragment.java