搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e

以下内容为反编译后的 Global.java 源代码,内容仅作参考


package com.radaee.pdf;

import android.app.Activity;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.util.DisplayMetrics;
import com.ksdk.ssds.manager.b;
import com.lygame.aaa.e50;
import com.lygame.aaa.o50;
import java.io.File;
import java.util.Iterator;
import java.util.Map;

public class Global {
    public static final String a = "140801";
    public static String g;
    public static final String[] b = {"140710", "140701", "140530"};
    public static int c = -11184811;
    public static float d = 2.0f;
    public static int e = -16711936;
    public static float f = 18.0f;
    public static int h = 1086324736;
    public static boolean i = false;
    public static float j = 3.0f;
    public static float k = 1.0f;
    public static float l = 0.2f;
    public static int m = 0;
    public static int n = 2;
    public static boolean o = false;
    public static String p = null;
    public static boolean q = false;

    public static boolean a(Activity act, String filename) {
        boolean z;
        boolean activeProfessional;
        String q2;
        String str = e50.x + "/cache/.pdf";
        p = str;
        o50.w(str);
        File filesDir = act.getFilesDir();
        try {
            q2 = q(o50.n0(e50.g8));
        } catch (Throwable th) {
            e50.S0(th);
        }
        if (q2 != null) {
            System.load(q2);
            z = true;
            if (!z && e50.c(2).equals("armeabi-v7a")) {
                try {
                    System.loadLibrary("rdpdf");
                    z = true;
                } catch (Throwable th2) {
                    e50.S0(th2);
                }
            }
            if (z) {
                return false;
            }
            if (act.getPackageName().equals(com.flyersoft.seekbooks.a.b)) {
                activeProfessional = activePremium(act, "seekbooks", "seanyzhou@gmail.com", "PQZPAJ-GV2VZ1-HLAIAS-BNJQSH-KRNQKG-HRUSDL");
            } else if (act.getPackageName().equals("com.flyersoft.seekbooksj")) {
                activeProfessional = activePremium(act, "seekbooks", "seanyzhou@gmail.com", "IXHW6G-3A7ABB-HLAIAS-BNJQSH-KRNQKG-HRUSDL");
            } else {
                activeProfessional = act.getPackageName().equals(com.flyersoft.seekbooks.a.b) ? activeProfessional(act, "seekbooks", "seanyzhou@gmail.com", "ITIQ7X-C65DMY-HLAIAS-BNJQSH-KRNQKG-HRUSDL") : false;
            }
            e50.N5("pdf activate:" + activeProfessional + " package:" + act.getPackageName());
            String str2 = filesDir.getAbsolutePath() + "/cmaps";
            String str3 = filesDir.getAbsolutePath() + "/umaps";
            File file = new File(str2);
            if (!file.isFile() || file.length() < 10) {
                l(act.getAssets(), filesDir, str2, str3);
            }
            setCMapsPath(str2, str3);
            String str4 = filesDir.getAbsolutePath() + "/fonts";
            if (n(act.getAssets(), filesDir, str4)) {
                loadStdFont(0, str4 + "/Courier");
                loadStdFont(1, str4 + "/Courier-Bold");
                loadStdFont(2, str4 + "/Courier-BoldItalic");
                loadStdFont(3, str4 + "/Courier-Italic");
                loadStdFont(4, str4 + "/Helvetica");
                loadStdFont(5, str4 + "/Helvetica-Bold");
                loadStdFont(6, str4 + "/Helvetica-BoldItalic");
                loadStdFont(7, str4 + "/Helvetica-Italic");
                loadStdFont(8, str4 + "/Symbol");
                loadStdFont(9, str4 + "/Times");
                loadStdFont(10, str4 + "/Times-Bold");
                loadStdFont(11, str4 + "/Times-BoldItalic");
                loadStdFont(12, str4 + "/Times-Italic");
                loadStdFont(13, str4 + "/ZapfDingbats");
            }
            fontfileListStart();
            fontfileListAdd("/system/fonts/DroidSans.ttf");
            boolean A1 = o50.A1("/system/fonts/Roboto-Regular.ttf");
            if (A1) {
                fontfileListAdd("/system/fonts/Roboto-Regular.ttf");
            }
            fontfileListAdd("/system/fonts/DroidSansFallback.ttf");
            k(act, filename);
            fontfileListEnd();
            int faceCount = getFaceCount();
            String str5 = null;
            for (int i2 = 0; i2 < faceCount; i2++) {
                str5 = getFaceName(i2);
                if (str5 != null) {
                    break;
                }
            }
            if (A1) {
                if (!setDefaultFont(null, "Roboto-Regular", true) && str5 != null && !setDefaultFont(null, "DroidSans", true)) {
                    setDefaultFont(null, str5, true);
                }
                if (!setDefaultFont(null, "Roboto-Regular", false) && str5 != null && !setDefaultFont(null, "DroidSans", false)) {
                    setDefaultFont(null, str5, false);
                }
            } else {
                if (!setDefaultFont(null, "DroidSans", true) && str5 != null) {
                    setDefaultFont(null, str5, true);
                }
                if (!setDefaultFont(null, "DroidSans", false) && str5 != null) {
                    setDefaultFont(null, str5, false);
                }
            }
            if (!setDefaultFont("GB1", "DroidSansFallback", true) && str5 != null) {
                setDefaultFont(null, str5, true);
            }
            if (!setDefaultFont("GB1", "DroidSansFallback", false) && str5 != null) {
                setDefaultFont(null, str5, false);
            }
            if (!setDefaultFont("CNS1", "DroidSansFallback", true) && str5 != null) {
                setDefaultFont(null, str5, true);
            }
            if (!setDefaultFont("CNS1", "DroidSansFallback", false) && str5 != null) {
                setDefaultFont(null, str5, false);
            }
            if (!setDefaultFont("Japan1", "DroidSansFallback", true) && str5 != null) {
                setDefaultFont(null, str5, true);
            }
            if (!setDefaultFont("Japan1", "DroidSansFallback", false) && str5 != null) {
                setDefaultFont(null, str5, false);
            }
            if (!setDefaultFont("Korea1", "DroidSansFallback", true) && str5 != null) {
                setDefaultFont(null, str5, true);
            }
            if (!setDefaultFont("Korea1", "DroidSansFallback", false) && str5 != null) {
                setDefaultFont(null, str5, false);
            }
            if (!setAnnotFont("DroidSansFallback") && str5 != null) {
                setAnnotFont(str5);
            }
            p();
            return true;
        }
        z = false;
        if (!z) {
            System.loadLibrary("rdpdf");
            z = true;
        }
        if (z) {
        }
    }

