package com.bytedance.sdk.openadsdk.core.model;

import a3.r;
import android.R;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.http.SslError;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.DownloadListener;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.media3.common.MimeTypes;
import androidx.media3.exoplayer.ExoPlayer;
import b6.b;
import com.bykv.vk.openvk.preload.falconx.loader.ILoader;
import com.bykv.vk.openvk.preload.geckox.model.WebResourceResponseModel;
import com.bytedance.sdk.component.adexpress.dynamic.dynamicview.a;
import com.bytedance.sdk.openadsdk.BuildConfig;
import com.bytedance.sdk.openadsdk.activity.single.TTCeilingLandingPageActivity;
import com.bytedance.sdk.openadsdk.core.hxv;
import com.bytedance.sdk.openadsdk.utils.bx;
import com.bytedance.sdk.openadsdk.utils.xgn;
import com.bytedance.sdk.openadsdk.utils.zan;
import com.bytedance.sdk.openadsdk.yz.lb;
import com.google.android.gms.measurement.internal.u1;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

/* JADX INFO: loaded from: classes2.dex */
public class wey implements Handler.Callback {
    private FrameLayout ado;
    private long ai;
    RelativeLayout ajl;
    private LinearLayout.LayoutParams aws;
    private int bkb;
    private boolean bx;
    com.bytedance.sdk.openadsdk.core.lb.fm dsz;
    b duv;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    ObjectAnimator f7217ef;
    private Handler fhx;
    ImageView fm;

    /* JADX INFO: renamed from: gc, reason: collision with root package name */
    private int f7218gc;
    private TextView gof;
    private TextView gqi;
    private View gzf;

    /* JADX INFO: renamed from: ha, reason: collision with root package name */
    private String f7219ha;
    private com.bytedance.sdk.openadsdk.common.duv hi;
    private FrameLayout hlt;
    private final View hxv;
    private View irt;
    private ro jm;
    View jnr;
    ObjectAnimator ku;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    TextView f7221lb;
    private int lmk;
    private com.bytedance.sdk.component.ef.wsy lse;
    private com.bytedance.sdk.openadsdk.core.widget.fm.ajl lz;
    private hxv maa;
    private com.bytedance.sdk.openadsdk.core.vt.sds mj;
    private com.bytedance.sdk.openadsdk.yz.dsz mon;
    private com.bytedance.sdk.openadsdk.common.jnr mpp;
    private ImageView mq;
    private ValueAnimator no;
    private View nt;
    com.bytedance.sdk.openadsdk.core.lb.ro onz;
    private com.bytedance.sdk.openadsdk.core.widget.qhl pcm;
    private final com.bytedance.sdk.openadsdk.core.fhx.yz.ro pkk;

    /* JADX INFO: renamed from: qb, reason: collision with root package name */
    private final boolean f7223qb;

    /* JADX INFO: renamed from: qf, reason: collision with root package name */
    private String f7224qf;
    private View qhl;
    FrameLayout ro;
    private TextView sds;
    private ILoader si;
    private com.bytedance.sdk.openadsdk.core.ajl.wu so;

    /* JADX INFO: renamed from: te, reason: collision with root package name */
    private com.bytedance.sdk.openadsdk.onz.yz f7225te;
    private boolean tzk;
    ValueAnimator vt;
    private com.bytedance.sdk.openadsdk.core.ajl.yz vvj;
    private final Activity wbw;
    private com.bytedance.sdk.openadsdk.core.widget.qhl wey;
    final lse wsy;
    FrameLayout wu;
    private com.bytedance.sdk.openadsdk.sds.fm.fm.lb xgn;
    private AtomicBoolean ywr;
    FrameLayout yz;
    private final AtomicBoolean ol = new AtomicBoolean(false);
    private final AtomicBoolean zan = new AtomicBoolean(false);

    /* JADX INFO: renamed from: ib, reason: collision with root package name */
    private volatile int f7220ib = 0;

    /* JADX INFO: renamed from: ne, reason: collision with root package name */
    private volatile int f7222ne = 0;
    private volatile int kwx = 0;
    private float bwv = -1.0f;
    private final AtomicBoolean rka = new AtomicBoolean(false);
    private long pbk = -1;
    private final AtomicBoolean lcp = new AtomicBoolean(false);
    private long zow = 0;

    public static class fm implements com.bytedance.sdk.component.jnr.wu {
        @Override // com.bytedance.sdk.component.jnr.wu
        public Bitmap fm(Bitmap bitmap) {
            return com.bytedance.sdk.component.adexpress.yz.fm.fm(com.bytedance.sdk.openadsdk.core.gof.fm(), bitmap, 25);
        }
    }

    public static class ro implements com.bytedance.sdk.openadsdk.yz.duv {
        private final int fm;

        /* JADX INFO: renamed from: lb, reason: collision with root package name */
        private final String f7228lb;
        private final lse ro;
        private final WeakReference<wey> yz;

        public ro(int i10, lse lseVar, String str, wey weyVar) {
            this.fm = i10;
            this.ro = lseVar;
            this.f7228lb = str;
            this.yz = new WeakReference<>(weyVar);
        }

        @Override // com.bytedance.sdk.openadsdk.yz.duv
        public void fm(int i10) {
            wey weyVar = this.yz.get();
            if (weyVar != null) {
                lb.fm.fm(this.fm, weyVar.kwx, weyVar.f7222ne, weyVar.f7220ib - weyVar.f7222ne, this.ro, this.f7228lb, i10);
            }
        }
    }

