导航菜单

页面标题

页面副标题

天上人间 v3.1 - MyApp.java 源代码

正在查看: 天上人间 v3.1 应用的 MyApp.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.xiuer.app.base;

import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Handler;
import android.os.Process;
import android.util.Log;
import com.xiuer.app.base.MyApp$;
import com.xiuer.app.utils.Content;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import okhttp3.Call;

public class MyApp extends Application {
    private static final int APP_VERSION_CODE = 39;
    private static final int CONFIG_BUILD_NUMBER = 108;
    private static final int NETWORK_TIMEOUT = 170;
    private static final int UI_THEME_VERSION = 87;
    public static MyApp app;
    public static String bseUrl;
    private static Context context;
    public static List<Call> okHttpClientList = new ArrayList();
    public static boolean http = false;
    public static boolean cunkuanneedfinish = false;
    public static boolean tc = true;
    public static int a = 0;
    public static String myphone = "";
    public static String userid = "";
    public static int TYPE = 0;
    public static String qvhao = "";
    public static String roomNumber = "";
    private static final int[] RESOURCE_IDS = {18, 52, 86, 120, 144, 171, 205, 239};
    public static String s1 = "护";
    public static String s2 = "中";
    public static String s = "维";

    public static int getA1() {
        a = 1;
        return 1;
    }

    private int getConfigValue(int i) {
        return i;
    }

    public static Context getContext() {
        return context;
    }

    public static MyApp getInstance() {
        return app;
    }

    public static String getS() {
        return s;
    }

    public static String getS1() {
        return s1;
    }

    public static String getS2() {
        return s2;
    }

    public static void setS(String str) {
        s = str;
    }

    public static void setS1(String str) {
        s1 = str;
    }

    public static void setS2(String str) {
        s2 = str;
    }

    private void initServerUrl() {
        bseUrl = "http://123.207.3.151:8808/";
        if (isDebugBuild()) {
            Log.d("Config", "应用配置已初始化,主服务器URL: " + bseUrl);
        }
    }

    private boolean isDebugBuild() {
        try {
            return (getApplicationInfo().flags & 2) != 0;
        } catch (Exception unused) {
            return false;
        }
    }

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        context = getApplicationContext();
        okHttpClientList = new ArrayList();
        try {
            initServerUrl();
            initOtherComponents();
            if (isDebugBuild()) {
                Log.d("URL验证", "主服务器URL: " + bseUrl);
                new Handler().postDelayed(new MyApp$.ExternalSyntheticLambda0(), 100L);
            }
        } catch (Exception e) {
            Log.e("MyApp", "初始化服务器URL失败", e);
            String str = bseUrl;
            if (str == null || str.isEmpty()) {
                bseUrl = "http://39.108.87.170:8071/";
            }
        }
        Thread.setDefaultUncaughtExceptionHandler(new MyApp$.ExternalSyntheticLambda1(this));
    }

    static void lambda$onCreate$0() {
        if (Content.BASEURL == null || Content.BASEURL.isEmpty()) {
            Log.e("URL验证", "API服务器URL未正确初始化!");
        } else {
            Log.d("URL验证", "API服务器URL: " + Content.BASEURL);
        }
    }

    void m19lambda$onCreate$1$comxiuerappbaseMyApp(Thread thread, Throwable th) {
        StringWriter stringWriter = new StringWriter();
        th.printStackTrace(new PrintWriter(stringWriter));
        String stringWriter2 = stringWriter.toString();
        String format = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.getDefault()).format(new Date());
        String str = "crash_" + format + ".txt";
        try {
            File file = new File(getExternalFilesDir(null), "crash_logs");
            if (!file.exists()) {
                file.mkdirs();
            }
            File file2 = new File(file, str);
            FileWriter fileWriter = new FileWriter(file2);
            fileWriter.write("Crash Time: " + format + "\n\n");
            fileWriter.write("Stack Trace:\n");
            fileWriter.write(stringWriter2);
            fileWriter.close();
            Log.e("APP_CRASH", "Crash log saved to " + file2.getAbsolutePath());
        } catch (Exception e) {
            Log.e("APP_CRASH", "Failed to save crash log", e);
        }
        Process.killProcess(Process.myPid());
        System.exit(1);
    }

    private void initOtherComponents() {
        Content.initializeComponents(APP_VERSION_CODE, CONFIG_BUILD_NUMBER, UI_THEME_VERSION, NETWORK_TIMEOUT, RESOURCE_IDS);
    }

    @Override
    protected void attachBaseContext(Context context2) {
        super.attachBaseContext(context2);
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
    }

    public static String getVersionName() {
        try {
            return getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0).versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            return "1.0.0";
        }
    }

    public static int getVersionCode() {
        try {
            return getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            return 1;
        }
    }

    public static String tt() {
        return getS() + getS1() + getS2();
    }

    public static int getA() {
        int a1 = getA1() + 20250530;
        a = a1;
        return a1;
    }
}