Sets the progress bar image and its scale type.

@param progressBarDrawable drawable to be used as progress bar image
@param progressBarImageScaleType scale type for the progress bar image
@return modified instance of this builder
6654
public GenericDraweeHierarchyBuilder setProgressBarImage(
      Drawable progressBarDrawable, @Nullable ScalingUtils.ScaleType progressBarImageScaleType) {
    mProgressBarImage = progressBarDrawable;
    mProgressBarImageScaleType = progressBarImageScaleType;
    return this;
  }
115076
public void setRetryImage(Drawable drawable, ScalingUtils.ScaleType scaleType) {
    setChildDrawableAtIndex(RETRY_IMAGE_INDEX, drawable);
    getScaleTypeDrawableAtIndex(RETRY_IMAGE_INDEX).setScaleType(scaleType);
  }
581122
public void setActualImageScaleType(ScalingUtils.ScaleType scaleType) {
    Preconditions.checkNotNull(scaleType);
    getScaleTypeDrawableAtIndex(ACTUAL_IMAGE_INDEX).setScaleType(scaleType);
  }
1101077
public static void setImageDrawable(EfficientCacheView cacheView, int viewId,
            Drawable drawable) {
        View view = cacheView.findViewByIdEfficient(viewId);
        if (view instanceof ImageView) {
            ((ImageView) view).setImageDrawable(drawable);
        }
    }
766108
protected void setLoadingDrawable(LoadingDrawable drawable) {
        if (drawable == null) {
            throw new NullPointerException("LoadingDrawable is null, You can only set the STYLE_CIRCLE and STYLE_LINE parameters.");
        } else {
            drawable.setCallback(this);
            mLoadingDrawable = drawable;

            invalidate();
            requestLayout();
        }
    }
534346
private JProgressBar getOrCreateProgressBar(Progress prog) {
    JProgressBar pbar = pbarmap.get(prog);
    // Add a new progress bar.
    if(pbar == null) {
      synchronized(pbarmap) {
        if(prog instanceof FiniteProgress) {
          pbar = new JProgressBar(0, ((FiniteProgress) prog).getTotal());
          pbar.setStringPainted(true);
        }
        else if(prog instanceof IndefiniteProgress) {
          pbar = new JProgressBar();
          pbar.setIndeterminate(true);
          pbar.setStringPainted(true);
        }
        else if(prog instanceof MutableProgress) {
          pbar = new JProgressBar(0, ((MutableProgress) prog).getTotal());
          pbar.setStringPainted(true);
        }
        else {
          throw new RuntimeException("Unsupported progress record");
        }
        pbarmap.put(prog, pbar);
        final JProgressBar pbar2 = pbar; // Make final
        SwingUtilities.invokeLater(() -> addProgressBar(pbar2));
      }
    }
    return pbar;
  }
556601
protected function bootstrapProgressBar(ProgressBarInterface $progressBar) {

        $span = static::coreHTMLElement("span", $progressBar->getValue() . "%", ["class" => "sr-only"]);

        $attributes = [];

        $attributes["class"]         = ["progress-bar", ProgressBarRenderer::renderType($progressBar)];
        $attributes["class"][]       = ProgressBarRenderer::renderStriped($progressBar);
        $attributes["class"][]       = ProgressBarRenderer::renderAnimated($progressBar);
        $attributes["style"]         = ProgressBarRenderer::renderStyle($progressBar);
        $attributes["role"]          = "progressbar";
        $attributes["aria-valuenow"] = $progressBar->getValue();
        $attributes["aria-valuemin"] = $progressBar->getMin();
        $attributes["aria-valuemax"] = $progressBar->getMax() . "%";

        $innerHTML = ProgressBarRenderer::renderContent($progressBar, $span);

        $div = static::coreHTMLElement("div", $innerHTML, $attributes);

        return static::coreHTMLElement("div", $div, ["class" => "progress"]);
    }
572528
static void tintWidget(@NonNull ProgressBar progressBar, @ColorInt int color) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            ColorStateList tint = ColorStateList.valueOf(color);
            progressBar.setIndeterminateTintList(tint);
        }
    }
247257
public T image(Drawable drawable) {

        if (view instanceof ImageView) {
            ImageView iv = (ImageView) view;
            iv.setImageDrawable(drawable);
        }

        return self();
    }
601559
public void setGradientBarEnabled(final boolean ENABLED) {
        if (null == gradientBarEnabled) {
            _gradientBarEnabled = ENABLED;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            gradientBarEnabled.set(ENABLED);
        }
    }