    private static native boolean activePremium(ContextWrapper context, String company, String mail, String serial);

    private static native boolean activePremiumForVer(ContextWrapper context, String company, String mail, String serial);

    private static native boolean activeProfessional(ContextWrapper context, String company, String mail, String serial);

    private static native boolean activeProfessionalForVer(ContextWrapper context, String company, String mail, String serial);

    private static native boolean activeStandard(ContextWrapper context, String company, String mail, String serial);

    private static native boolean activeStandardForVer(ContextWrapper context, String company, String mail, String serial);

    private static native boolean activeTime(ContextWrapper context, String company, String mail, String dt1, String dt2, String serial);

    public static void b() {
        g = null;
        File[] listFiles = new File(p).listFiles();
        if (listFiles != null) {
            for (int i2 = 0; i2 < listFiles.length; i2++) {
                e50.N5("---remove pdf cache:" + listFiles[i2].getAbsolutePath());
                o50.C(listFiles[i2].getAbsolutePath());
            }
        }
    }

    public static void c(float ratio, int dib_h, float[] ppoint, float[] dpoint) {
        dpoint[0] = ppoint[0] * ratio;
        dpoint[1] = dib_h - (ppoint[1] * ratio);
    }

    public static void d(Matrix mat, float[] ppoint, float[] dpoint) {
        toDIBPoint(mat.a, ppoint, dpoint);
    }

