小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.jufu.kakahua.base.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import androidx.databinding.ViewDataBinding;
import androidx.databinding.g;
import com.blankj.utilcode.util.ToastUtils;
import com.blankj.utilcode.util.n;
import com.jufu.kakahua.base.BaseWebViewFragment;
import com.jufu.kakahua.base.R;
import com.jufu.kakahua.common.databinding.FragmentWebviewBinding;
import com.jufu.kakahua.common.view.ExtendedWebView;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import k8.p;
import k8.q;
import k8.x;
import kotlin.jvm.internal.l;
import kotlin.text.v;
public final class AgreementWebFragment extends BaseWebViewFragment {
    public Map<Integer, View> _$_findViewCache;
    private FragmentWebviewBinding binding;
    private final String url;

    public AgreementWebFragment(String url) {
        l.e(url, "url");
        this._$_findViewCache = new LinkedHashMap();
        this.url = url;
    }

    @Override
    public void _$_clearFindViewByIdCache() {
        this._$_findViewCache.clear();
    }

    @Override
    public View _$_findCachedViewById(int i10) {
        View findViewById;
        Map<Integer, View> map = this._$_findViewCache;
        View view = map.get(Integer.valueOf(i10));
        if (view == null) {
            View view2 = getView();
            if (view2 == null || (findViewById = view2.findViewById(i10)) == null) {
                return null;
            }
            map.put(Integer.valueOf(i10), findViewById);
            return findViewById;
        }
        return view;
    }

    @Override
    protected String extrasUrl() {
        return this.url;
    }

    @Override
    protected WebChromeClient getWebChromeClient() {
        return new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView webView, int i10) {
                FragmentWebviewBinding fragmentWebviewBinding;
                super.onProgressChanged(webView, i10);
                n.t(l.l("网页加载当前进度>>>", Integer.valueOf(i10)));
                fragmentWebviewBinding = AgreementWebFragment.this.binding;
                if (fragmentWebviewBinding == null) {
                    l.t("binding");
                    fragmentWebviewBinding = null;
                }
                ProgressBar progressBar = fragmentWebviewBinding.pbLoading;
                l.d(progressBar, "binding.pbLoading");
                progressBar.setVisibility(i10 == 100 ? 8 : 0);
            }

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

