55 lines
1.6 KiB
Java
55 lines
1.6 KiB
Java
package pl.droidsonroids.gif;
|
|
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.util.AttributeSet;
|
|
import android.util.TypedValue;
|
|
import android.view.View;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
final class GifViewUtils {
|
|
static final List<String> a = Arrays.asList("raw", "drawable", "mipmap");
|
|
|
|
static void a(int i, Drawable drawable) {
|
|
if (drawable instanceof GifDrawable) {
|
|
((GifDrawable) drawable).a(i);
|
|
}
|
|
}
|
|
|
|
static float a(Resources resources, int i) {
|
|
TypedValue typedValue = new TypedValue();
|
|
resources.getValue(i, typedValue, true);
|
|
int i2 = typedValue.density;
|
|
if (i2 == 0) {
|
|
i2 = 160;
|
|
} else if (i2 == 65535) {
|
|
i2 = 0;
|
|
}
|
|
int i3 = resources.getDisplayMetrics().densityDpi;
|
|
if (i2 <= 0 || i3 <= 0) {
|
|
return 1.0f;
|
|
}
|
|
return i3 / i2;
|
|
}
|
|
|
|
static class GifViewAttributes {
|
|
boolean a;
|
|
final int b;
|
|
|
|
GifViewAttributes(View view, AttributeSet attributeSet, int i, int i2) {
|
|
TypedArray obtainStyledAttributes = view.getContext().obtainStyledAttributes(attributeSet, R$styleable.GifView, i, i2);
|
|
this.a = obtainStyledAttributes.getBoolean(R$styleable.GifView_freezesAnimation, false);
|
|
this.b = obtainStyledAttributes.getInt(R$styleable.GifView_loopCount, -1);
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
|
|
GifViewAttributes() {
|
|
this.a = false;
|
|
this.b = -1;
|
|
}
|
|
}
|
|
}
|