private Drawable getTintTargetFromProgressDrawable(int layerId, boolean shouldFallback) { Drawable progressDrawable = getProgressDrawable(); if (progressDrawable == null) { return null; } progressDrawable.mutate(); Drawable layerDrawable = null; if (progressDrawable instanceof LayerDrawable) { layerDrawable = ((LayerDrawable) progressDrawable).findDrawableByLayerId(layerId); } if (layerDrawable == null && shouldFallback) { layerDrawable = progressDrawable; } return layerDrawable; }
private void applyPrimaryProgressTint() { if (getProgressDrawable() == null) { return; } if (mProgressTintInfo.mHasProgressTintList || mProgressTintInfo.mHasProgressTintMode) { Drawable target = getTintTargetFromProgressDrawable(android.R.id.progress, true); if (target != null) { applyTintForDrawable(target, mProgressTintInfo.mProgressTintList, mProgressTintInfo.mHasProgressTintList, mProgressTintInfo.mProgressTintMode, mProgressTintInfo.mHasProgressTintMode); } } }
private void applySecondaryProgressTint() { if (getProgressDrawable() == null) { return; } if (mProgressTintInfo.mHasSecondaryProgressTintList || mProgressTintInfo.mHasSecondaryProgressTintMode) { Drawable target = getTintTargetFromProgressDrawable(android.R.id.secondaryProgress, false); if (target != null) { applyTintForDrawable(target, mProgressTintInfo.mSecondaryProgressTintList, mProgressTintInfo.mHasSecondaryProgressTintList, mProgressTintInfo.mSecondaryProgressTintMode, mProgressTintInfo.mHasSecondaryProgressTintMode); } } }
private void applyProgressBackgroundTint() { if (getProgressDrawable() == null) { return; } if (mProgressTintInfo.mHasProgressBackgroundTintList || mProgressTintInfo.mHasProgressBackgroundTintMode) { Drawable target = getTintTargetFromProgressDrawable(android.R.id.background, false); if (target != null) { applyTintForDrawable(target, mProgressTintInfo.mProgressBackgroundTintList, mProgressTintInfo.mHasProgressBackgroundTintList, mProgressTintInfo.mProgressBackgroundTintMode, mProgressTintInfo.mHasProgressBackgroundTintMode); } } }
private void applyProgressTints() { if (getProgressDrawable() == null) { return; } applyPrimaryProgressTint(); applyProgressBackgroundTint(); applySecondaryProgressTint(); }