private void applyIndeterminateTint() { Drawable indeterminateDrawable = getIndeterminateDrawable(); if (indeterminateDrawable == null) { return; } if (mProgressTintInfo.mHasIndeterminateTint || mProgressTintInfo.mHasIndeterminateTintMode) { indeterminateDrawable.mutate(); applyTintForDrawable(indeterminateDrawable, mProgressTintInfo.mIndeterminateTint, mProgressTintInfo.mHasIndeterminateTint, mProgressTintInfo.mIndeterminateTintMode, mProgressTintInfo.mHasIndeterminateTintMode); } }
/** * Get the current drawable of this ProgressBar. * * @return The current drawable. */ @Nullable public Drawable getCurrentDrawable() { return isIndeterminate() ? getIndeterminateDrawable() : getProgressDrawable(); }
/** * Set whether the current drawable should show a background. The default is {@code true}. * * @param show Whether background should be shown, or ignored if the progress drawable does not * implement {@link ShowBackgroundDrawable}. */ public void setShowProgressBackground(boolean show) { Drawable drawable = getCurrentDrawable(); if (drawable instanceof ShowBackgroundDrawable) { ((ShowBackgroundDrawable) drawable).setShowBackground(show); } Drawable indeterminateDrawable = getIndeterminateDrawable(); if (indeterminateDrawable instanceof ShowBackgroundDrawable) { ((ShowBackgroundDrawable) indeterminateDrawable).setShowBackground(show); } }
/** * Set whether the current drawable should use an intrinsic padding. The default is * {@code true}. * * @param useIntrinsicPadding Whether the current drawable should use its intrinsic padding, or * ignored if the progress drawable does not implement * {@link IntrinsicPaddingDrawable}. */ public void setUseIntrinsicPadding(boolean useIntrinsicPadding) { Drawable drawable = getCurrentDrawable(); if (drawable instanceof IntrinsicPaddingDrawable) { ((IntrinsicPaddingDrawable) drawable).setUseIntrinsicPadding(useIntrinsicPadding); } Drawable indeterminateDrawable = getIndeterminateDrawable(); if (indeterminateDrawable instanceof IntrinsicPaddingDrawable) { ((IntrinsicPaddingDrawable) indeterminateDrawable) .setUseIntrinsicPadding(useIntrinsicPadding); } }