BTGO游戏盒 v3.4.80版本的 MD5 值为:000032bab1addaabfdc671ee6a7087ab

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


package com.bbbtgo.sdk.ui.activity;

import a5.h;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.webkit.CookieManager;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import com.bbbtgo.sdk.common.base.BaseSideTitleActivity;
import com.bbbtgo.sdk.common.entity.DownloadAppTipInfo;
import java.util.HashMap;
import m5.q;
import m5.v;
import s5.t;

public class H5PayActivity extends BaseSideTitleActivity<t> implements t.e {
    public static String G = "H5_PAY_RESULT_STATE_CODE";
    public static String H = "H5_PAY_RESULT_MSG";
    public static int I = -1;
    public static String J = "未完成支付";
    public static int K;
    public h A;
    public LinearLayout B;
    public WebView C;
    public boolean D;
    public long E;
    public Handler F = new Handler(new a());

    public int f8910v;

    public String f8911w;

    public String f8912x;

    public boolean f8913y;

    public t f8914z;

    public class a implements Handler.Callback {
        public a() {
        }

        @Override
        public boolean handleMessage(@NonNull Message message) {
            if (message.what == 8808) {
                if (H5PayActivity.I != 1 && H5PayActivity.K < 2 && v.x(H5PayActivity.this) && H5PayActivity.this.f8914z != null) {
                    H5PayActivity.this.f8914z.D(H5PayActivity.this.f8911w);
                    H5PayActivity.J5();
                }
                return true;
            }
            return false;
        }
    }

    public class b extends WebViewClient {
        public b() {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
        }

