红果免费短剧 v6.2.3.32版本的 MD5 值为:a6b05492607eab2c8a25f26d2f238ae0

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


package com.bytedance.bdturing.e;

import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import com.bytedance.accountseal.a.l;
import org.json.JSONException;
import org.json.JSONObject;

public class b {

    public WebView f13823a;

    public Handler f13824b;

    public void a() {
        if (this.f13823a == null) {
            return;
        }
        this.f13824b.post(new Runnable() {

            WebView f13828a;

            @Override
            public void run() {
                WebView webView = this.f13828a;
                if (webView != null) {
                    webView.stopLoading();
                    this.f13828a.loadUrl("about:blank");
                    this.f13828a.clearCache(true);
                    this.f13828a.clearHistory();
                    ViewParent parent = this.f13828a.getParent();
                    if (parent != null && (parent instanceof ViewGroup)) {
                        ((ViewGroup) parent).removeView(this.f13828a);
                    }
                    this.f13828a.destroy();
                }
            }

            {
                this.f13828a = b.this.f13823a;
            }
        });
        this.f13824b = null;
        this.f13823a = null;
    }

    private class a {

        public com.bytedance.bdturing.e.a f13830a;

        @JavascriptInterface
        public void offMethodParams(String str) {
            com.bytedance.bdturing.c.d("JsBridgeModule", "JS called method ======= offMethodParams(" + str + ")");
        }

        @JavascriptInterface
        public void callMethodParams(final String str) {
            com.bytedance.bdturing.c.d("JsBridgeModule", "JS called method ======= callMethodParams(" + str + ")");
            if (b.this.f13824b == null) {
                com.bytedance.bdturing.c.a("JsBridgeModule", "uihandler is null");
            } else {
                b.this.f13824b.post(new Runnable() {
                    @Override
                    public void run() {
                        a.this.f13830a.c(new c(b.this, str));
                    }
                });
            }
        }

        @JavascriptInterface
        public void onMethodParams(String str) {
            com.bytedance.bdturing.c.d("JsBridgeModule", "JS called method ======= onMethodParams(" + str + ")");
            try {
                new JSONObject(str).getString(l.k);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        public a(com.bytedance.bdturing.e.a aVar) {
            this.f13830a = aVar;
        }
    }

    public class C0478b {

        public com.bytedance.bdturing.e.a f13834a;

        @JavascriptInterface
        public String _invokeMethod(final String str) {
            com.bytedance.bdturing.c.d("JsBridgeModule", "JS called method ======= _invokeMethod(" + str + ")");
            if (b.this.f13824b == null) {
                com.bytedance.bdturing.c.a("JsBridgeModule", "uihandler is null");
                return null;
            }
            b.this.f13824b.post(new Runnable() {
                @Override
                public void run() {
                    C0478b.this.f13834a.c(new c(b.this, str));
                }
            });
            return null;
        }

        public C0478b(com.bytedance.bdturing.e.a aVar) {
            this.f13834a = aVar;
        }
    }

    public void a(final String str) {
        Handler handler;
        if (str != null && this.f13823a != null && (handler = this.f13824b) != null) {
            handler.post(new Runnable() {

                WebView f13825a;

                @Override
                public void run() {
                    if (this.f13825a != null) {
                        if (Build.VERSION.SDK_INT >= 19) {
                            this.f13825a.evaluateJavascript("javascript:window.Native2JSBridge._handleMessageFromApp(" + str + ")", null);
                            StringBuilder sb = new StringBuilder();
                            sb.append("callJsCode ====== ");
                            sb.append(str);
                            com.bytedance.bdturing.c.b("JsBridgeModule", sb.toString());
                            return;
                        }
                        this.f13825a.loadUrl("javascript:window.Native2JSBridge._handleMessageFromApp('" + str + "')");
                    }
                }

                {
                    this.f13825a = b.this.f13823a;
                }
            });
            com.bytedance.bdturing.c.d("JsBridgeModule", "callJsCode ====== " + str);
        }
    }

    public b(com.bytedance.bdturing.e.a aVar, WebView webView) {
        this.f13824b = null;
        this.f13823a = webView;
        if (webView == null) {
            return;
        }
        webView.getSettings().setJavaScriptEnabled(true);
        this.f13823a.addJavascriptInterface(new a(aVar), "androidJsBridge");
        this.f13824b = new Handler(Looper.getMainLooper());
    }
}