26 lines
961 B
Java
26 lines
961 B
Java
|
package androidx.appcompat.widget;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.res.Resources;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import androidx.annotation.NonNull;
|
||
|
import java.lang.ref.WeakReference;
|
||
|
public class TintResources extends ResourcesWrapper {
|
||
|
private final WeakReference<Context> mContextRef;
|
||
|
|
||
|
public TintResources(@NonNull Context context, @NonNull Resources resources) {
|
||
|
super(resources);
|
||
|
this.mContextRef = new WeakReference<>(context);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||
|
public Drawable getDrawable(int i) throws Resources.NotFoundException {
|
||
|
Drawable drawable = super.getDrawable(i);
|
||
|
Context context = this.mContextRef.get();
|
||
|
if (!(drawable == null || context == null)) {
|
||
|
ResourceManagerInternal.get().tintDrawableUsingColorFilter(context, i, drawable);
|
||
|
}
|
||
|
return drawable;
|
||
|
}
|
||
|
}
|