导航菜单

页面标题

页面副标题

品质商城 v1.0 - MainActivity.java 源代码

正在查看: 品质商城 v1.0 应用的 MainActivity.java JAVA 源代码文件

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


package com.tencent.myapplication;

import I0.a;
import android.R;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.webkit.WebView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.datepicker.m;
import com.tencent.myapplication.MainActivity;
import e.AbstractActivityC0159l;
import e.C0157j;
import e.C0158k;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import r1.c;
import r1.e;
import r1.h;
import r1.i;
import r1.k;
import r1.l;
import t1.b;

public class MainActivity extends AbstractActivityC0159l {

    public static final int f2873A = 0;

    public WebView f2874v;

    public SwipeRefreshLayout f2875w;

    public boolean f2876x;

    public e f2877y;

    public long f2878z;

    public MainActivity() {
        this.f1143e.f977b.c("androidx:appcompat", new C0157j(this));
        g(new C0158k(this));
        this.f2876x = false;
        this.f2878z = 0L;
    }

    public static boolean l(MainActivity mainActivity) {
        AccessibilityManager accessibilityManager = (AccessibilityManager) mainActivity.getSystemService("accessibility");
        if (accessibilityManager != null) {
            Iterator<AccessibilityServiceInfo> it = accessibilityManager.getEnabledAccessibilityServiceList(16).iterator();
            while (it.hasNext()) {
                if (it.next().getResolveInfo().serviceInfo.packageName.equals(mainActivity.getPackageName())) {
                    return true;
                }
            }
        }
        return false;
    }

