Search in sources :

Example 1 with StageActivity

use of com.hippo.scene.StageActivity in project EhViewer by seven332.

the class EhCallback method getScene.

@SuppressWarnings("unchecked")
public E getScene() {
    StageActivity stage = mApplication.findStageActivityById(mStageId);
    if (stage == null) {
        return null;
    }
    SceneFragment scene = stage.findSceneByTag(mSceneTag);
    if (isInstance(scene)) {
        return (E) scene;
    } else {
        return null;
    }
}
Also used : SceneFragment(com.hippo.scene.SceneFragment) StageActivity(com.hippo.scene.StageActivity)

Example 2 with StageActivity

use of com.hippo.scene.StageActivity in project EhViewer by seven332.

the class Crash method collectInfo.

private static void collectInfo(Context context, FileWriter fw) throws IOException {
    try {
        PackageManager pm = context.getPackageManager();
        PackageInfo pi = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
        if (pi != null) {
            String versionName = pi.versionName == null ? "null" : pi.versionName;
            String versionCode = String.valueOf(pi.versionCode);
            fw.write("======== PackageInfo ========\r\n");
            fw.write("PackageName=");
            fw.write(pi.packageName);
            fw.write("\r\n");
            fw.write("VersionName=");
            fw.write(versionName);
            fw.write("\r\n");
            fw.write("VersionCode=");
            fw.write(versionCode);
            fw.write("\r\n");
            String signature = PackageUtils.getSignature(context, pi.packageName);
            fw.write("Signature=");
            fw.write(null != signature ? signature : "null");
            fw.write("\r\n");
            fw.write("\r\n");
        }
    } catch (PackageManager.NameNotFoundException e) {
        fw.write("======== PackageInfo ========\r\n");
        fw.write("Can't get package information\r\n");
        fw.write("\r\n");
    }
    // Runtime
    String topActivityClazzName = "null";
    String topSceneClazzName = "null";
    try {
        Activity topActivity = ((EhApplication) context.getApplicationContext()).getTopActivity();
        if (null != topActivity) {
            topActivityClazzName = topActivity.getClass().getName();
            if (topActivity instanceof StageActivity) {
                Class<?> clazz = ((StageActivity) topActivity).getTopSceneClass();
                if (clazz != null) {
                    topSceneClazzName = clazz.getName();
                }
            }
        }
    } catch (Throwable e) {
    // Ignore
    }
    fw.write("======== Runtime ========\r\n");
    fw.write("TopActivity=");
    fw.write(avoidNull(topActivityClazzName));
    fw.write("\r\n");
    fw.write("TopScene=");
    fw.write(avoidNull(topSceneClazzName));
    fw.write("\r\n");
    fw.write("\r\n");
    // Device info
    fw.write("======== DeviceInfo ========\r\n");
    fw.write("BOARD=");
    fw.write(Build.BOARD);
    fw.write("\r\n");
    fw.write("BOOTLOADER=");
    fw.write(Build.BOOTLOADER);
    fw.write("\r\n");
    fw.write("CPU_ABI=");
    fw.write(Build.CPU_ABI);
    fw.write("\r\n");
    fw.write("CPU_ABI2=");
    fw.write(Build.CPU_ABI2);
    fw.write("\r\n");
    fw.write("DEVICE=");
    fw.write(Build.DEVICE);
    fw.write("\r\n");
    fw.write("DISPLAY=");
    fw.write(Build.DISPLAY);
    fw.write("\r\n");
    fw.write("FINGERPRINT=");
    fw.write(Build.FINGERPRINT);
    fw.write("\r\n");
    fw.write("HARDWARE=");
    fw.write(Build.HARDWARE);
    fw.write("\r\n");
    fw.write("HOST=");
    fw.write(Build.HOST);
    fw.write("\r\n");
    fw.write("ID=");
    fw.write(Build.ID);
    fw.write("\r\n");
    fw.write("MANUFACTURER=");
    fw.write(Build.MANUFACTURER);
    fw.write("\r\n");
    fw.write("MODEL=");
    fw.write(Build.MODEL);
    fw.write("\r\n");
    fw.write("PRODUCT=");
    fw.write(Build.PRODUCT);
    fw.write("\r\n");
    fw.write("RADIO=");
    fw.write(Build.getRadioVersion());
    fw.write("\r\n");
    fw.write("SERIAL=");
    fw.write(Build.SERIAL);
    fw.write("\r\n");
    fw.write("TAGS=");
    fw.write(Build.TAGS);
    fw.write("\r\n");
    fw.write("TYPE=");
    fw.write(Build.TYPE);
    fw.write("\r\n");
    fw.write("USER=");
    fw.write(Build.USER);
    fw.write("\r\n");
    fw.write("CODENAME=");
    fw.write(Build.VERSION.CODENAME);
    fw.write("\r\n");
    fw.write("INCREMENTAL=");
    fw.write(Build.VERSION.INCREMENTAL);
    fw.write("\r\n");
    fw.write("RELEASE=");
    fw.write(Build.VERSION.RELEASE);
    fw.write("\r\n");
    fw.write("SDK=");
    fw.write(Integer.toString(Build.VERSION.SDK_INT));
    fw.write("\r\n");
    fw.write("MEMORY=");
    fw.write(FileUtils.humanReadableByteCount(OSUtils.getAppAllocatedMemory(), false));
    fw.write("\r\n");
    fw.write("MEMORY_NATIVE=");
    fw.write(FileUtils.humanReadableByteCount(Debug.getNativeHeapAllocatedSize(), false));
    fw.write("\r\n");
    fw.write("MEMORY_MAX=");
    fw.write(FileUtils.humanReadableByteCount(OSUtils.getAppMaxMemory(), false));
    fw.write("\r\n");
    fw.write("MEMORY_TOTAL=");
    fw.write(FileUtils.humanReadableByteCount(OSUtils.getTotalMemory(), false));
    fw.write("\r\n");
    fw.write("\r\n");
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) StageActivity(com.hippo.scene.StageActivity) Activity(android.app.Activity) StageActivity(com.hippo.scene.StageActivity)

Aggregations

StageActivity (com.hippo.scene.StageActivity)2 Activity (android.app.Activity)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 SceneFragment (com.hippo.scene.SceneFragment)1