导航菜单

页面标题

页面副标题

Antivirus Cleaner v1.2.0.0 - TUBTWebView.java 源代码

正在查看: Antivirus Cleaner v1.2.0.0 应用的 TUBTWebView.java JAVA 源代码文件

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


package com.thinkup.expressad.video.bt.module;

import android.content.Context;
import android.content.res.Configuration;
import android.net.http.SslError;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.view.View;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.thinkup.core.express.o0.o;
import com.thinkup.expressad.atsignalcommon.mraid.IMraidJSBridge;
import com.thinkup.expressad.atsignalcommon.windvane.WindVaneWebView;
import com.thinkup.expressad.atsignalcommon.windvane.m0;
import com.thinkup.expressad.foundation.m0.ooo;
import com.thinkup.expressad.m.on;
import com.thinkup.expressad.out.oo;
import com.thinkup.expressad.video.bt.o.n;
import com.thinkup.expressad.video.signal.o.mm;
import com.thinkup.expressad.videocommon.oo.o0;
import java.util.List;
import org.json.JSONObject;

public class TUBTWebView extends BTBaseView implements IMraidJSBridge, on {
    private static final String o0n = "portrait";
    private static final String oo0 = "landscape";
    private String o00;
    private String o0m;
    private String o0o;
    private o0 om0;
    private WindVaneWebView omm;
    private mm omn;
    private List<com.thinkup.expressad.foundation.o0.o0> omo;
    private WebView on0;
    private ImageView oom;
    private boolean oon;
    private boolean ooo;

    public TUBTWebView(Context context) {
        super(context);
        this.ooo = false;
        this.oon = false;
    }