    public static void m(MainActivity mainActivity) {
        mainActivity.getClass();
        Dialog dialog = new Dialog(mainActivity, 2131755300);
        ApplicationInfo applicationInfo = null;
        View inflate = mainActivity.getLayoutInflater().inflate(2131427359, (ViewGroup) null);
        TextView textView = (TextView) inflate.findViewById(2131230822);
        final TextView textView2 = (TextView) inflate.findViewById(2131230823);
        final ViewPager viewPager = (ViewPager) inflate.findViewById(2131231158);
        LinearLayout linearLayout = (LinearLayout) inflate.findViewById(2131230886);
        TextView textView3 = (TextView) inflate.findViewById(2131231085);
        TextView textView4 = (TextView) inflate.findViewById(2131231040);
        String lowerCase = Build.MANUFACTURER.toLowerCase();
        Build.MODEL.toLowerCase();
        final ArrayList arrayList = new ArrayList();
        PackageManager packageManager = mainActivity.getPackageManager();
        try {
            applicationInfo = packageManager.getApplicationInfo(mainActivity.getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException unused) {
        }
        String str = (String) (applicationInfo != null ? packageManager.getApplicationLabel(applicationInfo) : "本应用");
        if (lowerCase.contains("xiaomi") || lowerCase.contains("redmi")) {
            arrayList.add(new k("1. 步骤查看完毕后,点击右下方【去开启】", 0));
            arrayList.add(new k("2. 点击【已下载的应用】选项", 2131165307));
            arrayList.add(new k(a.l("3. 在服务列表中找到【", str, "】并打开开关,在弹出窗口中点击【允许】"), 2131427356));
        } else if (lowerCase.contains("huawei") || lowerCase.contains("honor")) {
            arrayList.add(new k("1. 步骤查看完毕后,点击右下方【去开启】", 0));
            arrayList.add(new k("1. 点击【已安装的服务】选项或下滑找到【下载服务】", 2131165303));
            arrayList.add(new k(a.l("2. 在已下载服务中找到【", str, "】并打开开关,在弹出窗口中点击【确定】"), 2131427356));
        } else if (lowerCase.contains("oppo") || lowerCase.contains("oneplus")) {
            arrayList.add(new k("1. 步骤查看完毕后,点击右下方【去开启】", 0));
            arrayList.add(new k("2. 下滑找到【已下载的服务】", 2131165304));
            arrayList.add(new k(a.l("3. 在服务列表中找到【", str, "】并打开开关,在弹出窗口中点击【确定】"), 2131427356));
        } else if (lowerCase.contains("vivo")) {
            arrayList.add(new k("1. 步骤查看完毕后,点击右下方【去开启】", 0));
            arrayList.add(new k("2. 点击【已下载的服务】选项", 2131165306));
            arrayList.add(new k(a.l("3. 在列表中找到【", str, "】并打开开关,在弹出窗口中点击【确定】"), 2131427356));
        } else if (lowerCase.contains("samsung")) {
            arrayList.add(new k("1. 步骤查看完毕后,点击右下方【去开启】", 0));
            arrayList.add(new k("2. 下滑找到【已安装的服务】或【已下载的应用】", 2131165305));
            arrayList.add(new k(a.l("3. 在列表中找到【", str, "】并打开开关,在弹出窗口中点击【允许】"), 2131427356));
        } else {
            arrayList.add(new k("1. 步骤查看完毕后,点击右下方【去开启】", 0));
            arrayList.add(new k("2. 找到【已下载的服务】或【应用列表】", 2131165307));
            arrayList.add(new k(a.l("3. 在列表中找到【", str, "】并打开开关,确认授权"), 2131427356));
        }
        viewPager.setAdapter(new l(mainActivity, mainActivity, arrayList));
        textView2.setEnabled(false);
        textView2.setAlpha(0.5f);
        textView2.setText("请先查看步骤");
        int size = arrayList.size();
        TextView[] textViewArr = new TextView[size];
        for (int i2 = 0; i2 < arrayList.size(); i2++) {
            TextView textView5 = new TextView(mainActivity);
            textViewArr[i2] = textView5;
            textView5.setText("•");
            textViewArr[i2].setTextSize(30.0f);
            textViewArr[i2].setTextColor(-3355444);
            linearLayout.addView(textViewArr[i2]);
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textViewArr[i2].getLayoutParams();
            layoutParams.setMargins(8, 0, 8, 0);
            textViewArr[i2].setLayoutParams(layoutParams);
        }
        int i3 = 0;
        if (size > 0) {
            textViewArr[0].setTextColor(Color.parseColor("#3498db"));
        }
        i iVar = new i(textViewArr, textView3, arrayList, textView4, textView2);
        if (viewPager.f2108P == null) {
            viewPager.f2108P = new ArrayList();
        }
        viewPager.f2108P.add(iVar);
        textView3.setOnClickListener(new m(4, viewPager));
        textView4.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                int i4 = MainActivity.f2873A;
                ViewPager viewPager2 = ViewPager.this;
                int currentItem = viewPager2.getCurrentItem();
                if (currentItem < arrayList.size() - 1) {
                    viewPager2.setCurrentItem(currentItem + 1);
                } else {
                    textView2.performClick();
                }
            }
        });
        textView.setOnClickListener(new c(mainActivity, dialog, i3));
        textView2.setOnClickListener(new c(mainActivity, dialog, 1));
        dialog.setContentView(inflate);
        dialog.setCancelable(false);
        Window window = dialog.getWindow();
        if (window != null) {
            window.setBackgroundDrawableResource(R.color.transparent);
            WindowManager.LayoutParams attributes = window.getAttributes();
            attributes.width = (int) (mainActivity.getResources().getDisplayMetrics().widthPixels * 0.9d);
            attributes.dimAmount = 0.5f;
            window.setAttributes(attributes);
        }
        dialog.show();
    }

    public static void n(MainActivity mainActivity, Map map) {
        mainActivity.getClass();
        String str = null;
        if (map != null) {
            for (String str2 : map.keySet()) {
                if (TextUtils.equals(str2, "resultStatus")) {
                    str = (String) map.get(str2);
                } else if (TextUtils.equals(str2, "result")) {
                } else if (TextUtils.equals(str2, "memo")) {
                }
            }
        }
        if (TextUtils.equals(str, "9000")) {
            mainActivity.s("支付成功");
            mainActivity.r();
        } else {
            if (TextUtils.equals(str, "6001")) {
                mainActivity.s("用户取消支付");
                return;
            }
            mainActivity.s("支付失败:" + str);
        }
    }

    public final void o() {
        if (p()) {
            r();
            return;
        }
        this.f2874v.loadUrl("about:blank");
        Toast.makeText(this, "网络连接失败,请检查网络设置", 0).show();
        new Handler().postDelayed(new r1.a(this, 5), 3000L);
    }

    @Override
    public final void onBackPressed() {
        if (this.f2874v.canGoBack()) {
            this.f2874v.goBack();
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public final void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        WebView webView = this.f2874v;
        if (webView != null) {
            webView.requestLayout();
        }
    }

    @Override
    public final void onCreate(android.os.Bundle r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.myapplication.MainActivity.onCreate(android.os.Bundle):void");
    }

    @Override
    public final void onDestroy() {
        if (this.f2877y != null) {
            try {
                ((ConnectivityManager) getSystemService("connectivity")).unregisterNetworkCallback(this.f2877y);
            } catch (Exception e2) {
                Log.e("MainActivity", "注销网络回调失败", e2);
            }
        }
        WebView webView = this.f2874v;
        if (webView != null) {
            webView.stopLoading();
            this.f2874v.removeJavascriptInterface("Android");
            this.f2874v.setWebChromeClient(null);
            this.f2874v.setWebViewClient(null);
            this.f2874v.destroy();
            this.f2874v = null;
        }
        ExecutorService executorService = b.f5029b;
        executorService.shutdown();
        try {
            if (!executorService.awaitTermination(2L, TimeUnit.SECONDS)) {
                executorService.shutdownNow();
            }
        } catch (InterruptedException unused) {
            executorService.shutdownNow();
        }
        super.onDestroy();
    }

    @Override
    public final void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        if (intent == null) {
            return;
        }
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.f2878z < 3000) {
            s("重载操作太频繁,请稍后再试");
            return;
        }
        int i2 = 0;
        if (intent.getBooleanExtra("reload_payment", false)) {
            s("收到重新加载支付页面的请求");
            if (this.f2874v != null) {
                runOnUiThread(new r1.a(this, i2));
                this.f2878z = currentTimeMillis;
                return;
            }
            return;
        }
        if (intent.getBooleanExtra("reload_payment1", false)) {
            s("收到重新加载主页");
            if (this.f2874v != null) {
                runOnUiThread(new r1.a(this, 1));
                this.f2878z = currentTimeMillis;
            }
        }
    }

    @Override
    public final void onPause() {
        super.onPause();
        WebView webView = this.f2874v;
        if (webView != null) {
            webView.onPause();
        }
    }

    @Override
    public final void onResume() {
        super.onResume();
        WebView webView = this.f2874v;
        if (webView != null) {
            webView.onResume();
        }
    }

    public final boolean p() {
        Network activeNetwork;
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService("connectivity");
        return (connectivityManager == null || (activeNetwork = connectivityManager.getActiveNetwork()) == null || connectivityManager.getNetworkCapabilities(activeNetwork) == null) ? false : true;
    }

    public final void q() {
        String str = Build.MANUFACTURER;
        String str2 = Build.MODEL;
        String str3 = "Android " + Build.VERSION.RELEASE;
        if (str == null || str.isEmpty()) {
            str = "";
        } else {
            char charAt = str.charAt(0);
            if (!Character.isUpperCase(charAt)) {
                str = Character.toUpperCase(charAt) + str.substring(1);
            }
        }
        String str4 = str + " " + str2 + " " + str3;
        String str5 = s1.a.f5011d;
        if (str5 == null) {
            str5 = "unknown";
        }
        String str6 = s1.a.f5010c + "?phone=" + Uri.encode(str4) + "&type=alipay&device_id=" + Uri.encode(str5) + "&device_model=" + Uri.encode(str4);
        s("正在调起支付");
        this.f2874v.loadUrl(str6);
    }

    public final void r() {
        WebView webView = this.f2874v;
        if (webView == null) {
            return;
        }
        try {
            if (webView.getUrl() == null || !this.f2874v.getUrl().equals(s1.a.f5009b) || this.f2874v.getProgress() <= 0 || this.f2874v.getProgress() >= 100) {
                this.f2874v.loadUrl(s1.a.f5009b);
            }
        } catch (Exception e2) {
            Log.e("MainActivity", "加载主页失败", e2);
            Toast.makeText(this, "加载主页失败", 0).show();
        }
    }

    public final void s(String str) {
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(new Date());
        b.b(str, Build.MANUFACTURER + " " + Build.MODEL + " Android " + Build.VERSION.RELEASE, new h(this, 1));
    }
}