802477
@Deprecated
    public static PlanarImage progressiveScaleImage(PlanarImage input, int targetWidth, int targetHeight, Object hint,
                                                    boolean progressive) {
        BufferedImage img = input.getAsBufferedImage();
        int type = (img.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
        BufferedImage ret = img;
        BufferedImage scratchImage = null;
        Graphics2D g2 = null;
        int w, h;
        int prevW = ret.getWidth();
        int prevH = ret.getHeight();
        boolean isTranslucent = img.getTransparency() != Transparency.OPAQUE;

        if (progressive) {
            // Use multi-step technique: start with original size, then
            // scale down in multiple passes with drawImage()
            // until the target size is reached
            w = img.getWidth();
            h = img.getHeight();
        } else {
            // Use one-step technique: scale directly from original
            // size to target size with a single drawImage() call
            w = targetWidth;
            h = targetHeight;
        }

        do {
            if (progressive && w > targetWidth) {
                w /= 2;
                if (w < targetWidth) {
                    w = targetWidth;
                }
            }

            if (progressive && h > targetHeight) {
                h /= 2;
                if (h < targetHeight) {
                    h = targetHeight;
                }
            }

            if (scratchImage == null || isTranslucent) {
                // Use a single scratch buffer for all iterations
                // and then copy to the final, correctly-sized image
                // before returning
                scratchImage = new BufferedImage(w, h, type);
                g2 = scratchImage.createGraphics();
            }
            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hint);
            g2.drawImage(ret, 0, 0, w, h, 0, 0, prevW, prevH, null);
            prevW = w;
            prevH = h;

            ret = scratchImage;
        } while (w != targetWidth || h != targetHeight);

        if (g2 != null) {
            g2.dispose();
        }

        // If we used a scratch buffer that is larger than our target size,
        // create an image of the right size and copy the results into it
        if (targetWidth != ret.getWidth() || targetHeight != ret.getHeight()) {
            scratchImage = new BufferedImage(targetWidth, targetHeight, type);
            g2 = scratchImage.createGraphics();
            g2.drawImage(ret, 0, 0, null);
            g2.dispose();
            ret = scratchImage;
        }

        return new RenderedImageAdapter(ret);
    }
673768
public GenericDraweeHierarchyBuilder setProgressBarImage(
      int resourceId, @Nullable ScalingUtils.ScaleType progressBarImageScaleType) {
    mProgressBarImage = mResources.getDrawable(resourceId);
    mProgressBarImageScaleType = progressBarImageScaleType;
    return this;
  }
1039179
public void setInstantProgress(float progress) {
    if (isSpinning) {
      mProgress = 0.0f;
      isSpinning = false;
    }

    if (progress > 1.0f) {
      progress -= 1.0f;
    } else if (progress < 0) {
      progress = 0;
    }

    if (progress == mTargetProgress) {
      return;
    }

    mTargetProgress = Math.min(progress * 360.0f, 360.0f);
    mProgress = mTargetProgress;
    lastTimeAnimated = SystemClock.uptimeMillis();
    invalidate();
  }
546658
public GenericDraweeHierarchyBuilder setFailureImage(
      int resourceId, @Nullable ScalingUtils.ScaleType failureImageScaleType) {
    mFailureImage = mResources.getDrawable(resourceId);
    mFailureImageScaleType = failureImageScaleType;
    return this;
  }
604694
private void defineProgressBars(UIDefaults d) {
        // Copied from nimbus

      //Initialize ProgressBar
        d.put("ProgressBar.contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put("ProgressBar.States", "Enabled,Disabled,Indeterminate,Finished");
        d.put("ProgressBar.tileWhenIndeterminate", Boolean.TRUE);
        d.put("ProgressBar.paintOutsideClip", Boolean.TRUE);
        d.put("ProgressBar.rotateText", Boolean.TRUE);
        d.put("ProgressBar.vertictalSize", new DimensionUIResource(19, 150));
        d.put("ProgressBar.horizontalSize", new DimensionUIResource(150, 19));
        addColor(d, "ProgressBar[Disabled].textForeground", "seaGlassDisabledText", 0.0f, 0.0f, 0.0f, 0);
        d.put("ProgressBar[Disabled+Indeterminate].progressPadding", new Integer(3));
        
        // Seaglass starts below.
        
        d.put("progressBarTrackInterior", Color.WHITE);
        d.put("progressBarTrackBase", new Color(0x4076bf));

        d.put("ProgressBar.Indeterminate", new ProgressBarIndeterminateState());
        d.put("ProgressBar.Finished", new ProgressBarFinishedState());

        String p = "ProgressBar";
        String c = PAINTER_PREFIX + "ProgressBarPainter";

        d.put(p + ".cycleTime", 500);
        d.put(p + ".progressPadding", new Integer(3));
        d.put(p + ".trackThickness", new Integer(19));
        d.put(p + ".tileWidth", new Integer(24));
        d.put(p + ".backgroundFillColor", Color.WHITE);
        d.put(p + ".font", new DerivedFont("defaultFont", 0.769f, null, null));
        d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, ProgressBarPainter.Which.BACKGROUND_ENABLED));
        d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, ProgressBarPainter.Which.BACKGROUND_DISABLED));
        d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED));
        d.put(p + "[Enabled+Finished].foregroundPainter",
              new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED_FINISHED));
        d.put(p + "[Enabled+Indeterminate].foregroundPainter",
              new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED_INDETERMINATE));
        d.put(p + "[Disabled].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED));
        d.put(p + "[Disabled+Finished].foregroundPainter",
              new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED_FINISHED));
        d.put(p + "[Disabled+Indeterminate].foregroundPainter",
              new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED_INDETERMINATE));
    }
584201
private void adaptProgressBar() {
        LayoutInflater inflater = LayoutInflater.from(getContext());
        View view = inflater.inflate(getCustomMessageId(), getRootView(), false);
        getDialog().setCustomMessage(view);
        View progressView = view.findViewById(R.id.progress_bar);
        progressBar =
                progressView instanceof CircularProgressBar ? (CircularProgressBar) progressView :
                        null;
        adaptProgressBarColor();
        adaptProgressBarSize();
        adaptProgressBarThickness();
        adaptMessageTextSize();
    }
808389
public static LoadingLayout wrap(final View targetView, final int progressBarStyle){
        if(targetView==null){
            throw new IllegalArgumentException();
        }

        final LoadingLayout loadingLayout = new LoadingLayout(targetView.getContext()){
            @Override
            protected View createProgressBar() {
                return new ProgressBar(getContext(),null,progressBarStyle);
            }
        };
        loadingLayout.attachTo(targetView);
        return loadingLayout;
    }