            @Override
            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
                return super.onShowFileChooser(webView, valueCallback, fileChooserParams);
            }
        };
    }

    @Override
    protected WebView getWebView() {
        FragmentWebviewBinding fragmentWebviewBinding = this.binding;
        if (fragmentWebviewBinding == null) {
            l.t("binding");
            fragmentWebviewBinding = null;
        }
        ExtendedWebView extendedWebView = fragmentWebviewBinding.webView;
        l.d(extendedWebView, "binding.webView");
        return extendedWebView;
    }

    @Override
    protected WebViewClient getWebViewClient() {
        return new WebViewClient() {
            @Override
            public void onPageFinished(WebView webView, String str) {
                if (webView != null) {
                    webView.loadUrl("javascript:window.handle.show(document.body.innerHTML);");
                }
                super.onPageFinished(webView, str);
            }

            @Override
            public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
                if (sslErrorHandler == null) {
                    return;
                }
                sslErrorHandler.proceed();
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
                Uri url;
                Object m442constructorimpl;
                boolean C;
                List<ResolveInfo> queryIntentActivities;
                boolean z10;
                Uri url2;
                Object m442constructorimpl2;
                boolean C2;
                Uri url3;
                Object m442constructorimpl3;
                boolean C3;
                if (webResourceRequest != null && (url3 = webResourceRequest.getUrl()) != null) {
                    AgreementWebFragment agreementWebFragment = AgreementWebFragment.this;
                    try {
                        p.a aVar = p.Companion;
                        String uri = url3.toString();
                        l.d(uri, "toString()");
                        C3 = v.C(uri, "weixin://wap/pay?", false, 2, null);
                    } catch (Throwable th) {
                        p.a aVar2 = p.Companion;
                        m442constructorimpl3 = p.m442constructorimpl(q.a(th));
                    }
                    if (C3) {
                        Intent intent = new Intent();
                        intent.setAction("android.intent.action.VIEW");
                        intent.setData(Uri.parse(url3.toString()));
                        agreementWebFragment.startActivity(intent);
                        return true;
                    }
                    m442constructorimpl3 = p.m442constructorimpl(x.f20192a);
                    AgreementWebFragment agreementWebFragment2 = AgreementWebFragment.this;
                    if (p.m445exceptionOrNullimpl(m442constructorimpl3) != null) {
                        ToastUtils.v(agreementWebFragment2.getString(R.string.open_wechat_pay_faild), new Object[0]);
                        return true;
                    }
                    p.m441boximpl(m442constructorimpl3);
                }
                if (webResourceRequest != null && (url2 = webResourceRequest.getUrl()) != null) {
                    AgreementWebFragment agreementWebFragment3 = AgreementWebFragment.this;
                    try {
                        p.a aVar3 = p.Companion;
                        String uri2 = url2.toString();
                        l.d(uri2, "toString()");
                        C2 = v.C(uri2, "alipay", false, 2, null);
                    } catch (Throwable th2) {
                        p.a aVar4 = p.Companion;
                        m442constructorimpl2 = p.m442constructorimpl(q.a(th2));
                    }
                    if (C2) {
                        agreementWebFragment3.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url2.toString())));
                        return true;
                    }
                    m442constructorimpl2 = p.m442constructorimpl(x.f20192a);
                    AgreementWebFragment agreementWebFragment4 = AgreementWebFragment.this;
                    if (p.m445exceptionOrNullimpl(m442constructorimpl2) != null) {
                        ToastUtils.v(agreementWebFragment4.getString(R.string.not_found_alipay_client), new Object[0]);
                        agreementWebFragment4.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://d.alipay.com")));
                        return true;
                    }
                    p.m441boximpl(m442constructorimpl2);
                }
                if (webResourceRequest != null && (url = webResourceRequest.getUrl()) != null) {
                    AgreementWebFragment agreementWebFragment5 = AgreementWebFragment.this;
                    try {
                        p.a aVar5 = p.Companion;
                        String uri3 = url.toString();
                        l.d(uri3, "toString()");
                        C = v.C(uri3, "http", false, 2, null);
                    } catch (Throwable th3) {
                        p.a aVar6 = p.Companion;
                        m442constructorimpl = p.m442constructorimpl(q.a(th3));
                    }
                    if (!C) {
                        Intent intent2 = new Intent("android.intent.action.VIEW", Uri.parse(url.toString()));
                        Context requireContext = agreementWebFragment5.requireContext();
                        PackageManager packageManager = requireContext.getPackageManager();
                        if (packageManager != null && (queryIntentActivities = packageManager.queryIntentActivities(intent2, 65536)) != null && (!queryIntentActivities.isEmpty())) {
                            z10 = true;
                            if (z10) {
                                requireContext.startActivity(intent2);
                            }
                            return true;
                        }
                        z10 = false;
                        if (z10) {
                        }
                        return true;
                    }
                    m442constructorimpl = p.m442constructorimpl(x.f20192a);
                    AgreementWebFragment agreementWebFragment6 = AgreementWebFragment.this;
                    if (p.m445exceptionOrNullimpl(m442constructorimpl) != null) {
                        ToastUtils.v(agreementWebFragment6.getString(R.string.open_page_faild), new Object[0]);
                        return true;
                    }
                    p.m441boximpl(m442constructorimpl);
                }
                return super.shouldOverrideUrlLoading(webView, webResourceRequest);
            }
        };
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
        l.e(inflater, "inflater");
        ViewDataBinding h10 = g.h(inflater, R.layout.fragment_webview, viewGroup, false);
        FragmentWebviewBinding fragmentWebviewBinding = (FragmentWebviewBinding) h10;
        fragmentWebviewBinding.setLifecycleOwner(getViewLifecycleOwner());
        l.d(h10, "inflate<FragmentWebviewB…wLifecycleOwner\n        }");
        this.binding = fragmentWebviewBinding;
        if (fragmentWebviewBinding == null) {
            l.t("binding");
            fragmentWebviewBinding = null;
        }
        View root = fragmentWebviewBinding.getRoot();
        l.d(root, "binding.root");
        return root;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        _$_clearFindViewByIdCache();
    }

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        l.e(view, "view");
        super.onViewCreated(view, bundle);
        webSetting();
        BaseWebViewFragment.loadUrl$default(this, null, 1, null);
    }

    @Override
    public void webSetting() {
        super.webSetting();
        getWebView().addJavascriptInterface(this, "Android");
    }
}