导航菜单

页面标题

页面副标题

XT工具箱 v3.6.15 - m.java 源代码

正在查看: XT工具箱 v3.6.15 应用的 m.java JAVA 源代码文件

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


package c.a.a.k.v;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.viewpager.widget.ViewPager;
import c.a.a.k.v.m;
import c.a.a.m.i1;
import c.a.a.m.k1;
import c.a.a.m.l0;
import c.a.a.m.n0;
import c.a.a.m.o0;
import c.a.a.m.q1;
import c.a.a.m.t0;
import c.a.a.m.y1;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import net.fusionapp.core.FusionActivity;
import net.fusionapp.core.FusionApp;
import net.fusionapp.core.R;
import net.fusionapp.core.config.ViewConfig;
import net.fusionapp.core.config.WebControlBean;
import net.fusionapp.core.ui.fragment.IFusionPage;
import net.fusionapp.core.ui.fragment.WebInterface;
import net.fusionapp.core.ui.fragment.WebViewMenuSupport;
import net.fusionapp.core.webcore.AgentWeb;
import net.fusionapp.core.webcore.FusionCoreWebView;
import net.fusionapp.core.webcore.IUrlLoader;
import net.fusionapp.core.webcore.WebIndicator;

public class m extends k implements IFusionPage {
    public static final String o = m.class.getSimpleName();

    public FusionApp f617b;

    public AgentWeb f618c;

    public String f619d;
    public l f;
    public ViewPager g;
    public WebInterface h;
    public WebViewMenuSupport.Interface i;
    public ViewConfig.WebViewBean j;
    public WebViewMenuSupport k;
    public a.e.a.i e = new a.e.a.i();
    public k1 l = new k1() {
        @Override
        public final boolean a(String str, String[] strArr, String str2) {
            m mVar = m.this;
            Objects.requireNonNull(mVar);
            String str3 = m.o;
            StringBuilder e = a.b.a.a.a.e("mUrl:", str, "  permission:");
            e.append(mVar.e.f(strArr));
            e.append(" action:");
            e.append(str2);
            Log.i(str3, e.toString());
            return false;
        }
    };
    public String m = "";
    public y1 n = new c();

    public class a extends c.a.a.m.a2.a {
        public a() {
        }

        @Override
        public void onReceivedTitle(WebView webView, String str) {
            super.onReceivedTitle(webView, str);
            ((FusionActivity) m.this.getActivity()).setTitle(str);
            WebInterface webInterface = m.this.h;
            if (webInterface != null) {
                webInterface.onReceivedTitle(webView, str);
            }
        }
    }

    public class b extends c.a.a.m.d {
        public b() {
        }

        @Override
        public q1 b(final WebView webView, DownloadListener downloadListener) {
            webView.setDownloadListener(new DownloadListener() {
                @Override
                public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                    m.b bVar = m.b.this;
                    WebView webView2 = webView;
                    CoordinatorLayout coordinatorLayout = (CoordinatorLayout) m.this.requireActivity().findViewById(R.id.coordinator_content);
                    String guessFileName = URLUtil.guessFileName(str, null, null);
                    m mVar = m.this;
                    FusionApp fusionApp = mVar.f617b;
                    Snackbar action = Snackbar.make(coordinatorLayout, mVar.requireActivity().getString(R.string.web_download_confirm_message, new Object[]{guessFileName}), -2).setAnimationMode(1).setAction(R.string.agentweb_download, new n(bVar, webView2, str, str2, str3, str4, j));
                    c.a.a.m.q.r(fusionApp, action);
                    action.show();
                }
            });
            return this;
        }

        @Override
        public void d(AgentWeb agentWeb) {
        }