    public wey(Activity activity, final lse lseVar, String str, FrameLayout frameLayout, com.bytedance.sdk.openadsdk.core.fhx.yz.ro roVar, View view) {
        this.wbw = activity;
        this.wsy = lseVar;
        this.f7219ha = str;
        this.pkk = roVar;
        this.hxv = view;
        this.f7218gc = bx.fm(str);
        if (lseVar != null) {
            this.f7224qf = lseVar.kec();
        }
        this.f7223qb = lseVar.qf() && ajl(lseVar);
        if (!TextUtils.isEmpty(this.f7224qf)) {
            this.si = com.bytedance.sdk.openadsdk.wsy.ro.fm().ro();
            int iFm = com.bytedance.sdk.openadsdk.wsy.ro.fm().fm(this.si, this.f7224qf);
            this.bkb = iFm;
            this.lmk = iFm > 0 ? 2 : 0;
        }
        boolean zYz = yz(lseVar);
        boolean zWu = wu(lseVar);
        boolean zRo = ro(lseVar);
        if (zRo) {
            this.f7219ha = "landingpage_split_screen";
        } else if (zYz) {
            this.f7219ha = "landingpage_direct";
        } else if (zWu) {
            this.f7219ha = "aggregate_page";
        } else if (lb(lseVar)) {
            this.f7219ha = "landingpage_split_ceiling";
        }
        this.dsz = new com.bytedance.sdk.openadsdk.core.lb.fm(com.bytedance.sdk.openadsdk.core.gof.fm(), lseVar, this.f7219ha, bx.fm(str));
        HashMap map = new HashMap();
        map.put("click_scence", 1);
        this.dsz.fm(map);
        View viewFindViewById = activity.findViewById(R.id.content);
        this.dsz.ro(viewFindViewById);
        com.bytedance.sdk.openadsdk.core.lb.ro roVar2 = new com.bytedance.sdk.openadsdk.core.lb.ro(activity, lseVar, this.f7219ha, bx.fm(str), true) { // from class: com.bytedance.sdk.openadsdk.core.model.wey.1
            @Override // com.bytedance.sdk.openadsdk.core.lb.ro
            public boolean fm(duv duvVar, Map<String, Object> map2) {
                if (wey.ku(lseVar) && wey.this.lz != null) {
                    wey.this.lz.fm(duvVar);
                    wey.this.lz.fm(map2);
                    if (wey.vt(wey.this.wsy) || wey.this.tzk) {
                        return true;
                    }
                }
                return super.fm(duvVar, map2);
            }
        };
        this.onz = roVar2;
        roVar2.fm(map);
        this.onz.ro(viewFindViewById);
        this.wu = frameLayout;
        if (zRo || zYz || zWu) {
            try {
                this.fhx = new Handler(Looper.getMainLooper(), this);
            } catch (Exception unused) {
                return;
            }
        }
        if (lseVar.qf()) {
            return;
        }
        if (zYz || zWu) {
            Handler handler = this.fhx;
            handler.sendMessage(handler.obtainMessage(100, 0, 0));
        }
    }

    public static /* synthetic */ int duv(wey weyVar) {
        int i10 = weyVar.f7220ib;
        weyVar.f7220ib = i10 + 1;
        return i10;
    }

    public static /* synthetic */ int fhx(wey weyVar) {
        int i10 = weyVar.kwx;
        weyVar.kwx = i10 + 1;
        return i10;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public boolean lb(int i10) {
        return i10 == 1 || i10 == 2 || i10 == 4 || i10 == 5;
    }

    public static /* synthetic */ int onz(wey weyVar) {
        int i10 = weyVar.f7222ne;
        weyVar.f7222ne = i10 + 1;
        return i10;
    }

    public void fm(b bVar) {
        this.duv = bVar;
    }

    @Override // android.os.Handler.Callback
    public boolean handleMessage(@NonNull Message message) {
        lse lseVar;
        lse lseVar2;
        int i10 = message.what;
        if (i10 == 100) {
            int i11 = message.arg1;
            long jYz = (!yz(this.wsy) || (lseVar2 = this.wsy) == null || lseVar2.hlt() == null) ? (!wu(this.wsy) || (lseVar = this.wsy) == null || lseVar.hlt() == null) ? 20L : this.wsy.hlt().yz() : this.wsy.hlt().ro();
            b bVar = this.duv;
            if (bVar != null) {
                bVar.fm(((long) i11) * 1000, jYz * 1000);
            }
            long j10 = i11;
            if (j10 >= jYz) {
                b bVar2 = this.duv;
                if (bVar2 != null) {
                    bVar2.fm(jYz * 1000, 100);
                }
            } else if (j10 < jYz && this.fhx != null) {
                Message messageObtain = Message.obtain();
                messageObtain.what = 100;
                messageObtain.arg1 = i11 + 1;
                this.fhx.sendMessageDelayed(messageObtain, 1000L);
            }
        } else if (i10 == 101) {
            vt();
        }
        return true;
    }

    public static boolean ajl(lse lseVar) {
        nt ntVarJd;
        return lseVar != null && lseVar.oy() == 3 && !ai.ro(lseVar) && (lseVar.lvj() == 0.0f || lseVar.lvj() == 100.0f) && (ntVarJd = lseVar.jd()) != null && ntVarJd.fm() == 1;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void dsz() {
        this.ol.get();
        this.zan.get();
        if (this.ol.get() || this.zan.get()) {
            return;
        }
        this.ol.set(true);
        fm(0);
        long jElapsedRealtime = this.pbk == -1 ? 0L : SystemClock.elapsedRealtime() - this.pbk;
        if (lb(this.wsy)) {
            com.bytedance.sdk.openadsdk.yz.lb.lb(this.wsy, this.f7219ha, jElapsedRealtime);
        }
        com.bytedance.sdk.openadsdk.yz.lb.fm(this.wsy, this.f7219ha, System.currentTimeMillis() - this.ai, true);
        onz();
    }

    private void duv() {
        hxv hxvVar = new hxv(this.wbw);
        this.maa = hxvVar;
        hxvVar.fm(this.pkk);
        this.maa.ro(this.lse).fm(com.bytedance.sdk.openadsdk.core.vt.ro.lb.fm(this.wsy)).lb(this.wsy.eo()).yz(this.wsy.gt()).fm(this.wsy).ro(wu(this.wsy) ? this.f7218gc : -1).fm(this.wsy.zh()).ro(this.f7219ha).jnr(this.wsy.uuz()).fm(this.lse).fm(new com.bytedance.sdk.openadsdk.core.widget.jnr() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.17
            @Override // com.bytedance.sdk.openadsdk.core.widget.jnr
            public void fm() {
                if (wey.wu(wey.this.wsy) && (wey.this.wbw instanceof com.bytedance.sdk.openadsdk.core.fhx.yz.ro)) {
                    ((com.bytedance.sdk.openadsdk.core.fhx.yz.ro) wey.this.wbw).pkk();
                } else if (wey.this.lz != null) {
                    wey.this.lz.lb();
                }
            }
        });
    }

    public static boolean ef(lse lseVar) {
        return yz(lseVar) && !duv(lseVar);
    }

    /* JADX INFO: Access modifiers changed from: private */
    @SuppressLint({"ClickableViewAccessibility"})
    public void fhx() {
        LinearLayout.LayoutParams layoutParams;
        if (this.ol.get()) {
            return;
        }
        irt();
        this.zan.set(true);
        fm(-1);
        this.pkk.duv();
        com.bytedance.sdk.openadsdk.common.duv duvVar = this.hi;
        if (duvVar != null) {
            duvVar.ro();
        }
        if (wu(this.wsy)) {
            com.bytedance.sdk.openadsdk.yz.lb.fm(System.currentTimeMillis(), this.wsy, this.f7219ha, "show_agg_backup");
            View view = this.qhl;
            if (view != null) {
                view.setVisibility(0);
                RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.qhl.getLayoutParams();
                layoutParams2.addRule(13);
                layoutParams2.addRule(10, 0);
                this.qhl.setLayoutParams(layoutParams2);
                RelativeLayout relativeLayout = this.ajl;
                if (relativeLayout != null) {
                    relativeLayout.setOnClickListener(new View.OnClickListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.2
                        @Override // android.view.View.OnClickListener
                        public void onClick(View view2) {
                        }
                    });
                    return;
                }
                return;
            }
            return;
        }
        this.irt.setVisibility(0);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.irt.getLayoutParams();
        layoutParams3.addRule(13);
        layoutParams3.addRule(10, 0);
        this.irt.setLayoutParams(layoutParams3);
        if (this.wsy.ff() != null && !TextUtils.isEmpty(this.wsy.ff().fm())) {
            com.bytedance.sdk.openadsdk.wey.ro.ro().fm(this.wsy.ff().fm(), this.wsy.ff().ro(), this.wsy.ff().lb(), this.wey, this.wsy);
        }
        this.gof.setText(this.wsy.wjb());
        this.gqi.setText(this.wsy.nn());
        if (this.sds != null) {
            ro();
            this.sds.setClickable(true);
            this.sds.setOnClickListener(this.dsz);
            this.sds.setOnTouchListener(this.dsz);
        }
        if (!lb(this.wsy) || (layoutParams = this.aws) == null) {
            return;
        }
        if (layoutParams.weight < 30.0f) {
            yz(8);
        } else {
            yz(0);
        }
    }

