秀色约会私密间.apk(点击下载) / q.java


package com.deepe.c.c;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import com.autonavi.amap.mapcore.tools.GlMapUtil;
import com.deepe.c.h.b;
import com.deepe.c.h.d;
import com.deepe.c.h.f;
import com.deepe.c.h.h;
import com.deepe.c.h.i;
import com.deepe.c.h.k;
import com.deepe.c.i.e;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;

public class q {
    static final float a = Resources.getSystem().getDisplayMetrics().density;
    private static h<String, i> b = new h<String, i>(20) {
        /* class com.deepe.c.c.q.AnonymousClass1 */

        /* access modifiers changed from: protected */
        public int a(String str, i iVar) {
            return 1;
        }

        /* access modifiers changed from: protected */
        public void a(boolean z, String str, i iVar, i iVar2) {
        }
    };

    public static final int a(int i) {
        return Math.round(((float) i) * a);
    }

    public static final Bitmap a(byte[] bArr, BitmapFactory.Options options) {
        try {
            Bitmap decodeByteArray = BitmapFactory.decodeByteArray(bArr, 0, bArr.length, options);
            if (decodeByteArray == null) {
                return null;
            }
            decodeByteArray.setDensity(GlMapUtil.DEVICE_DISPLAY_DPI_NORMAL);
            return decodeByteArray;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static final i a(String str) {
        if (d.a((CharSequence) str)) {
            return null;
        }
        try {
            String a2 = k.a((Object) str);
            i g = g(a2);
            if (g != null) {
                return g;
            }
            int indexOf = str.indexOf(44);
            if (indexOf < 0) {
                return null;
            }
            String substring = str.substring(0, indexOf);
            byte[] b2 = b(str.substring(indexOf + 1).trim());
            if (!e(substring) || b2 == null) {
                Bitmap c = c(b2);
                if (c != null) {
                    i a3 = i.a(c);
                    a(a2, a3);
                    return a3;
                }
                return null;
            }
            i a4 = i.a(b2);
            a(a2, a4);
            return a4;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String a(Bitmap bitmap) {
        String b2 = b(bitmap);
        StringBuilder sb = new StringBuilder("data:image/jpeg;base64,");
        if (b2 == null) {
            b2 = "";
        }
        sb.append(b2);
        return sb.toString();
    }

    public static final String a(Bitmap bitmap, Bitmap.CompressFormat compressFormat) {
        try {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            if (compressFormat == null) {
                compressFormat = Bitmap.CompressFormat.JPEG;
            }
            bitmap.compress(compressFormat, 100, byteArrayOutputStream);
            f.a((Closeable) byteArrayOutputStream);
            return b(byteArrayOutputStream.toByteArray());
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    public static final String a(String str, String str2) {
        boolean z = true;
        Bitmap a2 = w.a(str, 1);
        if (a2 == null) {
            return null;
        }
        File a3 = d.a(new File(str));
        if (a3.exists()) {
            return a3.getAbsolutePath();
        }
        File parentFile = a3.getParentFile();
        if (parentFile != null && !parentFile.exists()) {
            parentFile.mkdirs();
        }
        String e = e.e(str2);
        if (d.a((CharSequence) e) || (!"jpg".equals(e) && !"jpeg".equals(e))) {
            z = false;
        }
        try {
            BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(a3));
            a2.compress(z ? Bitmap.CompressFormat.JPEG : Bitmap.CompressFormat.PNG, 100, bufferedOutputStream);
            bufferedOutputStream.flush();
            bufferedOutputStream.close();
            a2.recycle();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        return a3.getAbsolutePath();
    }

    public static String a(byte[] bArr) {
        String b2 = b(bArr);
        StringBuilder sb = new StringBuilder("data:image/jpeg;base64,");
        if (b2 == null) {
            b2 = "";
        }
        sb.append(b2);
        return sb.toString();
    }

    private static void a(String str, i iVar) {
        b.b(str, iVar);
    }

    public static final boolean a(Bitmap bitmap, File file) {
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
            fileOutputStream.flush();
            f.a((Closeable) fileOutputStream);
            bitmap.recycle();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public static final String b(Bitmap bitmap) {
        return a(bitmap, Bitmap.CompressFormat.JPEG);
    }

    public static final String b(byte[] bArr) {
        try {
            return b.b(bArr, 2);
        } catch (Exception unused) {
            return null;
        }
    }

    public static final byte[] b(String str) {
        try {
            return b.a(str, 2);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static final int c(Bitmap bitmap) {
        return Build.VERSION.SDK_INT >= 19 ? bitmap.getAllocationByteCount() : bitmap.getByteCount();
    }

    public static final Bitmap c(byte[] bArr) {
        return a(bArr, (BitmapFactory.Options) null);
    }

    public static final boolean c(String str) {
        return "gif".equals(d(str));
    }

    public static final String d(String str) {
        return i.b(str);
    }

    public static final boolean d(byte[] bArr) {
        if (bArr == null || bArr.length < 6) {
            return false;
        }
        String str = "";
        for (int i = 0; i < 6; i++) {
            str = String.valueOf(str) + ((char) bArr[i]);
        }
        return str.startsWith("GIF");
    }

    private static boolean e(String str) {
        return f(str) == 8;
    }

    private static int f(String str) {
        String str2;
        if (d.a((CharSequence) str)) {
            return 51;
        }
        String[] split = str.split(";");
        if (split.length < 2) {
            return 51;
        }
        String[] split2 = split[0].split(":");
        if (split2.length < 2 || (str2 = split2[1]) == null) {
            return 51;
        }
        if (str2.contains("gif")) {
            return 8;
        }
        return str2.contains("svg") ? 4 : 51;
    }

    private static i g(String str) {
        return b.a(str);
    }
}