        @Override
        public void e(WebView webView) {
            super.e(webView);
            this.f706a.setLoadWithOverviewMode(m.this.j.isPcMode());
            this.f706a.setUseWideViewPort(m.this.j.isPcMode());
            this.f706a.setBuiltInZoomControls(true);
            this.f706a.setDisplayZoomControls(false);
            this.f706a.setJavaScriptEnabled(m.this.j.isJavaScriptEnabled());
        }
    }

    public class c extends y1 {

        public HashMap<String, Long> f622c = new HashMap<>();

        public c() {
        }

        @Override
        public void onLoadResource(WebView webView, String str) {
            super.onLoadResource(webView, str);
            WebInterface webInterface = m.this.h;
            if (webInterface != null) {
                webInterface.onLoadResource(webView, str);
            }
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            c.a.a.k.r uiColorChanger;
            Integer a2;
            super.onPageFinished(webView, str);
            WebInterface webInterface = m.this.h;
            if (webInterface != null) {
                webInterface.onPageFinished(webView, str);
            }
            ViewPager viewPager = m.this.g;
            if ((viewPager != null && viewPager.getAdapter() != null && ((c.a.a.k.s.c) viewPager.getAdapter()).f563a.indexOf(m.this) != viewPager.getCurrentItem()) || (uiColorChanger = m.this.f617b.getUiManager().getUiColorChanger()) == null || (a2 = c.a.a.k.r.a(webView)) == null) {
                return;
            }
            int intValue = a2.intValue();
            AnimatorSet animatorSet = new AnimatorSet();
            ArrayList arrayList = new ArrayList();
            for (View view : uiColorChanger.f550a) {
                ObjectAnimator ofArgb = ObjectAnimator.ofArgb(view, "backgroundColor", c.a.a.k.r.a(view).intValue(), intValue);
                ofArgb.setEvaluator(uiColorChanger.f551b);
                arrayList.add(ofArgb);
            }
            animatorSet.setDuration(uiColorChanger.f552c.intValue());
            animatorSet.playTogether(arrayList);
            animatorSet.addListener(new c.a.a.k.q(uiColorChanger, intValue));
            animatorSet.start();
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            super.onPageStarted(webView, str, bitmap);
            WebInterface webInterface = m.this.h;
            if (webInterface != null) {
                webInterface.onPageStarted(webView, str, bitmap);
            }
            String str2 = m.o;
            StringBuilder e = a.b.a.a.a.e("mUrl:", str, " onPageStarted  target:");
            e.append(m.this.getUrl());
            Log.i(str2, e.toString());
            this.f622c.put(str, Long.valueOf(System.currentTimeMillis()));
            str.equals(m.this.getUrl());
        }

        @Override
        public void onReceivedError(WebView webView, int i, String str, String str2) {
            super.onReceivedError(webView, i, str, str2);
        }

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

        @Override
        public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
            super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
        }

        @Override
        public void onReceivedSslError(WebView webView, final SslErrorHandler sslErrorHandler, SslError sslError) {
            super.onReceivedSslError(webView, sslErrorHandler, sslError);
            WebInterface webInterface = m.this.h;
            if (webInterface == null || !webInterface.onReceivedSslError(webView, sslErrorHandler, sslError)) {
                new MaterialAlertDialogBuilder(m.this.requireActivity()).setTitle((CharSequence) "SSL Error").setMessage(sslError.getPrimaryError()).setPositiveButton((CharSequence) "ignore", new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        sslErrorHandler.proceed();
                    }
                }).setNegativeButton((CharSequence) "stop", new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        sslErrorHandler.cancel();
                    }
                }).show();
            }
        }

        @Override
        public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
            if (Build.VERSION.SDK_INT < 26 || renderProcessGoneDetail.didCrash()) {
                Log.e("MY_APP_TAG", "The WebView rendering process crashed!");
                return false;
            }
            Log.e("MY_APP_TAG", "System killed the WebView rendering process to reclaim memory. Recreating...");
            if (webView == null) {
                return true;
            }
            ((o0) m.this.f618c.getWebLifeCycle()).a();
            return true;
        }

        @Override
        @Nullable
        public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
            WebInterface webInterface = m.this.h;
            WebResourceResponse shouldInterceptRequest = webInterface != null ? webInterface.shouldInterceptRequest(webView, webResourceRequest) : null;
            return shouldInterceptRequest == null ? super.shouldInterceptRequest(webView, webResourceRequest) : shouldInterceptRequest;
        }

        @Override
        @RequiresApi(api = 21)
        public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
            return super.shouldOverrideUrlLoading(webView, webResourceRequest);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            if (str.startsWith("intent://") && str.contains("com.youku.phone")) {
                return true;
            }
            return super.shouldOverrideUrlLoading(webView, str);
        }
    }

    public m() {
    }

    public m(FusionApp fusionApp, String str, l lVar, ViewConfig.WebViewBean webViewBean) {
        this.f = lVar;
        this.f619d = str;
        this.f617b = fusionApp;
        this.j = webViewBean;
    }

    @Override
    public l0.c getOpenOtherPageWays(int i) {
        return i != 0 ? i != 1 ? l0.c.DISALLOW : l0.c.DERECT : l0.c.ASK;
    }

    @Override
    public t0 getSettings() {
        b bVar = new b();
        String userAgent = this.j.getUserAgent();
        if (userAgent != null) {
            bVar.f707b = userAgent;
        }
        return bVar;
    }

    @Override
    public String getUrl() {
        String str = this.f619d;
        return TextUtils.isEmpty(str) ? "http://www.fusionapp.net/" : str;
    }

    @Override
    public IUrlLoader getUrlLoader() {
        return this.f618c.getUrlLoader();
    }

    @Override
    public ViewPager getViewPager() {
        return this.g;
    }

    @Override
    public WebIndicator getWebIndicator() {
        return this.f618c.getWebIndicator();
    }

    @Override
    public WebView getWebView() {
        return ((n0) this.f618c.getWebCreator()).l;
    }

    @Override
    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        setRetainInstance(true);
    }

    @Override
    @Nullable
    public View onCreateView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        return layoutInflater.inflate(R.layout.fragment_agentweb, viewGroup, false);
    }

    @Override
    public void onDestroyView() {
        AgentWeb agentWeb = this.f618c;
        if (agentWeb != null) {
            ((o0) agentWeb.getWebLifeCycle()).a();
        }
        super.onDestroyView();
    }

    @Override
    public boolean onFragmentKeyDown(int i, KeyEvent keyEvent) {
        AgentWeb agentWeb = this.f618c;
        if (agentWeb == null) {
            return false;
        }
        return agentWeb.handleKeyEvent(i, keyEvent);
    }

    @Override
    public void onPause() {
        o0 o0Var;
        WebView webView;
        AgentWeb agentWeb = this.f618c;
        if (agentWeb != null && (webView = (o0Var = (o0) agentWeb.getWebLifeCycle()).f764a) != null) {
            webView.onPause();
            o0Var.f764a.pauseTimers();
        }
        super.onPause();
    }

    @Override
    public void onResume() {
        o0 o0Var;
        WebView webView;
        AgentWeb agentWeb = this.f618c;
        if (agentWeb != null && (webView = (o0Var = (o0) agentWeb.getWebLifeCycle()).f764a) != null) {
            webView.onResume();
            o0Var.f764a.resumeTimers();
        }
        super.onResume();
    }

    @Override
    @SuppressLint({"ClickableViewAccessibility"})
    public void onViewCreated(View view, @Nullable Bundle bundle) {
        AgentWeb go;
        String str;
        super.onViewCreated(view, bundle);
        if (isAdded() && !getUrl().equals("about:none")) {
            i1 i1Var = new i1(getActivity());
            i1Var.addJavascriptInterface(new FusionCoreWebView.LuaJavaScriptInterface((c.a.a.h) this.f617b.getLuaSupport()), "androlua");
            i1Var.setOnUrlLoadListener(new d(this, i1Var));
            l lVar = this.f;
            if (lVar == null) {
                return;
            }
            List<WebControlBean> list = lVar.f616c;
            if (list != null && list.size() > 0) {
                for (WebControlBean webControlBean : list) {
                    String removes = webControlBean.getRemoves();
                    String format = (TextUtils.isEmpty(removes) || removes.trim().equals("")) ? null : String.format("(function () {\n  function _____blockElements() {\n    try {\n      const eleCollectionStr = \"%s\";\n      for (var selector of eleCollectionStr.split(\",\")) {\n        if (selector == \"\")\n          break;\n        for (var ele of document.querySelectorAll(selector)) {\n          if (ele === undefined)\n            break;\n          ele.remove()\n        }\n      }\n    } catch (_) { console.error(\"Fatal: 元素屏蔽脚本出现问题 (blockElementFunc):\", _) }\n  }\n  try {\n    window.onload = _____blockElements();\n    _____blockElements();\n    var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;\n    var observer = new MutationObserver(function (records, instance) {\n      _____blockElements();\n    });\n    window.____isInject === undefined && observer.observe(document, {\n      childList: true,\n      subtree: true,\n      attributes: false,\n      attributeOldValue: false,\n      characterData: false\n    });\n    window.____isInject = 0;\n  } catch (_) { console.error(\"Fatal: 元素屏蔽脚本出现问题:\", _) }\n})()", removes);
                    if (format != null) {
                        i1Var.b(webControlBean.getHost(), format);
                    }
                    String script = webControlBean.getScript();
                    if (!TextUtils.isEmpty(script) && !script.trim().equals("")) {
                        String host = webControlBean.getHost();
                        StringBuilder o2 = a.b.a.a.a.o("\n");
                        o2.append(webControlBean.getScript());
                        i1Var.b(host, o2.toString());
                    }
                }
            }
            i1Var.setDarkMode(this.f.f615b);
            AgentWeb.b with = AgentWeb.with(this);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
            with.f943b = (LinearLayout) view;
            with.f945d = layoutParams;
            with.f944c = -1;
            with.g = this.f.f614a;
            with.i = 3;
            with.j = i1Var;
            b bVar = new b();
            String userAgent = this.j.getUserAgent();
            if (userAgent != null) {
                bVar.f707b = userAgent;
            }
            with.h = bVar;
            with.e = this.n;
            with.f = new a();
            with.k = this.l;
            with.l = new c.a.a.m.a2.b(getActivity());
            with.o = R.layout.web_error_page;
            with.p = -1;
            int openOtherPageWays = this.j.getOpenOtherPageWays();
            with.m = openOtherPageWays != 0 ? openOtherPageWays != 1 ? l0.c.DISALLOW : l0.c.DERECT : l0.c.ASK;
            with.n = true;
            if (with.q == 1) {
                Objects.requireNonNull(with.f943b, "ViewGroup is null,Please check your parameters .");
            }
            AgentWeb agentWeb = new AgentWeb(with);
            agentWeb.ready();
            go = agentWeb.go(getUrl());
            this.f618c = go;
            ((n0) go.getWebCreator()).l.setOverScrollMode(2);
            if (this.j.isPcMode()) {
                i1Var.setScrollBarStyle(33554432);
                i1Var.setScrollbarFadingEnabled(false);
                i1Var.c("if(document&&!document.getElementById('var_inject')){var meta=document.createElement('meta');meta.id='var_inject';meta.setAttribute('name','viewport');meta.setAttribute('content','minimum-scale=0.1, initial-scale=0.1, maximum-scale=10, user-scalable=yes');var o=document.getElementsByTagName('head');if(o.length>0&&o[0].appendChild(meta)){document.body.style.zoom=1}}");
            }
            WebViewMenuSupport webViewMenuSupport = new WebViewMenuSupport(this, i1Var);
            this.k = webViewMenuSupport;
            i1Var.setOnTouchListener(webViewMenuSupport.t);
            i1Var.setOnLongClickListener(this.k.s);
            WebViewMenuSupport.Interface r9 = this.i;
            if (r9 != null) {
                this.k.g = r9;
            }
            if (this.f617b.isDevMode()) {
                if (TextUtils.isEmpty(this.m)) {
                    try {
                        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getContext().getAssets().open("preloadjs/vconsole.js")));
                        StringBuilder sb = new StringBuilder();
                        while (true) {
                            String readLine = bufferedReader.readLine();
                            if (readLine == null) {
                                break;
                            } else {
                                sb.append(readLine);
                            }
                        }
                        str = sb.toString();
                    } catch (IOException e) {
                        e.printStackTrace();
                        str = "(function() {})";
                    }
                } else {
                    str = this.m;
                }
                String format2 = String.format("__injectFlag_%1$s__", "vconsolejs");
                StringBuilder sb2 = new StringBuilder();
                sb2.append("try{(function(){if(window.");
                sb2.append(format2);
                sb2.append("){console.log('");
                sb2.append(format2);
                sb2.append(" has been injected');return;}window.");
                i1Var.c(a.b.a.a.a.n(sb2, format2, "=true;", str, "}())}catch(e){console.warn(e)}"));
            }
            WebView.setWebContentsDebuggingEnabled(true);
        }
    }

    @Override
    public void setMenuInterface(WebViewMenuSupport.Interface r2) {
        WebViewMenuSupport webViewMenuSupport = this.k;
        if (webViewMenuSupport == null) {
            this.i = r2;
        } else {
            webViewMenuSupport.g = r2;
        }
    }

    @Override
    public void setViewPager(ViewPager viewPager) {
        this.g = viewPager;
    }

    @Override
    public void setWebInterface(WebInterface webInterface) {
        this.h = webInterface;
    }

    @Override
    public void toCleanWebCache() {
        AgentWeb agentWeb = this.f618c;
        if (agentWeb != null) {
            agentWeb.clearWebCache();
        }
    }
}