    private void gof() {
        if (yz()) {
            this.nt.setVisibility(0);
            ObjectAnimator duration = ObjectAnimator.ofFloat(this.mq, "translationY", 16.0f, 0.0f).setDuration(500L);
            this.f7217ef = duration;
            duration.setRepeatMode(2);
            this.f7217ef.setRepeatCount(-1);
            this.f7217ef.start();
            this.nt.setClickable(true);
            this.nt.setOnTouchListener(new View.OnTouchListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.5
                @Override // android.view.View.OnTouchListener
                public boolean onTouch(View view, MotionEvent motionEvent) {
                    if (!wey.this.tzk) {
                        wey.this.onz.onTouch(view, motionEvent);
                    }
                    if (motionEvent.getAction() != 3 && motionEvent.getAction() != 1) {
                        return false;
                    }
                    wey.this.vt = ObjectAnimator.ofFloat(this, "timeSlide", 0.0f, 1.0f);
                    wey.this.vt.setDuration(200L);
                    wey.this.vt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.5.1
                        @Override // android.animation.ValueAnimator.AnimatorUpdateListener
                        public void onAnimationUpdate(ValueAnimator valueAnimator) {
                            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) wey.this.hlt.getLayoutParams();
                            layoutParams.weight = (float) (((double) (((Float) valueAnimator.getAnimatedValue()).floatValue() * 2.07f)) + 0.25d);
                            wey.this.fm((float) (0.800000011920929d - (((double) ((Float) valueAnimator.getAnimatedValue()).floatValue()) * 0.5d)));
                            wey.this.hlt.setLayoutParams(layoutParams);
                        }
                    });
                    if (wey.this.onz.ajl()) {
                        wey.this.nt.performClick();
                        wey.this.tzk = true;
                    }
                    wey.this.vt.start();
                    wey.this.nt.setVisibility(8);
                    return true;
                }
            });
            this.nt.setOnClickListener(this.onz);
        }
        if (!gqi()) {
            this.wu.setVisibility(8);
            this.ro.setVisibility(0);
            this.fm.setScaleType(ImageView.ScaleType.FIT_CENTER);
            this.fm.setOnClickListener(new View.OnClickListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.6
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    wey weyVar = wey.this;
                    com.bytedance.sdk.openadsdk.yz.lb.ro(weyVar.wsy, weyVar.f7219ha);
                }
            });
            lse lseVar = this.wsy;
            if (lseVar != null && lseVar.pyj() != null && this.wsy.pyj().size() > 0 && this.wsy.pyj().get(0) != null && !TextUtils.isEmpty(this.wsy.pyj().get(0).fm())) {
                com.bytedance.sdk.openadsdk.wey.ro.ro().fm(this.wsy.pyj().get(0), this.fm, this.wsy, new com.bytedance.sdk.component.jnr.irt() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.7
                    @Override // com.bytedance.sdk.component.jnr.irt
                    public void fm(com.bytedance.sdk.component.jnr.ku kuVar) {
                        if (wey.this.fhx != null) {
                            wey.this.fhx.removeMessages(101);
                        }
                    }

                    @Override // com.bytedance.sdk.component.jnr.irt
                    public void fm(int i10, String str, @Nullable Throwable th) {
                        if (wey.this.fhx != null) {
                            wey.this.fhx.removeMessages(101);
                        }
                        wey.this.vt();
                    }
                });
            }
        }
        try {
            String strFm = this.wsy.pyj().get(0).fm();
            com.bytedance.sdk.openadsdk.vt.yz.fm().fm(strFm).fm(this.wsy.pyj().get(0).ro()).ro(this.wsy.pyj().get(0).lb()).jnr(zan.jnr(com.bytedance.sdk.openadsdk.core.gof.fm())).yz(zan.lb(com.bytedance.sdk.openadsdk.core.gof.fm())).lb(1).fm(new fm()).fm(new com.bytedance.sdk.openadsdk.vt.ro(this.wsy, strFm, new com.bytedance.sdk.component.jnr.irt() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.8
                @Override // com.bytedance.sdk.component.jnr.irt
                public void fm(int i10, String str, @Nullable Throwable th) {
                }

                @Override // com.bytedance.sdk.component.jnr.irt
                public void fm(com.bytedance.sdk.component.jnr.ku kuVar) {
                    Drawable bitmapDrawable;
                    try {
                        Object objRo = kuVar.ro();
                        if (objRo != null && kuVar.lb() != null) {
                            if (objRo instanceof Bitmap) {
                                bitmapDrawable = new BitmapDrawable(com.bytedance.sdk.openadsdk.core.gof.fm().getResources(), (Bitmap) objRo);
                            } else if (objRo instanceof Drawable) {
                                if (Build.VERSION.SDK_INT >= 28 && r.D(objRo)) {
                                    a.h(objRo).start();
                                }
                                bitmapDrawable = (Drawable) objRo;
                            } else {
                                bitmapDrawable = null;
                            }
                            if (!wey.this.gqi()) {
                                wey.this.ro.setBackground(bitmapDrawable);
                                return;
                            }
                            wey.this.yz.setBackground(bitmapDrawable);
                            View viewIrt = wey.this.pkk.irt();
                            if (viewIrt == null || !(viewIrt.getParent() instanceof View)) {
                                return;
                            }
                            ((View) viewIrt.getParent()).setBackground(bitmapDrawable);
                        }
                    } catch (Exception unused) {
                    }
                }
            }));
        } catch (Exception unused) {
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public boolean gqi() {
        return lse.jnr(this.wsy);
    }

    private void irt() {
        if ((yz(this.wsy) || wu(this.wsy)) && (this.wbw instanceof com.bytedance.sdk.openadsdk.core.fhx.yz.ro)) {
            this.pkk.pcm();
            this.pkk.qhl();
        }
    }

    public static boolean jnr(lse lseVar) {
        return lseVar != null && lseVar.oy() == 3 && lseVar.ywr() == 5;
    }

    @SuppressLint({"ClickableViewAccessibility"})
    private void ku() {
        com.bytedance.sdk.component.ef.wsy wsyVar = this.lse;
        if (wsyVar != null && wsyVar.getWebView() != null) {
            com.bytedance.sdk.openadsdk.core.widget.fm.yz.fm(com.bytedance.sdk.openadsdk.core.gof.fm()).fm(false).ro(false).fm(this.lse.getWebView());
            com.bytedance.sdk.component.ef.wsy wsyVar2 = this.lse;
            if (wsyVar2 != null && wsyVar2.getWebView() != null) {
                this.jm = new ro(this.bkb, this.wsy, this.f7219ha, this);
                if (this.lse.k_() && (this.lse.getWebViewClient() instanceof com.bytedance.sdk.openadsdk.core.widget.fm.ajl)) {
                    com.bytedance.sdk.openadsdk.yz.dsz dszVarRo = ((com.bytedance.sdk.openadsdk.core.widget.fm.ajl) this.lse.getWebViewClient()).ro();
                    this.mon = dszVarRo;
                    if (dszVarRo != null) {
                        dszVarRo.fm(this.jm);
                        this.mon.ro(true);
                    }
                } else {
                    this.mon = new com.bytedance.sdk.openadsdk.yz.dsz(this.wsy, this.lse.getWebView(), this.jm, this.lmk).ro(true);
                }
                this.mon.fm(this.f7219ha);
                this.f7225te = new com.bytedance.sdk.openadsdk.onz.yz(this.mon);
                com.bytedance.sdk.openadsdk.common.jnr jnrVarFm = bx.fm(this.wsy, this.lse, this.wbw, this.f7219ha);
                this.mpp = jnrVarFm;
                if (jnrVarFm != null) {
                    jnrVarFm.fm(this.f7219ha);
                }
                bx.fm(this.wsy, this.lse);
            }
            duv();
            if (this.lse.k_()) {
                wey();
            }
            this.lse.setLandingPage(true);
            this.lse.setTag(this.f7219ha);
            this.lse.setMaterialMeta(this.wsy.ooo());
            com.bytedance.sdk.openadsdk.core.widget.fm.ajl ajlVar = new com.bytedance.sdk.openadsdk.core.widget.fm.ajl(com.bytedance.sdk.openadsdk.core.gof.fm(), this.maa, this.wsy.eo(), this.mpp, this.mon, true) { // from class: com.bytedance.sdk.openadsdk.core.model.wey.12
                @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
                public void onPageFinished(WebView webView, String str) {
                    super.onPageFinished(webView, str);
                    wey.this.dsz();
                }

                @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
                public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
                    super.onPageStarted(webView, str, bitmap);
                    wey.this.pkk.pcm();
                    wey.this.ai = System.currentTimeMillis();
                    if (!wey.ro(wey.this.wsy) || wey.this.fhx == null || lse.jnr(wey.this.wsy)) {
                        return;
                    }
                    wey.this.fhx.sendEmptyMessageDelayed(101, ExoPlayer.DEFAULT_DETACH_SURFACE_TIMEOUT_MS);
                }

                @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
                public void onReceivedError(WebView webView, int i10, String str, String str2) {
                    super.onReceivedError(webView, i10, str, str2);
                    String strYz = com.bytedance.sdk.openadsdk.core.widget.fm.ajl.yz(str2);
                    boolean z10 = false;
                    if (this.ajl != null) {
                        this.ajl.fm(webView, i10, str, str2, com.bytedance.sdk.openadsdk.core.widget.fm.ajl.yz(str2), (webView == null || str2 == null || !str2.equals(webView.getUrl())) ? false : true);
                    }
                    boolean z11 = strYz != null && strYz.startsWith(MimeTypes.BASE_TYPE_IMAGE);
                    if (strYz != null && strYz.startsWith("mp4")) {
                        z10 = true;
                    }
                    if (z11 || z10 || wey.this.ol.get()) {
                        return;
                    }
                    wey.this.fhx();
                }

                @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
                public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
                    if (sslErrorHandler != null) {
                        wey.this.fhx();
                    }
                    super.onReceivedSslError(webView, sslErrorHandler, sslError);
                }

                @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
                public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
                    try {
                        if (TextUtils.isEmpty(wey.this.f7224qf)) {
                            return super.shouldInterceptRequest(webView, str);
                        }
                        wey.duv(wey.this);
                        WebResourceResponseModel webResourceResponseModelFm = com.bytedance.sdk.openadsdk.wsy.ro.fm().fm(wey.this.si, wey.this.f7224qf, str);
                        if (webResourceResponseModelFm != null && webResourceResponseModelFm.getWebResourceResponse() != null) {
                            wey.onz(wey.this);
                            return webResourceResponseModelFm.getWebResourceResponse();
                        }
                        if (webResourceResponseModelFm != null && webResourceResponseModelFm.getMsg() == 2) {
                            wey.fhx(wey.this);
                        }
                        return super.shouldInterceptRequest(webView, str);
                    } catch (Throwable th) {
                        com.bytedance.sdk.component.utils.wey.fm("LandingPageModel", "shouldInterceptRequest url error", th);
                        return super.shouldInterceptRequest(webView, str);
                    }
                }

                @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
                public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                    if (!wey.lb(wey.this.wsy) || bx.fm(webView) != 1) {
                        return super.shouldOverrideUrlLoading(webView, str);
                    }
                    Intent intent = new Intent(wey.this.wbw, (Class<?>) TTCeilingLandingPageActivity.class);
                    wey.this.wsy.jnr(str);
                    intent.putExtra("meta_index", com.bytedance.sdk.openadsdk.core.ai.fm().fm(wey.this.wsy));
                    com.bytedance.sdk.component.utils.ro.fm(this.yz, intent, null);
                    return true;
                }
            };
            this.lz = ajlVar;
            this.lse.setWebViewClient(ajlVar);
            this.lz.fm(this.wsy);
            this.lz.fm(this.f7219ha);
            this.lz.fm(this.pkk);
            com.bytedance.sdk.openadsdk.onz.yz yzVar = this.f7225te;
            if (yzVar != null) {
                this.lz.fm(yzVar);
            }
            this.lse.setWebChromeClient(new com.bytedance.sdk.openadsdk.core.widget.fm.jnr(this.maa, this.mon, this.mpp) { // from class: com.bytedance.sdk.openadsdk.core.model.wey.13
                @Override // com.bytedance.sdk.openadsdk.core.widget.fm.jnr, android.webkit.WebChromeClient
                public void onProgressChanged(WebView webView, int i10) {
                    super.onProgressChanged(webView, i10);
                    if (wey.this.wbw != null && !wey.this.wbw.isFinishing() && i10 == 100) {
                        wey.this.dsz();
                    }
                    if (wey.this.hi != null) {
                        wey.this.hi.fm(i10);
                    }
                }
            });
            if (this.xgn == null) {
                this.xgn = com.bytedance.sdk.openadsdk.sds.fm.fm.yz.fm(com.bytedance.sdk.openadsdk.core.gof.fm(), this.f7219ha);
            }
            this.lse.setDownloadListener(new DownloadListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.14
                @Override // android.webkit.DownloadListener
                public void onDownloadStart(String str, String str2, String str3, String str4, long j10) {
                    if (wey.this.xgn != null) {
                        wey.this.xgn.fm(wey.this.wsy);
                    }
                }
            });
            com.bytedance.sdk.component.ef.wsy wsyVar3 = this.lse;
            wsyVar3.setUserAgentString(com.bytedance.sdk.openadsdk.utils.wey.fm(wsyVar3.getWebView(), BuildConfig.VERSION_CODE));
            this.lse.setMixedContentMode(0);
            this.lse.getWebView().setOnScrollChangeListener(new View.OnScrollChangeListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.15
                @Override // android.view.View.OnScrollChangeListener
                public void onScrollChange(View view, int i10, int i11, int i12, int i13) {
                    if (wey.this.mon != null) {
                        wey.this.mon.ro(i11);
                    }
                }
            });
            this.lse.getWebView().setOnTouchListener(new View.OnTouchListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.16
                @Override // android.view.View.OnTouchListener
                public boolean onTouch(View view, MotionEvent motionEvent) {
                    if (wey.this.ef()) {
                        int action = motionEvent.getAction();
                        if (action == 0) {
                            wey.this.bwv = motionEvent.getY();
                        } else if (action == 1) {
                            if (zan.fm(wey.this.bwv, motionEvent.getY(), wey.this.wbw)) {
                                wey.this.ro(5);
                            }
                        } else if (action == 2) {
                            motionEvent.setAction(3);
                        }
                    }
                    if (wey.this.f7223qb && motionEvent.getAction() == 1 && wey.this.pkk != null) {
                        wey.this.fm(new Runnable() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.16.1
                            @Override // java.lang.Runnable
                            public void run() {
                                wey.this.pkk.mj();
                            }
                        });
                    }
                    if ((!wey.this.tzk || wey.ku(wey.this.wsy)) && !wey.wu(wey.this.wsy)) {
                        wey.this.onz.onTouch(view, motionEvent);
                    }
                    if ((!wey.this.tzk || wey.ku(wey.this.wsy)) && !wey.wu(wey.this.wsy) && motionEvent.getAction() == 1 && wey.this.onz.ajl()) {
                        wey.this.lse.getWebView().performClick();
                        wey.this.tzk = true;
                    }
                    if (wey.this.mon != null) {
                        wey.this.mon.fm(motionEvent);
                    }
                    if (wey.this.mpp != null) {
                        wey.this.mpp.fm(motionEvent);
                    }
                    if (wey.this.f7225te == null) {
                        return false;
                    }
                    wey.this.f7225te.fm();
                    return false;
                }
            });
            this.lse.getWebView().setOnClickListener(this.onz);
            com.bytedance.sdk.openadsdk.yz.lb.fm(this.wsy, this.f7219ha, this.lmk);
            if (!this.lse.k_()) {
                com.bytedance.sdk.component.utils.wey.fm("LandingPageModel", "loadUrlWithRefer url  = " + this.wsy.rbn());
                com.bytedance.sdk.openadsdk.utils.lse.fm(this.lse, this.wsy.rbn());
            }
            this.bx = true;
        }
        com.bytedance.sdk.component.ef.wsy wsyVar4 = this.lse;
        if (wsyVar4 == null || this.hi == null || wsyVar4.lb()) {
            return;
        }
        this.hi.fm();
    }

    private void onz() {
        this.ajl.setVisibility(8);
        if (yz(this.wsy) || wu(this.wsy) || !yz() || lb(this.wsy)) {
            return;
        }
        ObjectAnimator objectAnimatorOfFloat = ObjectAnimator.ofFloat(this, "timeVisible", 0.0f, 1.0f);
        this.ku = objectAnimatorOfFloat;
        objectAnimatorOfFloat.setDuration(100L);
        this.ku.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.18
            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) wey.this.hlt.getLayoutParams();
                layoutParams.weight = (float) (((double) ((Float) valueAnimator.getAnimatedValue()).floatValue()) * 0.25d);
                wey.this.fm((float) (1.0d - (((double) ((Float) valueAnimator.getAnimatedValue()).floatValue()) * 0.2d)));
                wey.this.hlt.setLayoutParams(layoutParams);
            }
        });
        this.ku.start();
    }

    private void qhl() {
        com.bytedance.sdk.openadsdk.common.ku loadingStyle;
        com.bytedance.sdk.openadsdk.common.duv duvVar = this.hi;
        if (duvVar != null && (loadingStyle = duvVar.getLoadingStyle()) != null) {
            this.pcm = loadingStyle.ro();
            this.so = loadingStyle.lb();
        }
        com.bytedance.sdk.openadsdk.core.ajl.yz yzVar = this.vvj;
        if (yzVar != null) {
            yzVar.setOnClickListener(new View.OnClickListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.3
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    if (wey.this.vvj.getTag() != null) {
                        if (wey.this.vvj.getTag().equals(1)) {
                            wey.this.ro(3);
                        } else if (wey.this.vvj.getTag().equals(2)) {
                            wey.this.ro(4);
                        }
                    }
                }
            });
        }
    }

    public static boolean vt(lse lseVar) {
        return (lseVar == null || lseVar.cd() == 1 || !ku(lseVar)) ? false : true;
    }

    private void wey() {
        com.bytedance.sdk.component.ef.wsy wsyVar = this.lse;
        if (wsyVar == null || wsyVar.getWebView() == null) {
            return;
        }
        this.f7220ib = this.lse.fm;
        this.f7222ne = this.lse.ro;
        this.kwx = this.lse.f6608lb;
        if (this.lse.ro()) {
            this.pkk.pcm();
            this.ai = System.currentTimeMillis();
        }
        if (this.lse.yz()) {
            dsz();
        }
        if (this.lse.lb()) {
            dsz();
            int iFm = bx.fm(this.lse.getWebView());
            ro roVar = this.jm;
            if (roVar != null) {
                roVar.fm(iFm != 1 ? 0 : 1);
            }
        }
    }

    public static boolean wsy(lse lseVar) {
        nt ntVarJd;
        return (lseVar == null || (ntVarJd = lseVar.jd()) == null || ntVarJd.fm() != 2) ? false : true;
    }

    public static boolean wu(lse lseVar) {
        return lseVar != null && lseVar.ywr() == 33;
    }

    public void fm(@NonNull com.bytedance.sdk.openadsdk.core.vt.sds sdsVar, FrameLayout frameLayout) {
        this.mj = sdsVar;
        this.ado = frameLayout;
    }

    public boolean yz() {
        return this.wsy.siu() == 15 || this.wsy.siu() == 16;
    }

    public boolean ef() {
        AtomicBoolean atomicBoolean;
        return (!lb(this.wsy) || (atomicBoolean = this.ywr) == null || atomicBoolean.get()) ? false : true;
    }

    public void lb() {
        if (gqi()) {
            try {
                String str = this.wsy.ex().f5926f;
                com.bytedance.sdk.openadsdk.vt.yz.fm().fm(str).fm(this.wsy.ex().f5922b).ro(this.wsy.ex().f5921a).jnr(zan.jnr(com.bytedance.sdk.openadsdk.core.gof.fm())).yz(zan.lb(com.bytedance.sdk.openadsdk.core.gof.fm())).lb(2).fm(new fm()).fm(new com.bytedance.sdk.openadsdk.vt.ro(this.wsy, str, new com.bytedance.sdk.component.jnr.irt() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.4
                    @Override // com.bytedance.sdk.component.jnr.irt
                    public void fm(int i10, String str2, @Nullable Throwable th) {
                    }

                    @Override // com.bytedance.sdk.component.jnr.irt
                    public void fm(com.bytedance.sdk.component.jnr.ku kuVar) {
                        try {
                            Object objRo = kuVar.ro();
                            if (objRo != null && kuVar.lb() != null) {
                                BitmapDrawable bitmapDrawable = objRo instanceof Bitmap ? new BitmapDrawable(com.bytedance.sdk.openadsdk.core.gof.fm().getResources(), (Bitmap) objRo) : null;
                                View viewIrt = wey.this.pkk.irt();
                                if (bitmapDrawable == null || viewIrt == null || !(viewIrt.getParent() instanceof View)) {
                                    return;
                                }
                                ((View) viewIrt.getParent()).setBackground(bitmapDrawable);
                            }
                        } catch (Throwable th) {
                            com.bytedance.sdk.component.utils.wey.lb("LandingPageModel", th.getMessage());
                        }
                    }
                }));
            } catch (Exception unused) {
            }
        }
    }

    public void ro() {
        lse lseVar = this.wsy;
        if (lseVar == null || TextUtils.isEmpty(lseVar.eys())) {
            return;
        }
        this.sds.setText(this.wsy.eys());
    }

    public void wu() {
        com.bytedance.sdk.openadsdk.yz.dsz dszVar = this.mon;
        if (dszVar != null) {
            dszVar.wu();
        }
    }

    public static boolean yz(lse lseVar) {
        if (lseVar == null) {
            return false;
        }
        if (duv(lseVar)) {
            return true;
        }
        return lseVar.oy() == 3 && (jnr(lseVar) || ajl(lseVar)) && !ai.ro(lseVar) && (lseVar.lvj() == 0.0f || lseVar.lvj() == 100.0f);
    }

    public void jnr() {
        FrameLayout frameLayout = this.hlt;
        if (frameLayout != null) {
            frameLayout.setVisibility(8);
            View view = this.gzf;
            if (view != null) {
                view.setVisibility(0);
            }
        }
    }

    public void vt() {
        if ("landingpage_split_screen".equals(this.f7219ha) && com.bytedance.sdk.openadsdk.hlt.jnr.fm("default_split_style", false) && this.lcp.compareAndSet(false, true)) {
            xgn.fm(new Runnable() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.10
                @Override // java.lang.Runnable
                public void run() {
                    wey.this.no = ValueAnimator.ofFloat(1.0f, 0.0f);
                    wey.this.no.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.10.1
                        @Override // android.animation.ValueAnimator.AnimatorUpdateListener
                        public void onAnimationUpdate(@NonNull ValueAnimator valueAnimator) {
                            float fFloatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                            if (wey.this.gzf != null) {
                                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) wey.this.gzf.getLayoutParams();
                                layoutParams.weight = fFloatValue;
                                wey.this.gzf.setLayoutParams(layoutParams);
                            }
                        }
                    });
                    wey.this.no.setDuration(500L);
                    wey.this.no.start();
                    if (wey.this.nt != null) {
                        wey.this.nt.setVisibility(8);
                    }
                }
            });
        }
    }

    public void wsy() {
        hxv hxvVar = this.maa;
        if (hxvVar != null) {
            hxvVar.ku();
        }
        com.bytedance.sdk.openadsdk.yz.dsz dszVar = this.mon;
        if (dszVar != null) {
            dszVar.wsy();
        }
    }

    public static boolean ro(lse lseVar) {
        return lseVar != null && lseVar.oy() == 3 && lseVar.ywr() == 6 && !ai.ro(lseVar) && lseVar.nnq() == 1 && (lseVar.lvj() == 0.0f || lseVar.lvj() == 100.0f);
    }

    public void ajl() {
        com.bytedance.sdk.component.ef.wsy wsyVar;
        com.bytedance.sdk.openadsdk.yz.dsz dszVar = this.mon;
        if (dszVar != null && (wsyVar = this.lse) != null) {
            dszVar.fm(wsyVar);
        }
        Handler handler = this.fhx;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
        ValueAnimator valueAnimator = this.no;
        if (valueAnimator != null) {
            valueAnimator.removeAllUpdateListeners();
            this.no.cancel();
        }
        ValueAnimator valueAnimator2 = this.vt;
        if (valueAnimator2 != null) {
            valueAnimator2.removeAllUpdateListeners();
            this.vt.cancel();
        }
        ObjectAnimator objectAnimator = this.ku;
        if (objectAnimator != null) {
            objectAnimator.removeAllUpdateListeners();
            this.ku.cancel();
        }
        com.bytedance.sdk.openadsdk.common.duv duvVar = this.hi;
        if (duvVar != null) {
            duvVar.ro();
        }
        ObjectAnimator objectAnimator2 = this.f7217ef;
        if (objectAnimator2 != null) {
            objectAnimator2.cancel();
        }
        com.bytedance.sdk.component.ef.wsy wsyVar2 = this.lse;
        if (wsyVar2 != null) {
            com.bytedance.sdk.openadsdk.core.bx.fm(wsyVar2.getWebView());
        }
        this.lse = null;
        hxv hxvVar = this.maa;
        if (hxvVar != null) {
            hxvVar.duv();
        }
        com.bytedance.sdk.openadsdk.yz.dsz dszVar2 = this.mon;
        if (dszVar2 != null) {
            dszVar2.yz(true);
        }
        com.bytedance.sdk.openadsdk.onz.yz yzVar = this.f7225te;
        if (yzVar != null) {
            yzVar.lb();
        }
        if (!TextUtils.isEmpty(this.f7224qf) && this.bx) {
            lb.fm.fm(this.f7222ne, this.f7220ib, this.wsy);
        }
        com.bytedance.sdk.openadsdk.wsy.ro.fm().fm(this.si);
    }

    public static boolean onz(lse lseVar) {
        if (lseVar != null) {
            return ajl(lseVar) || wsy(lseVar);
        }
        return false;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void yz(int i10) {
        zan.fm((View) this.pcm, i10);
        zan.fm((View) this.so, i10);
        if (this.zan.get()) {
            zan.fm((View) this.gof, i10);
            zan.fm((View) this.gqi, i10);
            zan.fm((View) this.wey, i10);
            zan.fm((View) this.sds, 0);
        }
    }

    public void ro(int i10) {
        com.bytedance.sdk.openadsdk.core.vt.sds sdsVar = this.mj;
        if (sdsVar != null) {
            sdsVar.jnr(i10);
        }
    }

    public void fm() {
        long jFm;
        View view;
        Long lValueOf = Long.valueOf(SystemClock.elapsedRealtime());
        com.bytedance.sdk.component.ef.wsy wsyVar = (com.bytedance.sdk.component.ef.wsy) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.maa);
        this.lse = wsyVar;
        if (wsyVar != null && !lse.fm(this.wsy)) {
            if (!this.lse.k_()) {
                this.lse.jnr();
            }
        } else {
            zan.fm((View) this.lse, 8);
        }
        this.hlt = (FrameLayout) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.sds);
        this.hi = (com.bytedance.sdk.openadsdk.common.duv) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.nt);
        this.nt = this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.lse);
        this.mq = (ImageView) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.hlt);
        this.gzf = this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.hxv);
        this.ro = (FrameLayout) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.gqi);
        this.fm = (ImageView) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.wey);
        this.ajl = (RelativeLayout) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.hi);
        this.f7221lb = (TextView) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.oj);
        this.yz = (FrameLayout) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.duv);
        View viewFindViewById = this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.mq);
        this.irt = viewFindViewById;
        if (viewFindViewById == null) {
            this.irt = this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.xgn);
        }
        this.qhl = this.wbw.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.gzf);
        this.gof = (TextView) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.ol);
        this.gqi = (TextView) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.wbw);
        this.wey = (com.bytedance.sdk.openadsdk.core.widget.qhl) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.ai);
        this.sds = (TextView) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.f7556ha);
        if (this.f7221lb != null && this.wsy.hlt() != null) {
            this.f7221lb.setText(this.wsy.hlt().jnr());
        }
        this.jnr = this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.pkk);
        this.vvj = (com.bytedance.sdk.openadsdk.core.ajl.yz) this.hxv.findViewById(com.bytedance.sdk.openadsdk.utils.qhl.gay);
        if ((yz(this.wsy) || ro(this.wsy) || wu(this.wsy) || lb(this.wsy)) && this.wsy.hlt() != null) {
            View view2 = this.jnr;
            if (view2 != null) {
                view2.setVisibility(8);
            }
            if (wu(this.wsy)) {
                jFm = this.wsy.hlt().lb();
            } else {
                jFm = this.wsy.hlt().fm();
            }
            com.bytedance.sdk.openadsdk.core.fhx.lb().postDelayed(new Runnable() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.11
                @Override // java.lang.Runnable
                public void run() {
                    if (wey.this.ol.get()) {
                        return;
                    }
                    wey weyVar = wey.this;
                    com.bytedance.sdk.openadsdk.yz.lb.fm(weyVar.wsy, weyVar.f7219ha, System.currentTimeMillis() - wey.this.ai, false);
                    wey.this.fhx();
                }
            }, jFm * 1000);
        }
        ku();
        if (ro(this.wsy)) {
            gof();
            if (!yz()) {
                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.hlt.getLayoutParams();
                layoutParams.weight = 2.33f;
                this.hlt.setLayoutParams(layoutParams);
            }
        }
        if ((yz(this.wsy) || wu(this.wsy)) && (view = this.gzf) != null) {
            view.setVisibility(8);
        }
        com.bytedance.sdk.openadsdk.common.duv duvVar = this.hi;
        if (duvVar != null) {
            duvVar.fm(this.wsy);
        }
        if (lb(this.wsy)) {
            qhl();
        }
        lb.fm.fm(SystemClock.elapsedRealtime() - lValueOf.longValue(), this.wsy, this.f7219ha, this.si, this.f7224qf);
    }

    public static boolean dsz(lse lseVar) {
        return lseVar != null && lseVar.ywr() == 8 && lseVar.so() == 1;
    }

    public static boolean duv(lse lseVar) {
        return lseVar != null && lseVar.ywr() == 19;
    }

    public static boolean lb(lse lseVar) {
        return lseVar != null && lseVar.oy() == 3 && lseVar.pcm() == 38 && lseVar.nnq() == 1;
    }

    public static boolean ku(lse lseVar) {
        if (lseVar != null) {
            return lseVar.ywr() == 19 || lseVar.ywr() == 20;
        }
        return false;
    }

    public static boolean fm(lse lseVar) {
        if (lseVar == null || duv(lseVar) || wsy(lseVar) || ajl(lseVar)) {
            return false;
        }
        return yz(lseVar) || ro(lseVar) || wu(lseVar);
    }

    public void fm(int i10) {
        com.bytedance.sdk.openadsdk.core.fhx.yz.ro roVar = this.pkk;
        if (roVar != null) {
            roVar.jnr();
        }
    }

    public void fm(float f10) {
        try {
            this.pkk.fhx();
        } catch (Throwable unused) {
        }
    }

    public void fm(final int i10, com.bytedance.sdk.component.adexpress.ro.onz onzVar) {
        float f10;
        int iAjl;
        if (i10 == 3 || lb(i10)) {
            if (this.ado == null || onzVar == null) {
                return;
            }
            AtomicBoolean atomicBoolean = this.ywr;
            if (atomicBoolean != null) {
                if (i10 == 1) {
                    return;
                }
                if (i10 == 5 && atomicBoolean.get()) {
                    return;
                }
            }
            final LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.gzf.getLayoutParams();
            this.aws = (LinearLayout.LayoutParams) this.hlt.getLayoutParams();
            final float f11 = layoutParams.weight;
            gqi gqiVarNt = this.wsy.nt();
            if (lb(i10)) {
                if (gqiVarNt != null) {
                    iAjl = gqiVarNt.jnr();
                    f10 = iAjl;
                } else {
                    f10 = 30.0f;
                }
            } else if (gqiVarNt != null) {
                iAjl = gqiVarNt.ajl();
                f10 = iAjl;
            } else {
                f10 = 70.0f;
            }
            final float f12 = f10;
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.ado.getLayoutParams();
            if (layoutParams2 == null) {
                layoutParams2 = new FrameLayout.LayoutParams(-1, -1);
            }
            final FrameLayout.LayoutParams layoutParams3 = layoutParams2;
            final int i11 = layoutParams3.height;
            final int i12 = layoutParams3.width;
            final int i13 = layoutParams3.leftMargin;
            final int i14 = layoutParams3.topMargin;
            final int iRo = zan.ro(this.wbw, (float) onzVar.wsy());
            final int iRo2 = zan.ro(this.wbw, (float) onzVar.wu());
            final int iRo3 = zan.ro(this.wbw, (float) onzVar.jnr());
            final int iRo4 = zan.ro(this.wbw, (float) onzVar.ajl());
            ValueAnimator valueAnimatorOfFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
            this.vt = valueAnimatorOfFloat;
            valueAnimatorOfFloat.setDuration(500L);
            this.vt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.openadsdk.core.model.wey.9
                @Override // android.animation.ValueAnimator.AnimatorUpdateListener
                public void onAnimationUpdate(@NonNull ValueAnimator valueAnimator) {
                    float fFloatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                    LinearLayout.LayoutParams layoutParams4 = layoutParams;
                    float f13 = f11;
                    layoutParams4.weight = u1.a(f12, f13, fFloatValue, f13);
                    wey.this.aws.weight = 100.0f - layoutParams.weight;
                    if (wey.this.gzf != null) {
                        wey.this.gzf.setLayoutParams(layoutParams);
                    }
                    if (wey.this.hlt != null) {
                        wey.this.hlt.setLayoutParams(wey.this.aws);
                    }
                    if (wey.this.aws.weight < 30.0f) {
                        wey.this.yz(8);
                    } else {
                        wey.this.yz(0);
                    }
                    FrameLayout.LayoutParams layoutParams5 = layoutParams3;
                    layoutParams5.width = i12 + ((int) ((iRo - r2) * fFloatValue));
                    layoutParams5.height = i11 + ((int) ((iRo2 - r2) * fFloatValue));
                    layoutParams5.leftMargin = i13 + ((int) ((iRo3 - r2) * fFloatValue));
                    layoutParams5.topMargin = i14 + ((int) ((iRo4 - r2) * fFloatValue));
                    if (wey.this.ado != null) {
                        wey.this.ado.setLayoutParams(layoutParams3);
                    }
                    wey.this.fm(0.0f);
                    if (fFloatValue == 1.0f) {
                        if (wey.this.vvj != null) {
                            zan.fm((View) wey.this.vvj, 0);
                            if (wey.this.lb(i10)) {
                                wey.this.vvj.setImageDrawable(com.bytedance.sdk.component.utils.maa.lb(wey.this.wbw, "tt_ad_zoom_down"));
                                wey.this.vvj.setTag(1);
                            } else {
                                wey.this.vvj.setImageDrawable(com.bytedance.sdk.component.utils.maa.lb(wey.this.wbw, "tt_ad_zoom_up"));
                                wey.this.vvj.setTag(2);
                            }
                        }
                        if (wey.this.ywr == null) {
                            wey.this.ywr = new AtomicBoolean();
                        }
                        wey.this.ywr.set(wey.this.lb(i10));
                    }
                }
            });
            com.bytedance.sdk.openadsdk.yz.lb.yz(this.wsy, this.f7219ha, i10);
            this.vt.start();
            if (this.rka.compareAndSet(false, true)) {
                this.pbk = SystemClock.elapsedRealtime();
            }
            com.bytedance.sdk.openadsdk.yz.dsz dszVar = this.mon;
            if (dszVar != null) {
                dszVar.fm(true, SystemClock.elapsedRealtime());
            }
            zan.fm((View) this.vvj, 8);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public boolean fm(Runnable runnable) {
        long jCurrentTimeMillis = System.currentTimeMillis();
        if (jCurrentTimeMillis - this.zow < 100) {
            return false;
        }
        this.zow = jCurrentTimeMillis;
        if (runnable == null) {
            return true;
        }
        runnable.run();
        return true;
    }
}
