最右.apk(点击下载) / cx5.java


package defpackage;

import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.RawRes;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

/* renamed from: cx5  reason: default package */
public final class cx5 {

    /* renamed from: a  reason: collision with root package name */
    public static final List<String> f25650a = Arrays.asList("raw", "drawable", "mipmap");

    public static void a(int i, Drawable drawable) {
        if (drawable instanceof ax5) {
            ((ax5) drawable).n(i);
        }
    }

    public static float b(@NonNull Resources resources, @DrawableRes @RawRes 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 ((float) i3) / ((float) i2);
    }

    public static a c(ImageView imageView, AttributeSet attributeSet, int i, int i2) {
        if (attributeSet == null || imageView.isInEditMode()) {
            return new a();
        }
        a aVar = new a(imageView, attributeSet, i, i2);
        int i3 = aVar.f25652b;
        if (i3 >= 0) {
            a(i3, imageView.getDrawable());
            a(i3, imageView.getBackground());
        }
        return aVar;
    }

    public static boolean d(ImageView imageView, Uri uri) {
        if (uri == null) {
            return false;
        }
        try {
            imageView.setImageDrawable(new ax5(imageView.getContext().getContentResolver(), uri));
            return true;
        } catch (IOException unused) {
            return false;
        }
    }

    public static boolean e(ImageView imageView, boolean z, int i) {
        Resources resources = imageView.getResources();
        if (resources == null) {
            return false;
        }
        try {
            ax5 ax5 = new ax5(resources, i);
            if (z) {
                imageView.setImageDrawable(ax5);
                return true;
            } else if (Build.VERSION.SDK_INT >= 16) {
                imageView.setBackground(ax5);
                return true;
            } else {
                imageView.setBackgroundDrawable(ax5);
                return true;
            }
        } catch (Resources.NotFoundException | IOException unused) {
            return false;
        }
    }

    /* renamed from: cx5$a */
    public static class a extends b {
        public final int c;
        public final int d;

        public a(ImageView imageView, AttributeSet attributeSet, int i, int i2) {
            super(imageView, attributeSet, i, i2);
            this.c = a(imageView, attributeSet, true);
            this.d = a(imageView, attributeSet, false);
        }

        public static int a(ImageView imageView, AttributeSet attributeSet, boolean z) {
            int attributeResourceValue = attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", z ? "src" : "background", 0);
            if (attributeResourceValue > 0) {
                if (!cx5.f25650a.contains(imageView.getResources().getResourceTypeName(attributeResourceValue)) || cx5.e(imageView, z, attributeResourceValue)) {
                    return 0;
                }
                return attributeResourceValue;
            }
            return 0;
        }

        public a() {
            this.c = 0;
            this.d = 0;
        }
    }

    /* renamed from: cx5$b */
    public static class b {

        /* renamed from: a  reason: collision with root package name */
        public boolean f25651a;

        /* renamed from: b  reason: collision with root package name */
        public int f25652b;

        public b(View view, AttributeSet attributeSet, int i, int i2) {
            TypedArray obtainStyledAttributes = view.getContext().obtainStyledAttributes(attributeSet, hx5.GifView, i, i2);
            this.f25651a = obtainStyledAttributes.getBoolean(hx5.GifView_freezesAnimation, false);
            this.f25652b = obtainStyledAttributes.getInt(hx5.GifView_loopCount, -1);
            obtainStyledAttributes.recycle();
        }

        public b() {
            this.f25651a = false;
            this.f25652b = -1;
        }
    }
}