导航菜单

页面标题

页面副标题

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

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

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


package com.xiuer.app.ui.home;

import android.R;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.core.widgets.Optimizer;
import com.xiuer.app.base.MyApp;
import com.xiuer.app.ui.home.MainActivity3$;

public class MainActivity3 extends AppCompatActivity {
    private static final String TAG = "MainActivity2";
    private TextView countdownText;
    private int countdownTime = 120;
    private Handler mainHandler;
    private TextView statusText;

    static int access$010(MainActivity3 mainActivity3) {
        int i = mainActivity3.countdownTime;
        mainActivity3.countdownTime = i - 1;
        return i;
    }

    static {
        Log.e(TAG, "MainActivity2类已加载");
    }

    protected void onCreate(Bundle bundle) {
        try {
            super.onCreate(bundle);
            Log.e(TAG, "onCreate开始执行");
            Toast.makeText(getApplicationContext(), "MainActivity2启动中...", 1).show();
            getWindow().setFlags(Optimizer.OPTIMIZATION_GROUPING, Optimizer.OPTIMIZATION_GROUPING);
            if (getWindow() == null) {
                Log.e(TAG, "窗口不可用");
                Toast.makeText(getApplicationContext(), "窗口初始化失败", 1).show();
                finish();
                return;
            }
            Log.e(TAG, "准备创建基本视图");
            setContentView(new FrameLayout(this));
            FrameLayout frameLayout = (FrameLayout) findViewById(R.id.content);
            if (frameLayout == null) {
                Log.e(TAG, "无法获取根布局");
                Toast.makeText(getApplicationContext(), "无法获取根布局", 1).show();
                finish();
                return;
            }
            frameLayout.setBackgroundColor(-65536);
            Log.e(TAG, "根布局背景设置为红色");
            TextView textView = new TextView(this);
            textView.setText("DEBUG: MainActivity2已启动");
            textView.setTextSize(30.0f);
            textView.setTextColor(-1);
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
            layoutParams.gravity = 49;
            layoutParams.topMargin = 100;
            frameLayout.addView(textView, layoutParams);
            Log.e(TAG, "调试文本已添加");
            Handler handler = new Handler(Looper.getMainLooper());
            this.mainHandler = handler;
            handler.postDelayed(new MainActivity3$.ExternalSyntheticLambda0(this, frameLayout), 500L);
            Log.e(TAG, "MainActivity2 onCreate完成");
        } catch (Exception e) {
            Log.e(TAG, "MainActivity2 onCreate致命错误: " + e.getMessage());
            e.printStackTrace();
            try {
                Toast.makeText(getApplicationContext(), "启动失败: " + e.getMessage(), 1).show();
            } catch (Exception unused) {
            }
        }
    }

    void m45lambda$onCreate$0$comxiuerappuihomeMainActivity3(FrameLayout frameLayout) {
        try {
            Log.e(TAG, "开始创建基础UI");
            createBasicUI(frameLayout);
            startCountdown();
        } catch (Exception e) {
            Log.e(TAG, "延迟创建UI失败: " + e.getMessage());
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), "UI创建失败: " + e.getMessage(), 1).show();
        }
    }

    private void createBasicUI(FrameLayout frameLayout) {
        try {
            Log.e(TAG, "createBasicUI开始执行");
            LinearLayout linearLayout = new LinearLayout(this);
            linearLayout.setOrientation(1);
            linearLayout.setGravity(17);
            linearLayout.setPadding(40, 40, 40, 40);
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setColor(Color.parseColor("#102030"));
            gradientDrawable.setCornerRadius(20.0f);
            linearLayout.setBackground(gradientDrawable);
            TextView textView = new TextView(this);
            this.statusText = textView;
            textView.setText("正在为您注册中");
            this.statusText.setTextSize(22.0f);
            this.statusText.setTextColor(-1);
            this.statusText.setPadding(0, 0, 0, 30);
            linearLayout.addView(this.statusText);
            Log.e(TAG, "状态文本已添加");
            TextView textView2 = new TextView(this);
            try {
                String str = "房间号: " + (MyApp.roomNumber != null ? MyApp.roomNumber : "未知");
                textView2.setText(str);
                Log.e(TAG, "房间号设置为: " + str);
            } catch (Exception e) {
                Log.e(TAG, "设置房间号失败: " + e.getMessage());
                textView2.setText("房间号: 获取失败");
            }
            textView2.setTextSize(18.0f);
            textView2.setTextColor(-3355444);
            textView2.setPadding(0, 0, 0, 30);
            linearLayout.addView(textView2);
            TextView textView3 = new TextView(this);
            this.countdownText = textView3;
            textView3.setText("120s");
            this.countdownText.setTextSize(20.0f);
            this.countdownText.setTextColor(-16711681);
            linearLayout.addView(this.countdownText);
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
            layoutParams.gravity = 17;
            frameLayout.addView(linearLayout, layoutParams);
            Log.e(TAG, "基础UI创建成功");
            Toast.makeText(getApplicationContext(), "UI创建完成", 0).show();
        } catch (Exception e2) {
            Log.e(TAG, "创建基础UI失败: " + e2.getMessage());
            Toast.makeText(getApplicationContext(), "UI创建失败: " + e2.getMessage(), 1).show();
            e2.printStackTrace();
        }
    }

    private void startCountdown() {
        try {
            Log.e(TAG, "开始倒计时");
            this.mainHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    try {
                        MainActivity3.access$010(MainActivity3.this);
                        if (MainActivity3.this.countdownText != null) {
                            MainActivity3.this.countdownText.setText(MainActivity3.this.countdownTime + "s");
                            Log.d(MainActivity3.TAG, "更新倒计时: " + MainActivity3.this.countdownTime);
                        }
                        if (MainActivity3.this.countdownTime > 0) {
                            MainActivity3.this.mainHandler.postDelayed(this, 1000L);
                            return;
                        }
                        if (MainActivity3.this.statusText != null) {
                            MainActivity3.this.statusText.setText("注册完成");
                            Log.e(MainActivity3.TAG, "倒计时结束,状态更新为:注册完成");
                        }
                        Toast.makeText((Context) MainActivity3.this, (CharSequence) "注册完成", 0).show();
                    } catch (Exception e) {
                        Log.e(MainActivity3.TAG, "倒计时更新失败: " + e.getMessage());
                    }
                }
            }, 1000L);
        } catch (Exception e) {
            Log.e(TAG, "启动倒计时失败: " + e.getMessage());
        }
    }

    protected void onStart() {
        super.onStart();
        Log.e(TAG, "onStart生命周期方法被调用");
    }

    protected void onResume() {
        super.onResume();
        Log.e(TAG, "onResume生命周期方法被调用");
    }

    protected void onPause() {
        super.onPause();
        Log.e(TAG, "onPause生命周期方法被调用");
    }

    protected void onStop() {
        super.onStop();
        Log.e(TAG, "onStop生命周期方法被调用");
    }

    protected void onDestroy() {
        super.onDestroy();
        Log.e(TAG, "onDestroy生命周期方法被调用");
        Handler handler = this.mainHandler;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
    }
}