39 lines
1.3 KiB
Java
39 lines
1.3 KiB
Java
package com.google.android.material.internal;
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
import android.graphics.drawable.DrawableContainer;
|
|
import android.util.Log;
|
|
import java.lang.reflect.Method;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DrawableUtils {
|
|
private static Method a;
|
|
private static boolean b;
|
|
|
|
public static boolean a(DrawableContainer drawableContainer, Drawable.ConstantState constantState) {
|
|
return b(drawableContainer, constantState);
|
|
}
|
|
|
|
private static boolean b(DrawableContainer drawableContainer, Drawable.ConstantState constantState) {
|
|
if (!b) {
|
|
try {
|
|
a = DrawableContainer.class.getDeclaredMethod("setConstantState", DrawableContainer.DrawableContainerState.class);
|
|
a.setAccessible(true);
|
|
} catch (NoSuchMethodException unused) {
|
|
Log.e("DrawableUtils", "Could not fetch setConstantState(). Oh well.");
|
|
}
|
|
b = true;
|
|
}
|
|
Method method = a;
|
|
if (method != null) {
|
|
try {
|
|
method.invoke(drawableContainer, constantState);
|
|
return true;
|
|
} catch (Exception unused2) {
|
|
Log.e("DrawableUtils", "Could not invoke setConstantState(). Oh well.");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|