    public static native int dibFree(int dib);

    public static native int dibGet(int dib, int width, int height);

    public static native void drawRect(int bmp, int color, int x, int y, int width, int height, int mode);

    public static native void drawRectToDIB(int dib, int color, int x, int y, int width, int height, int mode);

    public static native void drawScroll(Bitmap bmp, int dib1, int dib2, int x, int y, int style);

    public static native void drawToBmp(int bmp, int dib, int x, int y);

    public static native void drawToBmp2(int bmp, int dib, int x, int y, int w, int h2);

    public static native void drawToDIB(int dst_dib, int src_dib, int x, int y);

    public static void e(float ratio, int dib_h, float[] prect, float[] drect) {
        drect[0] = prect[0] * ratio;
        float f2 = dib_h;
        drect[1] = f2 - (prect[3] * ratio);
        drect[2] = prect[2] * ratio;
        drect[3] = f2 - (prect[1] * ratio);
    }

    public static void f(Matrix mat, float[] prect, float[] drect) {
        toDIBRect(mat.a, prect, drect);
    }

    private static native void fontfileListAdd(String font_file);

    private static native void fontfileListEnd();

    private static native void fontfileListStart();

    private static native boolean fontfileMapping(String map_name, String name);

    public static void g(float ratio, int dib_h, float[] dpoint, float[] ppoint) {
        ppoint[0] = dpoint[0] / ratio;
        ppoint[1] = (dib_h - dpoint[1]) / ratio;
    }

    private static native int getFaceCount();

    private static native String getFaceName(int index);

    private static native String getVersion();

    public static void h(Matrix mat, float[] dpoint, float[] ppoint) {
        toPDFPoint(mat.a, dpoint, ppoint);
    }

    private static native void hideAnnots(boolean hide);

    public static void i(float ratio, int dib_h, float[] drect, float[] prect) {
        prect[0] = drect[0] / ratio;
        float f2 = dib_h;
        prect[1] = (f2 - drect[3]) / ratio;
        prect[2] = drect[2] / ratio;
        prect[3] = (f2 - drect[1]) / ratio;
    }

    public static native void invertBmp(int bmp);

    public static void j(Matrix mat, float[] drect, float[] prect) {
        toPDFRect(mat.a, drect, prect);
    }

    private static void k(Activity act, String filename) {
        if (filename == null) {
            return;
        }
        Iterator<Map.Entry<String, ?>> it = act.getSharedPreferences(filename.replace(b.b, "") + "_font", 0).getAll().entrySet().iterator();
        while (it.hasNext()) {
            String str = e50.c3 + b.b + it.next().getKey() + ".ttf";
            if (o50.A1(str)) {
                fontfileListAdd(str);
                e50.N5("###add delegateFont:" + str);
            } else {
                e50.N5("***missed delegateFont:" + str);
            }
        }
    }

    private static void l(AssetManager am, File files, String cmaps_path, String umaps_path) {
        try {
            if (!files.isDirectory()) {
                files.mkdirs();
            }
            String str = files.getAbsolutePath() + "/cjk.rar";
            o50.Q(am, "cjk", str);
            com.flyersoft.components.a c2 = com.flyersoft.components.a.c(str);
            c2.k("libcmaps.so", cmaps_path);
            c2.k("libumaps.so", umaps_path);
            new File(str).delete();
        } catch (Exception e2) {
            e50.S0(e2);
        }
    }

    private static native void loadStdFont(int index, String path);

    public static native int lockBitmap(Bitmap bitmap);

    private static boolean m(AssetManager am, File files, String so_file) {
        try {
            if (!files.isDirectory()) {
                files.mkdirs();
            }
            String str = files.getAbsolutePath() + "/pdf.rar";
            o50.Q(am, "pdf", str);
            com.flyersoft.components.a.c(str).k("librdpdf.so", so_file);
            new File(str).delete();
            return true;
        } catch (Exception e2) {
            e50.S0(e2);
            return false;
        }
    }

