@Override public synchronized void setIndeterminate(boolean indeterminate) { super.setIndeterminate(indeterminate); if (mSuperInitialized && !(getCurrentDrawable() instanceof MaterialProgressDrawable)) { Log.w(TAG, "Current drawable is not a MaterialProgressDrawable, you may want to set" + " app:mpb_setBothDrawables"); } }
/** * Get whether the current drawable is showing a background. The default is {@code true}. * * @return Whether the current drawable is showing a background, or {@code false} if the * drawable does not implement {@link ShowBackgroundDrawable}. */ public boolean getShowProgressBackground() { Drawable drawable = getCurrentDrawable(); if (drawable instanceof ShowBackgroundDrawable) { return ((ShowBackgroundDrawable) drawable).getShowBackground(); } else { return false; } }
/** * Get whether the current drawable is using an intrinsic padding. The default is {@code true}. * * @return Whether the current drawable is using an intrinsic padding, or {@code false} if the * drawable does not implement {@link IntrinsicPaddingDrawable}. */ public boolean getUseIntrinsicPadding() { Drawable drawable = getCurrentDrawable(); if (drawable instanceof IntrinsicPaddingDrawable) { return ((IntrinsicPaddingDrawable) drawable).getUseIntrinsicPadding(); } else { return false; } }
/** * 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); } }