181 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			181 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
package com.bumptech.glide.util;
 | 
						|
 | 
						|
import android.annotation.TargetApi;
 | 
						|
import android.graphics.Bitmap;
 | 
						|
import android.os.Build;
 | 
						|
import android.os.Looper;
 | 
						|
import com.bumptech.glide.load.model.Model;
 | 
						|
import java.util.ArrayDeque;
 | 
						|
import java.util.ArrayList;
 | 
						|
import java.util.Collection;
 | 
						|
import java.util.List;
 | 
						|
import java.util.Queue;
 | 
						|
 | 
						|
/* loaded from: classes.dex */
 | 
						|
public final class Util {
 | 
						|
    private static final char[] a = "0123456789abcdef".toCharArray();
 | 
						|
    private static final char[] b = new char[64];
 | 
						|
 | 
						|
    /* renamed from: com.bumptech.glide.util.Util$1, reason: invalid class name */
 | 
						|
    static /* synthetic */ class AnonymousClass1 {
 | 
						|
        static final /* synthetic */ int[] a = new int[Bitmap.Config.values().length];
 | 
						|
 | 
						|
        static {
 | 
						|
            try {
 | 
						|
                a[Bitmap.Config.ALPHA_8.ordinal()] = 1;
 | 
						|
            } catch (NoSuchFieldError unused) {
 | 
						|
            }
 | 
						|
            try {
 | 
						|
                a[Bitmap.Config.RGB_565.ordinal()] = 2;
 | 
						|
            } catch (NoSuchFieldError unused2) {
 | 
						|
            }
 | 
						|
            try {
 | 
						|
                a[Bitmap.Config.ARGB_4444.ordinal()] = 3;
 | 
						|
            } catch (NoSuchFieldError unused3) {
 | 
						|
            }
 | 
						|
            try {
 | 
						|
                a[Bitmap.Config.RGBA_F16.ordinal()] = 4;
 | 
						|
            } catch (NoSuchFieldError unused4) {
 | 
						|
            }
 | 
						|
            try {
 | 
						|
                a[Bitmap.Config.ARGB_8888.ordinal()] = 5;
 | 
						|
            } catch (NoSuchFieldError unused5) {
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    public static int a(int i, int i2) {
 | 
						|
        return (i2 * 31) + i;
 | 
						|
    }
 | 
						|
 | 
						|
    public static String a(byte[] bArr) {
 | 
						|
        String a2;
 | 
						|
        synchronized (b) {
 | 
						|
            a2 = a(bArr, b);
 | 
						|
        }
 | 
						|
        return a2;
 | 
						|
    }
 | 
						|
 | 
						|
    public static boolean b(int i, int i2) {
 | 
						|
        return c(i) && c(i2);
 | 
						|
    }
 | 
						|
 | 
						|
    public static boolean c() {
 | 
						|
        return !d();
 | 
						|
    }
 | 
						|
 | 
						|
    private static boolean c(int i) {
 | 
						|
        return i > 0 || i == Integer.MIN_VALUE;
 | 
						|
    }
 | 
						|
 | 
						|
    public static boolean d() {
 | 
						|
        return Looper.myLooper() == Looper.getMainLooper();
 | 
						|
    }
 | 
						|
 | 
						|
    public static void b() {
 | 
						|
        if (!d()) {
 | 
						|
            throw new IllegalArgumentException("You must call this method on the main thread");
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    private static String a(byte[] bArr, char[] cArr) {
 | 
						|
        for (int i = 0; i < bArr.length; i++) {
 | 
						|
            int i2 = bArr[i] & 255;
 | 
						|
            int i3 = i * 2;
 | 
						|
            char[] cArr2 = a;
 | 
						|
            cArr[i3] = cArr2[i2 >>> 4];
 | 
						|
            cArr[i3 + 1] = cArr2[i2 & 15];
 | 
						|
        }
 | 
						|
        return new String(cArr);
 | 
						|
    }
 | 
						|
 | 
						|
    public static boolean b(Object obj, Object obj2) {
 | 
						|
        if (obj == null) {
 | 
						|
            return obj2 == null;
 | 
						|
        }
 | 
						|
        return obj.equals(obj2);
 | 
						|
    }
 | 
						|
 | 
						|
    public static int b(int i) {
 | 
						|
        return a(i, 17);
 | 
						|
    }
 | 
						|
 | 
						|
    @TargetApi(19)
 | 
						|
    public static int a(Bitmap bitmap) {
 | 
						|
        if (!bitmap.isRecycled()) {
 | 
						|
            if (Build.VERSION.SDK_INT >= 19) {
 | 
						|
                try {
 | 
						|
                    return bitmap.getAllocationByteCount();
 | 
						|
                } catch (NullPointerException unused) {
 | 
						|
                }
 | 
						|
            }
 | 
						|
            return bitmap.getHeight() * bitmap.getRowBytes();
 | 
						|
        }
 | 
						|
        throw new IllegalStateException("Cannot obtain size for recycled Bitmap: " + bitmap + "[" + bitmap.getWidth() + "x" + bitmap.getHeight() + "] " + bitmap.getConfig());
 | 
						|
    }
 | 
						|
 | 
						|
    public static int a(int i, int i2, Bitmap.Config config) {
 | 
						|
        return i * i2 * a(config);
 | 
						|
    }
 | 
						|
 | 
						|
    private static int a(Bitmap.Config config) {
 | 
						|
        if (config == null) {
 | 
						|
            config = Bitmap.Config.ARGB_8888;
 | 
						|
        }
 | 
						|
        int i = AnonymousClass1.a[config.ordinal()];
 | 
						|
        if (i == 1) {
 | 
						|
            return 1;
 | 
						|
        }
 | 
						|
        if (i == 2 || i == 3) {
 | 
						|
            return 2;
 | 
						|
        }
 | 
						|
        return i != 4 ? 4 : 8;
 | 
						|
    }
 | 
						|
 | 
						|
    public static void a() {
 | 
						|
        if (!c()) {
 | 
						|
            throw new IllegalArgumentException("You must call this method on a background thread");
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    public static <T> Queue<T> a(int i) {
 | 
						|
        return new ArrayDeque(i);
 | 
						|
    }
 | 
						|
 | 
						|
    public static <T> List<T> a(Collection<T> collection) {
 | 
						|
        ArrayList arrayList = new ArrayList(collection.size());
 | 
						|
        for (T t : collection) {
 | 
						|
            if (t != null) {
 | 
						|
                arrayList.add(t);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        return arrayList;
 | 
						|
    }
 | 
						|
 | 
						|
    public static boolean a(Object obj, Object obj2) {
 | 
						|
        if (obj == null) {
 | 
						|
            return obj2 == null;
 | 
						|
        }
 | 
						|
        if (obj instanceof Model) {
 | 
						|
            return ((Model) obj).a(obj2);
 | 
						|
        }
 | 
						|
        return obj.equals(obj2);
 | 
						|
    }
 | 
						|
 | 
						|
    public static int a(float f) {
 | 
						|
        return a(f, 17);
 | 
						|
    }
 | 
						|
 | 
						|
    public static int a(float f, int i) {
 | 
						|
        return a(Float.floatToIntBits(f), i);
 | 
						|
    }
 | 
						|
 | 
						|
    public static int a(Object obj, int i) {
 | 
						|
        return a(obj == null ? 0 : obj.hashCode(), i);
 | 
						|
    }
 | 
						|
 | 
						|
    public static int a(boolean z, int i) {
 | 
						|
        return a(z ? 1 : 0, i);
 | 
						|
    }
 | 
						|
}
 |