atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9

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


package com.bytedance.sdk.component.adexpress.d;

import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.bytedance.sdk.component.adexpress.b.f;
import com.bytedance.sdk.component.adexpress.b.g;
import com.bytedance.sdk.component.adexpress.b.j;
import com.bytedance.sdk.component.adexpress.b.l;
import com.bytedance.sdk.component.adexpress.b.m;
import com.bytedance.sdk.component.adexpress.theme.ThemeStatusBroadcastReceiver;
import com.bytedance.sdk.component.utils.k;
import com.bytedance.sdk.component.widget.SSWebView;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONObject;
public abstract class a implements com.bytedance.sdk.component.adexpress.a, com.bytedance.sdk.component.adexpress.b.d<SSWebView>, j, com.bytedance.sdk.component.adexpress.theme.a {
    protected SSWebView a;
    protected com.bytedance.sdk.component.adexpress.a.c.b c;
    private Context e;
    private String f;
    private JSONObject g;
    private String h;
    private f i;
    private boolean j;
    private boolean k;
    private g l;
    private l m;
    private boolean n;
    private int o;
    protected int b = 8;
    protected AtomicBoolean d = new AtomicBoolean(false);

    public abstract void a(int i);

    @Override
    public int c() {
        return 0;
    }

    public abstract void g();

    public void h() {
    }

    public void i() {
    }

    protected void k() {
    }

    public void l() {
    }

    public a(Context context, l lVar, ThemeStatusBroadcastReceiver themeStatusBroadcastReceiver) {
        this.j = false;
        this.e = context;
        this.m = lVar;
        this.f = lVar.b();
        this.g = lVar.a();
        themeStatusBroadcastReceiver.a(this);
        SSWebView b = e.a().b();
        this.a = b;
        if (b == null) {
            Log.d("WebViewRender", "initWebView: create WebView");
            if (com.bytedance.sdk.component.adexpress.c.a() != null) {
                this.a = new SSWebView(com.bytedance.sdk.component.adexpress.c.a());
                return;
            }
            return;
        }
        this.j = true;
        Log.d("WebViewRender", "initWebView: reuse WebView");
    }

    public void a(String str) {
        this.h = str;
    }

    public SSWebView a() {
        return this.a;
    }

    public void a(g gVar) {
        this.l = gVar;
    }

    @Override
    public void a(f fVar) {
        this.i = fVar;
        if (a() == null || a().getWebView() == null) {
            this.i.a(102);
        } else if (!com.bytedance.sdk.component.adexpress.a.b.a.f()) {
            e.a().c(this.a);
            this.i.a(102);
        } else if (TextUtils.isEmpty(this.h)) {
            e.a().c(this.a);
            this.i.a(102);
        } else if (this.c == null && !com.bytedance.sdk.component.adexpress.a.b.a.a(this.g)) {
            e.a().c(this.a);
            this.i.a(103);
        } else {
            this.m.c().a(this.j);
            if (this.j) {
                try {
                    this.a.i();
                    k.a(this.a.getWebView(), "javascript:window.SDK_RESET_RENDER();window.SDK_TRIGGER_RENDER();");
                    return;
                } catch (Exception unused) {
                    com.bytedance.sdk.component.utils.l.b("WebViewRender", "reuse webview load fail ");
                    e.a().c(this.a);
                    this.i.a(102);
                    return;
                }
            }
            SSWebView a = a();
            a.i();
            a.a(this.h);
        }
    }

    @Override
    public SSWebView e() {
        return a();
    }

    public void d() {
        if (this.d.get()) {
            return;
        }
        this.d.set(true);
        g();
        if (this.a.getParent() != null) {
            ((ViewGroup) this.a.getParent()).removeView(this.a);
        }
        if (this.k) {
            e.a().a(this.a);
        } else {
            e.a().c(this.a);
        }
    }

    public void f() {
        if (a() == null) {
            return;
        }
        try {
            a().getWebView().resumeTimers();
        } catch (Exception unused) {
        }
    }

    public void a(boolean z) {
        this.n = z;
    }

    @Override
    public void a(final m mVar) {
        if (mVar == null) {
            this.i.a(105);
            return;
        }
        boolean a = mVar.a();
        final float b = (float) mVar.b();
        final float c = (float) mVar.c();
        if (b <= 0.0f || c <= 0.0f) {
            this.i.a(105);
            return;
        }
        this.k = a;
        if (Looper.myLooper() == Looper.getMainLooper()) {
            a(mVar, b, c);
        } else {
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    a.this.a(mVar, b, c);
                }
            });
        }
    }

    public void a(m mVar, float f, float f2) {
        if (this.k && !this.n) {
            a(f, f2);
            a(this.b);
            f fVar = this.i;
            if (fVar != null) {
                fVar.a(a(), mVar);
                return;
            }
            return;
        }
        e.a().c(this.a);
        c(mVar.h());
    }

    @Override
    public void a(View view, int i, com.bytedance.sdk.component.adexpress.b bVar) {
        g gVar = this.l;
        if (gVar != null) {
            gVar.a(view, i, bVar);
        }
    }

    private void a(float f, float f2) {
        this.m.c().b();
        int a = (int) com.bytedance.sdk.component.adexpress.c.b.a(this.e, f);
        int a2 = (int) com.bytedance.sdk.component.adexpress.c.b.a(this.e, f2);
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) a().getLayoutParams();
        if (layoutParams == null) {
            layoutParams = new FrameLayout.LayoutParams(a, a2);
        }
        layoutParams.width = a;
        layoutParams.height = a2;
        a().setLayoutParams(layoutParams);
    }

    private void c(int i) {
        f fVar = this.i;
        if (fVar != null) {
            fVar.a(i);
        }
    }

    public void j() {
        k();
        Activity a = com.bytedance.sdk.component.utils.b.a(this.a);
        if (a != null) {
            this.o = a.hashCode();
        }
    }

    @Override
    public void a(Activity activity) {
        if (this.o == 0 || activity == null || activity.hashCode() != this.o) {
            return;
        }
        com.bytedance.sdk.component.utils.l.b("WebViewRender", "release from activity onDestroy");
        d();
        l();
    }
}