    public void broadcast(String str, JSONObject jSONObject) {
        if (this.omm != null) {
            try {
                JSONObject jSONObject2 = new JSONObject();
                jSONObject2.put("code", BTBaseView.nm);
                jSONObject2.put("id", this.o0);
                jSONObject2.put("eventName", str);
                jSONObject2.put("data", jSONObject);
                m0.o();
                o.o((WebView) this.omm, "broadcast", Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
            } catch (Exception unused) {
                n.o();
                n.o((WebView) this.omm, "broadcast", this.o0);
            }
        }
    }

    @Override
    public void close() {
        WebView webView = this.on0;
        if (webView != null) {
            BTBaseView.o(webView, "onPlayerCloseBtnClicked", this.o0);
        }
    }

    public List<com.thinkup.expressad.foundation.o0.o0> getCampaigns() {
        return this.omo;
    }

    public String getFilePath() {
        return this.o0o;
    }

    public String getFileURL() {
        return this.o00;
    }

    public String getHtml() {
        return this.o0m;
    }

    @Override
    public com.thinkup.expressad.foundation.o0.o0 getMraidCampaign() {
        return this.m;
    }

    public o0 getRewardUnitSetting() {
        return this.om0;
    }

    public WindVaneWebView getWebView() {
        return this.omm;
    }

    @Override
    public void init(Context context) {
        WindVaneWebView windVaneWebView = new WindVaneWebView(context);
        this.omm = windVaneWebView;
        windVaneWebView.setBackgroundColor(0);
        this.omm.setVisibility(0);
        mm mmVar = new mm(null, this.m, this.omo);
        this.omn = mmVar;
        mmVar.o(this.n);
        this.omm.setObject(this.omn);
        this.omm.setMraidObject(this);
        this.omm.setWebViewListener(new com.thinkup.expressad.atsignalcommon.m.o() {
            @Override
            public final void o(Object obj) {
                super.o(obj);
                try {
                    String mo = TUBTWebView.this.omn != null ? TUBTWebView.this.omn.mo() : "";
                    m0.o().o(obj, TextUtils.isEmpty(mo) ? "" : Base64.encodeToString(mo.getBytes(), 2));
                } catch (Throwable th) {
                    th.getMessage();
                }
            }

            @Override
            public final void onPageFinished(WebView webView, String str) {
                super.onPageFinished(webView, str);
                if (TUBTWebView.this.on0 != null) {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("id", TUBTWebView.this.o0);
                        jSONObject.put("code", BTBaseView.nm);
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put("id", TUBTWebView.this.o0);
                        jSONObject2.put("result", 1);
                        jSONObject.put("data", jSONObject2);
                        m0.o();
                        o.o(TUBTWebView.this.on0, "onWebviewLoad", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
                    } catch (Exception e) {
                        n.o();
                        n.o(TUBTWebView.this.on0, e.getMessage());
                        e.getMessage();
                    }
                }
                m0.o();
                o.o(TUBTWebView.this.omm);
            }

            @Override
            public final void onReceivedError(WebView webView, int i, String str, String str2) {
                super.onReceivedError(webView, i, str, str2);
                if (TUBTWebView.this.on0 != null) {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("id", TUBTWebView.this.o0);
                        jSONObject.put("code", BTBaseView.nm);
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put("id", TUBTWebView.this.o0);
                        jSONObject2.put("result", 2);
                        jSONObject2.put("error", str);
                        jSONObject.put("data", jSONObject2);
                        m0.o();
                        o.o(TUBTWebView.this.on0, "onWebviewLoad", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
                    } catch (Exception e) {
                        n.o();
                        n.o(TUBTWebView.this.on0, e.getMessage());
                        e.getMessage();
                    }
                }
            }

            @Override
            public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
                super.onReceivedSslError(webView, sslErrorHandler, sslError);
                if (TUBTWebView.this.on0 != null) {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("id", TUBTWebView.this.o0);
                        jSONObject.put("code", BTBaseView.nm);
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put("id", TUBTWebView.this.o0);
                        jSONObject2.put("result", 2);
                        jSONObject2.put("error", sslError.toString());
                        jSONObject.put("data", jSONObject2);
                        m0.o();
                        o.o(TUBTWebView.this.on0, "onWebviewLoad", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
                    } catch (Exception e) {
                        n.o();
                        n.o(TUBTWebView.this.on0, e.getMessage());
                        e.getMessage();
                    }
                }
            }

            @Override
            public final void readyState(WebView webView, int i) {
                super.readyState(webView, i);
            }
        });
        addView(this.omm, new FrameLayout.LayoutParams(-1, -1));
        setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                if (TUBTWebView.this.on0 != null) {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("code", BTBaseView.nm);
                        jSONObject.put("id", TUBTWebView.this.o0);
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put("x", String.valueOf(view.getX()));
                        jSONObject2.put("y", String.valueOf(view.getY()));
                        jSONObject.put("data", jSONObject2);
                        m0.o();
                        o.o(TUBTWebView.this.on0, "onClicked", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
                    } catch (Exception unused) {
                        n.o();
                        n.o(TUBTWebView.this.on0, "onClicked", TUBTWebView.this.o0);
                    }
                }
            }
        });
        try {
            ImageView imageView = new ImageView(getContext());
            this.oom = imageView;
            imageView.setImageResource(findDrawable("thinkup_reward_close"));
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(96, 96);
            layoutParams.gravity = 8388661;
            layoutParams.setMargins(30, 30, 30, 30);
            this.oom.setLayoutParams(layoutParams);
            this.oom.setVisibility(this.ooo ? 4 : 8);
            com.thinkup.expressad.foundation.o0.o0 o0Var = this.m;
            if (o0Var != null && o0Var.m0n()) {
                this.oom.setVisibility(4);
            }
            this.oom.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    TUBTWebView.this.close();
                }
            });
            addView(this.oom);
        } catch (Throwable th) {
            th.getMessage();
        }
    }

    public void notifyEvent(String str) {
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView != null) {
            BTBaseView.o(windVaneWebView, str, this.o0);
        }
    }

    public void onBackPressed() {
        if (this.omm != null) {
            n.o();
            n.o((WebView) this.omm, "onSystemBackPressed", this.o0);
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        if (this.omm != null) {
            try {
                JSONObject jSONObject = new JSONObject();
                if (configuration.orientation == 2) {
                    jSONObject.put("orientation", oo0);
                } else {
                    jSONObject.put("orientation", o0n);
                }
                jSONObject.put("instanceId", this.o0);
                String encodeToString = Base64.encodeToString(jSONObject.toString().getBytes(), 2);
                m0.o();
                o.o((WebView) this.omm, "orientation", encodeToString);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    @Override
    public void onDestory() {
        if (this.oon) {
            return;
        }
        this.oon = true;
        try {
            if (this.omm != null) {
                n.o();
                n.o((WebView) this.omm, "onSystemDestory", this.o0);
            }
            new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                @Override
                public final void run() {
                    try {
                        if (TUBTWebView.this.omm != null) {
                            TUBTWebView.this.omm.clearWebView();
                            TUBTWebView.this.omm.release();
                        }
                        TUBTWebView.this.o00 = null;
                        TUBTWebView.this.o0o = null;
                        TUBTWebView.this.o0m = null;
                        if (TUBTWebView.this.on0 != null) {
                            TUBTWebView.this.on0 = null;
                        }
                    } catch (Throwable th) {
                        th.getMessage();
                    }
                }
            }, 500L);
            setOnClickListener(null);
            removeAllViews();
        } catch (Throwable th) {
            th.getMessage();
        }
    }

    @Override
    public void onFinishRedirection(oo ooVar, String str) {
        if (ooVar == null) {
            return;
        }
        ooo.m();
    }

    @Override
    public void onRedirectionFailed(oo ooVar, String str) {
        if (ooVar == null) {
            return;
        }
        ooo.m();
    }

    @Override
    public void onStartRedirection(oo ooVar, String str) {
        ooo.o();
    }

    @Override
    public void open(String str) {
        try {
            String nmm = this.m.nmm();
            if (!TextUtils.isEmpty(str)) {
                this.m.o00(str);
                try {
                    getMraidCampaign();
                } catch (Throwable th) {
                    th.getMessage();
                }
            }
            new com.thinkup.expressad.m.o(getContext(), this.n);
            this.m.o00(nmm);
        } catch (Throwable th2) {
            th2.getMessage();
        }
    }

    public void preload() {
        if (!TextUtils.isEmpty(this.o00)) {
            this.omm.loadUrl(this.o00);
        } else if (!TextUtils.isEmpty(this.o0o)) {
            this.omm.loadUrl(this.o0o);
        } else {
            if (TextUtils.isEmpty(this.o0m)) {
                return;
            }
            this.omm.loadDataWithBaseURL("", this.o0m, "text/html", "UTF-8", null);
        }
    }

    public void setCampaigns(List<com.thinkup.expressad.foundation.o0.o0> list) {
        this.omo = list;
    }

    public void setCreateWebView(WebView webView) {
        this.on0 = webView;
    }

    public void setFilePath(String str) {
        this.o0o = str;
    }

    public void setFileURL(String str) {
        this.o00 = str;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        boolean contains = str.contains("play.google.com");
        setWebviewClickable(!contains);
        if (contains) {
            com.thinkup.core.express.web.o0 o0Var = new com.thinkup.core.express.web.o0();
            WindVaneWebView windVaneWebView = this.omm;
            if (windVaneWebView != null) {
                windVaneWebView.setFilter(o0Var);
            }
        }
    }

    public void setHtml(String str) {
        this.o0m = str;
    }

    @Override
    public void setRewardUnitSetting(o0 o0Var) {
        this.om0 = o0Var;
    }

    public void setWebViewRid(String str) {
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView != null) {
            windVaneWebView.setRid(str);
        }
    }

    public void setWebviewClickable(boolean z) {
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView != null) {
            windVaneWebView.setClickable(z);
        }
    }

    @Override
    public void unload() {
        close();
    }

    @Override
    public void useCustomClose(boolean z) {
        try {
            this.oom.setVisibility(z ? 4 : 0);
        } catch (Throwable th) {
            th.getMessage();
        }
    }

    public boolean webviewGoBack() {
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView == null || !windVaneWebView.canGoBack()) {
            return false;
        }
        this.omm.goBack();
        return true;
    }

    public boolean webviewGoForward() {
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView == null || !windVaneWebView.canGoForward()) {
            return false;
        }
        this.omm.goForward();
        return true;
    }

    public void webviewLoad(int i) {
        if (this.omn == null) {
            this.omn = new mm(null, this.m, this.omo);
        }
        com.thinkup.expressad.foundation.o0.o0 o0Var = this.m;
        if (o0Var != null) {
            this.omn.o(o0Var);
        } else {
            List<com.thinkup.expressad.foundation.o0.o0> list = this.omo;
            if (list != null && list.size() > 0) {
                this.omn.o(this.omo);
                if (this.omo.size() == 1) {
                    this.omn.o(this.omo.get(0));
                }
            }
        }
        o0 o0Var2 = this.om0;
        if (o0Var2 != null) {
            this.omn.o(o0Var2);
        }
        this.omn.o(this.n);
        this.omn.n(this.o0);
        if (i == 1) {
            this.omn.o0o();
        }
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView != null) {
            windVaneWebView.setObject(this.omn);
        }
        com.thinkup.expressad.foundation.o0.o0 o0Var3 = this.m;
        if (o0Var3 != null && o0Var3.m0n()) {
            this.oom.setVisibility(4);
        }
        preload();
    }

    public boolean webviewReload() {
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView == null) {
            return false;
        }
        windVaneWebView.reload();
        return true;
    }

    private void m() {
        try {
            getMraidCampaign();
        } catch (Throwable th) {
            th.getMessage();
        }
    }

    public TUBTWebView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.ooo = false;
        this.oon = false;
    }

    private void o(com.thinkup.core.express.web.o0 o0Var) {
        WindVaneWebView windVaneWebView = this.omm;
        if (windVaneWebView != null) {
            windVaneWebView.setFilter(o0Var);
        }
    }

    @Override
    public void expand(String str, boolean z) {
    }
}