use of android.graphics.drawable.Drawable in project remusic by aa112901.
the class AppCompatImageHelper method tint.
@Override
public void tint() {
if (mImageTintResId == 0 || !setSupportImageTint(mImageTintResId)) {
Drawable drawable = mTintManager.getDrawable(mImageResId);
if (drawable == null) {
drawable = mImageResId == 0 ? null : ContextCompat.getDrawable(mView.getContext(), mImageResId);
}
setImageDrawable(drawable);
}
}
use of android.graphics.drawable.Drawable in project remusic by aa112901.
the class AppCompatProgressBarHelper method applySupportProgressTint.
private void applySupportProgressTint() {
Log.e("themep", "apply progress tint");
if (mProgressTintInfo != null && (mProgressTintInfo.mHasTintList || mProgressTintInfo.mHasTintMode)) {
Log.e("themep", "apply progress tint true");
final Drawable target = getTintTarget(android.R.id.progress, true);
if (target != null) {
TintManager.tintViewDrawable(mView, target, mProgressTintInfo);
Log.e("themep", "apply progress tint true tint");
// stateful before applying the tint, so let's try again.
if (target.isStateful()) {
target.setState(mView.getDrawableState());
}
}
}
}
use of android.graphics.drawable.Drawable in project remusic by aa112901.
the class AppCompatProgressBarHelper method getTintTarget.
@Nullable
private Drawable getTintTarget(int layerId, boolean shouldFallback) {
Drawable layer = null;
final Drawable d = ((ProgressBar) mView).getProgressDrawable();
if (d != null) {
((ProgressBar) mView).setProgressDrawable(d.mutate());
if (d instanceof LayerDrawable) {
layer = ((LayerDrawable) d).findDrawableByLayerId(layerId);
}
if (shouldFallback && layer == null) {
layer = d;
}
}
return layer;
}
use of android.graphics.drawable.Drawable in project remusic by aa112901.
the class TintManager method getDrawable.
@Nullable
public Drawable getDrawable(@DrawableRes int resId) {
final Context context = mContextRef.get();
if (context == null)
return null;
if (resId == 0)
return null;
if (mSkipDrawableIdTags != null) {
final String cachedTagName = mSkipDrawableIdTags.get(resId);
if (SKIP_DRAWABLE_TAG.equals(cachedTagName)) {
printLog("[Match Skip DrawableTag] Skip the drawable which is matched with the skip tag.");
return null;
}
} else {
// Create an id cache as we'll need one later
mSkipDrawableIdTags = new SparseArray<>();
}
// Try the cache first (if it exists)
Drawable drawable = getCacheDrawable(context, resId);
if (drawable == null) {
drawable = DrawableUtils.createDrawable(context, resId);
if (drawable != null && !(drawable instanceof ColorDrawable)) {
if (addCachedDrawable(resId, drawable)) {
printLog("[loadDrawable] Saved drawable to cache: " + context.getResources().getResourceName(resId));
}
}
}
if (drawable == null) {
mSkipDrawableIdTags.append(resId, SKIP_DRAWABLE_TAG);
}
return drawable;
}
use of android.graphics.drawable.Drawable in project remusic by aa112901.
the class AppCompatBackgroundHelper method tint.
@Override
public void tint() {
if (mBackgroundTintResId == 0 || !setSupportBackgroundTint(mBackgroundTintResId)) {
Drawable drawable = mTintManager.getDrawable(mBackgroundResId);
if (drawable == null) {
drawable = mBackgroundResId == 0 ? null : ContextCompat.getDrawable(mView.getContext(), mBackgroundResId);
}
setBackgroundDrawable(drawable);
}
}
Aggregations