    private static boolean n(AssetManager am, File files, String fonts_path) {
        File file = new File(fonts_path);
        if (file.isDirectory()) {
            return true;
        }
        try {
            if (!file.mkdirs()) {
                return false;
            }
            String str = files.getAbsolutePath() + "/eu.rar";
            o50.Q(am, "eu", str);
            com.flyersoft.components.a c2 = com.flyersoft.components.a.c(str);
            Iterator<String> it = c2.d().iterator();
            while (it.hasNext()) {
                String next = it.next();
                c2.k(next, fonts_path + b.b + next);
            }
            new File(str).delete();
            return true;
        } catch (Exception e2) {
            e50.S0(e2);
            return false;
        }
    }

    public static Bitmap o(Document doc, int pageno, DisplayMetrics dm) {
        int i2;
        int i3;
        try {
            Page j2 = doc.j(0);
            if (dm != null) {
                i2 = dm.widthPixels;
                i3 = dm.heightPixels;
            } else {
                i2 = 640;
                i3 = 480;
            }
            float m2 = doc.m(0);
            float l2 = doc.l(0);
            float round = Math.round((i2 * 72) / m2);
            float round2 = Math.round(((i3 - 50) * 72) / l2);
            if (round > round2) {
                round = round2;
            }
            int m3 = (int) ((doc.m(0) * round) / 72.0f);
            int l3 = (int) ((doc.l(0) * round) / 72.0f);
            Matrix matrix = new Matrix(round / 72.0f, (-round) / 72.0f, 0.0f, (round * doc.l(0)) / 72.0f);
            int dibGet = dibGet(0, m3, l3);
            j2.f0(dibGet);
            j2.c0(dibGet, matrix);
            Bitmap createBitmap = Bitmap.createBitmap(m3, l3, Bitmap.Config.ARGB_8888);
            createBitmap.eraseColor(-1);
            int lockBitmap = lockBitmap(createBitmap);
            drawToBmp(lockBitmap, dibGet, 0, 0);
            unlockBitmap(createBitmap, lockBitmap);
            matrix.a();
            dibFree(dibGet);
            j2.A();
            return createBitmap;
        } catch (Exception e2) {
            e50.S0(e2);
            return null;
        } catch (OutOfMemoryError unused) {
            return null;
        }
    }

    public static void p() {
        h = 1086324736;
        k = 1.0f;
        l = 0.2f;
        m = 3;
        n = 2;
        o = false;
        setAnnotTransparency(536887551);
        j = e50.q3;
    }

    private static String q(String sysDataPath) {
        String str = sysDataPath + "/com.flyersoft.plugin_pdf/lib/librdpdf" + a + ".so";
        if (o50.A1(str)) {
            return str;
        }
        int i2 = 0;
        while (true) {
            String[] strArr = b;
            if (i2 >= strArr.length) {
                return null;
            }
            String str2 = sysDataPath + "/com.flyersoft.plugin_pdf/lib/librdpdf" + strArr[i2] + ".so";
            if (o50.A1(str2)) {
                return str2;
            }
            i2++;
        }
    }

    public static boolean r(Activity act) {
        String absolutePath = e50.S1().getFilesDir().getAbsolutePath();
        boolean B1 = o50.B1(absolutePath + "/fonts");
        if (!B1) {
            return B1;
        }
        File file = new File(absolutePath + "/cmaps");
        return file.isFile() && file.length() > 10;
    }

    private static native boolean setAnnotFont(String fontname);

    private static native void setAnnotTransparency(int color);

    private static native void setCMapsPath(String cmaps, String umaps);

    private static native boolean setDefaultFont(String collection, String fontname, boolean fixed);

    private static native boolean setTextFont(String fontname);

    private static native void toDIBPoint(int matrix, float[] ppoint, float[] dpoint);

    private static native void toDIBRect(int matrix, float[] prect, float[] drect);

    private static native void toPDFPoint(int matrix, float[] dpoint, float[] ppoint);

    private static native void toPDFRect(int matrix, float[] drect, float[] prect);

    public static native void unlockBitmap(Bitmap bitmap, int bmp);
}