        @Override
        public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
            super.onReceivedError(webView, webResourceRequest, webResourceError);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            if (!TextUtils.isEmpty(str)) {
                if (!str.toLowerCase().startsWith("http") && !str.toLowerCase().startsWith(com.alipay.sdk.cons.b.f1878a)) {
                    if (!str.startsWith("weixin:") && !str.startsWith("wxpay:")) {
                        if (!str.startsWith("alipays:") && !str.startsWith("alipay")) {
                            return true;
                        }
                        try {
                            H5PayActivity.this.D = true;
                            H5PayActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                        } catch (Exception unused) {
                            H5PayActivity.this.Y4("未检测到支付宝客户端,请安装后重试。");
                        }
                        return true;
                    }
                    try {
                        H5PayActivity.this.D = true;
                        Intent intent = new Intent();
                        intent.setAction("android.intent.action.VIEW");
                        intent.setData(Uri.parse(str));
                        H5PayActivity.this.startActivity(intent);
                    } catch (Exception unused2) {
                        H5PayActivity.this.Y4("未检测到微信客户端,请安装后重试。");
                    }
                    return true;
                }
                if (H5PayActivity.this.f8910v == 202 && str.contains("tenpay")) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("Referer", "https://pay.ipaynow.cn");
                    webView.loadUrl(str, hashMap);
                    return true;
                }
                H5PayActivity.this.S5(str);
                return true;
            }
            return false;
        }
    }

    public static int J5() {
        int i10 = K;
        K = i10 + 1;
        return i10;
    }

    @Override
    public void B5() {
        if (System.currentTimeMillis() - this.E > 2000) {
            x5("再按一次退出本次支付");
            this.E = System.currentTimeMillis();
        } else {
            T5();
        }
    }

    @Override
    public void E3() {
        n4.b.b("H5PayActivity", "##==onQueryTimeOut");
        Y5();
    }

    @Override
    public t a5() {
        t tVar = new t(this);
        this.f8914z = tVar;
        return tVar;
    }

    public final void S5(String str) {
        WebView webView;
        if (!TextUtils.isEmpty(str) && (webView = this.C) != null) {
            webView.loadUrl(str);
        }
    }

    public final void T5() {
        Intent intent = new Intent();
        intent.putExtra(G, I);
        intent.putExtra(H, J);
        setResult(-1, intent);
        finish();
    }

    public final void U5() {
        WebView webView = this.C;
        if (webView == null) {
            return;
        }
        webView.setWebViewClient(new b());
        this.C.setHorizontalScrollBarEnabled(false);
        int i10 = Build.VERSION.SDK_INT;
        WebView.setWebContentsDebuggingEnabled(true);
        CookieManager.getInstance().setAcceptThirdPartyCookies(this.C, true);
        WebSettings settings = this.C.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDefaultTextEncodingName("utf-8");
        settings.setLoadsImagesAutomatically(true);
        if (i10 >= 26) {
            try {
                settings.setSafeBrowsingEnabled(false);
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }
    }

    @Override
    public void V3(int i10, int i11, String str, String str2, DownloadAppTipInfo downloadAppTipInfo) {
        int i12;
        if (i10 != 0) {
            i12 = 1;
        } else {
            i12 = 0;
        }
        I = i12;
        if (i10 == 0) {
            J = "未完成支付";
            if (K >= 2) {
                T5();
                return;
            } else {
                Y5();
                return;
            }
        }
        J = "支付成功";
        T5();
    }

    public final void V5(String str) {
        this.A.i(str);
    }

    public final void W5(String str) {
        n4.b.b("H5PayActivity", "==== specialPayUrl");
        if (!str.startsWith("weixin:") && !str.startsWith("wxpay:")) {
            if (str.startsWith("alipays:") || str.startsWith("alipay")) {
                try {
                    this.D = true;
                    startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                    return;
                } catch (Exception unused) {
                    Y4("未检测到支付宝客户端,请安装后重试。");
                    return;
                }
            }
            return;
        }
        try {
            this.D = true;
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.parse(str));
            startActivity(intent);
        } catch (Exception unused2) {
            Y4("未检测到微信客户端,请安装后重试。");
        }
    }

    public final void X5() {
        if (!TextUtils.isEmpty(this.f8912x) && this.C != null) {
            if (!this.f8912x.startsWith("weixin:") && !this.f8912x.startsWith("wxpay:") && !this.f8912x.startsWith("alipay")) {
                if (!this.f8913y && !this.f8912x.startsWith("http")) {
                    n4.b.b("H5PayActivity", "==== webview加载html");
                    this.C.loadDataWithBaseURL(null, this.f8912x, "text/html", "utf-8", null);
                    return;
                } else {
                    n4.b.b("H5PayActivity", "==== webview加载url");
                    this.C.loadUrl(this.f8912x);
                    return;
                }
            }
            W5(this.f8912x);
        }
    }

    public final void Y5() {
        Handler handler = this.F;
        if (handler != null) {
            handler.sendEmptyMessageDelayed(8808, 2000L);
        }
    }

    @Override
    public void e2(String str) {
        n4.b.b("H5PayActivity", "##==onQueryFailed,errorMsg=" + str);
        Y5();
    }

    @Override
    public void getIntentData() {
        Intent intent = getIntent();
        this.f8910v = intent.getIntExtra("PAYTYPE", -1);
        this.f8911w = intent.getStringExtra("ORDERID");
        this.f8912x = intent.getStringExtra("WEBPAYURL");
        this.f8913y = intent.getBooleanExtra("WEBVIEW_LOAD_TYPE", false);
    }

    @Override
    public void k3() {
        n4.b.b("H5PayActivity", "##==onQueryStart");
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        N1("充值");
        G5(false);
        this.D = false;
        I = -1;
        J = "未完成支付";
        K = 0;
        if (TextUtils.isEmpty(this.f8912x) && this.f8910v != -1) {
            T5();
        }
        LinearLayout linearLayout = (LinearLayout) findViewById(q.e.A4);
        this.B = linearLayout;
        this.A = new h(linearLayout);
        this.C = (WebView) findViewById(q.e.f23721aa);
        U5();
        X5();
        V5("请稍候...");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        try {
            WebView webView = this.C;
            if (webView != null) {
                webView.removeAllViews();
                this.C.stopLoading();
                this.C.destroy();
                this.C = null;
            }
            this.F = null;
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (this.D) {
            n4.b.b("H5PayActivity", "##== onResume,is web pay");
            try {
                Y5();
                V5("正在查询支付结果,请稍候...");
                this.D = false;
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }
    }

    @Override
    public int v5() {
        return q.f.X;
    }
}