package com.bytedance.sdk.openadsdk.activity.single;

import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import com.bykv.vk.openvk.fm.fm.fm.lb.b;
import com.bytedance.sdk.component.utils.maa;
import com.bytedance.sdk.component.utils.wey;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.activity.single.ro;
import com.bytedance.sdk.openadsdk.core.gof;
import com.bytedance.sdk.openadsdk.core.model.ai;
import com.bytedance.sdk.openadsdk.core.model.hlt;
import com.bytedance.sdk.openadsdk.core.model.lse;
import com.bytedance.sdk.openadsdk.core.settings.ku;
import com.bytedance.sdk.openadsdk.utils.ef;
import com.bytedance.sdk.openadsdk.utils.fhx;
import com.bytedance.sdk.openadsdk.utils.onz;
import com.bytedance.sdk.openadsdk.utils.zan;
import defpackage.e;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public class ef extends lb {
    public onz ajl;
    private ro.AbstractC0048ro dsz;
    private com.bytedance.sdk.openadsdk.core.ajl.wu duv;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private com.bytedance.sdk.openadsdk.fhx.fm f6782ef;
    private jnr fhx;
    private boolean gof;
    private wu irt;
    private com.bytedance.sdk.openadsdk.core.ajl.lb ku;
    private int onz;
    private int qhl;
    private com.bytedance.sdk.openadsdk.core.ajl.lb vt;
    private final List<wu> wsy;
    private com.bytedance.sdk.openadsdk.component.reward.top.lb wu;

    public ef(Activity activity, lse lseVar, ro roVar) {
        super(activity, lseVar, roVar);
        this.wsy = new ArrayList();
        this.gof = false;
        com.bytedance.sdk.openadsdk.core.ajl.lb lbVar = new com.bytedance.sdk.openadsdk.core.ajl.lb(activity);
        this.vt = lbVar;
        if (Build.VERSION.SDK_INT >= 35) {
            lbVar.setFitsSystemWindows(true);
        }
        activity.setContentView(this.vt);
    }

    private void lb(wu wuVar) {
        try {
            this.duv.setText(this.fm.getString(maa.ro(gof.fm(), "tt_multiple_ad_indicator"), Integer.valueOf(wuVar.ku + 1), Integer.valueOf(this.onz)));
            this.duv.setVisibility(0);
        } catch (Throwable th) {
            wey.fm("SeqSwitchLayoutManager", "updateCurrentAdIndex: ", th);
        }
    }

    private void maa() {
        onz onzVarFm = com.bytedance.sdk.openadsdk.utils.ef.fm(this.fm, new ef.fm() { // from class: com.bytedance.sdk.openadsdk.activity.single.ef.1
            @Override // com.bytedance.sdk.openadsdk.utils.ef.fm
            public View fm() {
                if (ef.this.wu != null) {
                    return ef.this.wu.getCloseBackupButton();
                }
                return null;
            }

            @Override // com.bytedance.sdk.openadsdk.utils.ef.fm
            public void ro() {
                if (ef.this.wu != null) {
                    ef.this.wu.setSkipInvisiable();
                }
            }
        });
        this.ajl = onzVarFm;
        onzVarFm.fm(new fhx() { // from class: com.bytedance.sdk.openadsdk.activity.single.ef.2
            @Override // com.bytedance.sdk.openadsdk.utils.fhx
            public void fm() {
                com.bytedance.sdk.openadsdk.component.yz.ro.fm("force_button_tracker", "show", ef.this.ro);
            }
        });
    }

    /* JADX WARN: Removed duplicated region for block: B:42:0x0162 A[PHI: r11
      0x0162: PHI (r11v5 int) = (r11v4 int), (r11v6 int), (r11v4 int), (r11v4 int) binds: [B:26:0x00ef, B:40:0x0148, B:30:0x00ff, B:31:0x0101] A[DONT_GENERATE, DONT_INLINE]] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private int ro(int i10, boolean z10) {
        List<lse> list;
        boolean z11;
        int i11;
        int i12;
        lse lseVar;
        int i13;
        List<lse> listAfy = this.ro.afy();
        if (listAfy.isEmpty()) {
            return i10;
        }
        int size = listAfy.size();
        this.onz = size;
        int i14 = i10;
        int i15 = 0;
        while (i15 < size) {
            boolean z12 = i15 == size + (-1);
            lse lseVar2 = listAfy.get(i15);
            if (lseVar2 != null) {
                lseVar2.xgn(this.jnr);
            }
            if (!ai.ro(lseVar2)) {
                list = listAfy;
                z11 = z12;
                i11 = i15;
                if (com.bytedance.sdk.openadsdk.core.model.wey.ajl(lseVar2)) {
                    this.wsy.add(fm(this.yz, lseVar2, i14, i11, z11));
                    i12 = size;
                    i13 = i14 + 1;
                    lseVar = lseVar2;
                } else if (com.bytedance.sdk.openadsdk.core.model.wey.wsy(lseVar2)) {
                    this.wsy.add(fm(this.yz, lseVar2, i14, i11, z11));
                    i12 = size;
                    lseVar = lseVar2;
                    this.wsy.add(new jnr(this.yz, lseVar2, i14 + 1, i11, false, z11, false));
                    i13 = i14 + 2;
                } else {
                    i12 = size;
                    lseVar = lseVar2;
                    this.wsy.add(fm(this.yz, lseVar, i14, i11, z11));
                    i13 = i14 + 1;
                }
            } else if (ai.lb(lseVar2)) {
                this.wsy.add(new jnr(this.yz, lseVar2, i14, i15, true, z12, false));
                i12 = size;
                lseVar = lseVar2;
                z11 = z12;
                i13 = i14 + 1;
                list = listAfy;
                i11 = i15;
            } else {
                this.wsy.add(fm(this.yz, lseVar2, i14, i15, z12));
                z11 = z12;
                list = listAfy;
                i11 = i15;
                this.wsy.add(new jnr(this.yz, lseVar2, i14 + 1, i15, true, z12, false));
                i12 = size;
                i13 = i14 + 2;
                lseVar = lseVar2;
            }
            if (z10) {
                boolean zFm = this.yz.fm(lseVar);
                if (z11) {
                    if (this.yz.yz() && zFm && !ai.ro(lseVar)) {
                        this.wsy.add(new jnr(this.yz, lseVar, i13, i11, false, z11, false));
                        i13++;
                    }
                    if (!TextUtils.isEmpty(lseVar.wu())) {
                        jnr jnrVar = new jnr(this.yz, lseVar, i13, i11, false, z11, true);
                        this.fhx = jnrVar;
                        this.wsy.add(jnrVar);
                        i14 = i13 + 1;
                    }
                } else if (this.yz.jnr() && zFm) {
                    this.wsy.add(new jnr(this.yz, lseVar, i13, i11, false, z11, false));
                    i14 = i13 + 1;
                } else {
                    i14 = i13;
                }
            }
            i15 = i11 + 1;
            listAfy = list;
            size = i12;
        }
        return i14;
    }

    private void sds() {
        boolean zFhx = ku.ro().fhx(String.valueOf(this.ro.pg()));
        int iRo = this.yz.ajl() ? ro(0, zFhx) : 0;
        if (this.wsy.isEmpty() && !ai.lb(this.ro)) {
            int i10 = iRo + 1;
            this.wsy.add(fm(this.yz, this.ro, iRo, i10, true));
            iRo = i10;
        }
        fm(iRo, zFhx);
    }

    private void yz(wu wuVar) {
        com.bytedance.sdk.openadsdk.fhx.fm fmVar = this.f6782ef;
        if (fmVar != null) {
            zan.wsy(fmVar);
            this.f6782ef = null;
        }
        com.bytedance.sdk.openadsdk.component.reward.top.lb lbVar = this.wu;
        if (lbVar != null) {
            zan.wsy(lbVar);
            zan.wsy(this.wu.getITopLayout());
            this.wu = null;
        }
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            abstractC0048ro.lb();
        }
        if (wuVar instanceof wsy) {
            ((wsy) wuVar).kwx();
        }
        onz onzVar = this.ajl;
        if (onzVar != null) {
            onzVar.lb();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void ajl() {
        super.ajl();
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.dsz();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public wu dsz() {
        wu wuVar = this.irt;
        if (wuVar == null) {
            return null;
        }
        int i10 = wuVar.vt;
        while (true) {
            i10++;
            if (i10 >= this.wsy.size()) {
                return null;
            }
            wu wuVar2 = this.wsy.get(i10);
            if (wuVar2 instanceof fm) {
                return wuVar2;
            }
            if ((wuVar2 instanceof jnr) && ai.lb(wuVar2.ajl) && wuVar2.irt) {
                return wuVar2;
            }
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public com.bytedance.sdk.openadsdk.component.reward.top.lb duv() {
        return this.wu;
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void ef() {
        super.ef();
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.wey();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public List<lse> fhx() {
        return this.ro.afy();
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void gof() {
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            abstractC0048ro.wu();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void gqi() {
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            abstractC0048ro.ef();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public wu ku() {
        return this.irt;
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public jnr onz() {
        jnr jnrVar = this.fhx;
        if (jnrVar != null) {
            return jnrVar;
        }
        wu wuVar = this.irt;
        int i10 = wuVar != null ? wuVar.vt : -1;
        int size = this.wsy.size() - 1;
        while (true) {
            if (size <= i10) {
                break;
            }
            wu wuVar2 = this.wsy.get(size);
            if (wuVar2 instanceof jnr) {
                jnr jnrVar2 = (jnr) wuVar2;
                if (jnrVar2.fm) {
                    this.fhx = jnrVar2;
                    break;
                }
            }
            size--;
        }
        return this.fhx;
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public int vt() {
        return this.qhl;
    }

    public int wey() {
        wu wuVar = this.irt;
        if (wuVar != null) {
            return wuVar.vt;
        }
        return -1;
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void wsy() {
        super.wsy();
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.yz();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public int wu() {
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            return abstractC0048ro.fm();
        }
        return 0;
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm() {
        super.fm();
        sds();
    }

    private static wu fm(ro roVar, lse lseVar, int i10, int i11, boolean z10) {
        boolean zIi = lseVar.ii();
        AdSlot adSlotCpu = lseVar.cpu();
        if (adSlotCpu == null ? zIi : adSlotCpu.getDurationSlotType() == 7) {
            return new wsy(roVar, lseVar, i10, i11, z10);
        }
        return new ajl(roVar, lseVar, i10, i11, z10);
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void lb() {
        super.lb();
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.onz();
        }
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            abstractC0048ro.fm(-1);
        }
        onz onzVar = this.ajl;
        if (onzVar != null) {
            onzVar.ro();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public boolean yz() {
        if (this.wsy.isEmpty()) {
            return false;
        }
        wu wuVar = (wu) e.c(this.wsy, 1);
        return (wuVar instanceof jnr) && ((jnr) wuVar).fm;
    }

    private void fm(int i10, boolean z10) {
        if (onz() == null && this.yz.ajl()) {
            maa();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(Bundle bundle) {
        super.fm(bundle);
        this.ku = new com.bytedance.sdk.openadsdk.core.ajl.lb(this.fm);
        this.vt.addView(this.ku, new FrameLayout.LayoutParams(-1, -1));
        this.f6782ef = new com.bytedance.sdk.openadsdk.fhx.fm(this.fm);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, zan.ro(this.fm, 2.0f));
        layoutParams.gravity = 80;
        this.vt.addView(this.f6782ef, layoutParams);
        com.bytedance.sdk.openadsdk.core.ajl.wu wuVar = new com.bytedance.sdk.openadsdk.core.ajl.wu(this.fm);
        this.duv = wuVar;
        wuVar.setTextColor(-1);
        this.duv.setTextSize(15.0f);
        this.duv.setShadowLayer(1.0f, 0.0f, 1.0f, -16777216);
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams2.topMargin = zan.ro(this.fm, 60.0f);
        layoutParams2.rightMargin = zan.ro(this.fm, 16.0f);
        layoutParams2.gravity = 8388661;
        this.vt.addView(this.duv, layoutParams2);
        com.bytedance.sdk.openadsdk.component.reward.top.lb lbVar = new com.bytedance.sdk.openadsdk.component.reward.top.lb(this.fm);
        this.wu = lbVar;
        this.vt.addView(lbVar, new FrameLayout.LayoutParams(-1, -2));
        this.wu.fm(this.ro);
        this.wu.setShowDislike(true);
        fm(null, null, new ro.jnr(1, null));
        com.bytedance.sdk.openadsdk.lse.fm.fm.fm(this.fm, this.vt, com.bytedance.sdk.openadsdk.lse.fm.fm.fm(this.ro.ss()));
    }

    private void ro(wu wuVar, wu wuVar2, ro.jnr jnrVar) {
        onz onzVar;
        lse lseVar;
        if (this.dsz == null) {
            if (wuVar2 != null && wuVar2.c_()) {
                this.dsz = new ro.yz(this.yz, this.ro, this.wu);
            } else {
                this.dsz = new ro.fm(this.yz, this.ro, this.wu);
            }
        }
        this.dsz.ro();
        int iRo = ro(wuVar2);
        boolean z10 = wuVar2 instanceof jnr;
        if (z10 && !((jnr) wuVar2).fm && !wuVar2.irt && (lseVar = wuVar2.ajl) != null && lseVar.mh()) {
            this.dsz.yz();
        } else {
            this.dsz.fm(iRo, wuVar2.ajl);
            boolean z11 = wuVar2 instanceof jnr;
            if (z11 && ((jnr) wuVar2).fm) {
                yz(wuVar);
            } else if (wuVar2.ajl.wzb()) {
                boolean z12 = false;
                boolean z13 = (wuVar2 instanceof fm) && com.bytedance.sdk.openadsdk.core.model.wey.ajl(wuVar2.ajl);
                if (z11 && (wuVar2.irt || com.bytedance.sdk.openadsdk.core.model.wey.wsy(wuVar2.ajl))) {
                    z12 = true;
                }
                if (z13 || z12) {
                    this.dsz.fm(wuVar2);
                }
            } else if (wuVar2.irt) {
                this.dsz.fm(wuVar2.ajl, wuVar2.qhl);
            } else if (z11) {
                this.dsz.lb(wuVar2.ajl.jd().yz());
            }
        }
        if (z10 && (onzVar = this.ajl) != null && wuVar == null) {
            onzVar.fm(wuVar2.f6801ef, iRo * 1000);
        }
        if (wuVar2 instanceof fm) {
            this.qhl++;
            fm(0.0f);
            if (com.bytedance.sdk.openadsdk.core.model.wey.ajl(wuVar2.ajl)) {
                this.duv.setVisibility(8);
                return;
            } else {
                lb(wuVar2);
                return;
            }
        }
        if (z10) {
            if (((jnr) wuVar2).fm) {
                this.duv.setVisibility(8);
                return;
            }
            if (wuVar2.irt && ai.lb(wuVar2.ajl)) {
                this.qhl++;
            }
            if (!wuVar2.irt && !com.bytedance.sdk.openadsdk.core.model.wey.wsy(wuVar2.ajl)) {
                lb(wuVar2);
            } else {
                this.duv.setVisibility(8);
            }
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(wu wuVar, wu wuVar2, ro.jnr jnrVar) {
        wu wuVar3 = this.irt;
        if ((wuVar3 == null || wuVar3 == wuVar) && !com.bytedance.sdk.component.utils.ro.fm(this.fm)) {
            wey();
            if (wuVar2 == null) {
                wu wuVar4 = this.irt;
                int i10 = wuVar4 != null ? wuVar4.vt + 1 : 0;
                if (i10 < this.wsy.size()) {
                    wuVar2 = this.wsy.get(i10);
                }
                if (wuVar2 == null) {
                    this.yz.wsy();
                    return;
                }
            }
            wu wuVar5 = this.irt;
            if (wuVar5 != null) {
                if (wuVar5 == wuVar2) {
                    return;
                }
                wuVar5.onz();
                this.irt.yz();
                com.bytedance.sdk.openadsdk.component.reward.view.wu wuVarFm = this.irt.fm();
                if (wuVarFm != null) {
                    this.ku.removeView(wuVarFm);
                }
                this.irt.gqi();
                this.irt.duv = false;
                if (this.yz.jnr()) {
                    wu wuVar6 = this.irt;
                    if (wuVar6 instanceof fm) {
                        int i11 = wuVar6.vt + 1;
                        wu wuVar7 = i11 < this.wsy.size() ? this.wsy.get(i11) : null;
                        if ((wuVar7 instanceof jnr) && wuVar7 != wuVar2) {
                            com.bytedance.sdk.openadsdk.component.reward.view.wu wuVarFm2 = wuVar7.fm();
                            if (wuVarFm2 != null && wuVarFm2.getParent() != null && (wuVarFm2.getParent() instanceof ViewGroup)) {
                                ((ViewGroup) wuVarFm2.getParent()).removeView(wuVarFm2);
                            }
                            wuVar7.gqi();
                        }
                    }
                }
            }
            if (com.bytedance.sdk.component.utils.ro.fm(this.fm)) {
                return;
            }
            wuVar2.duv = true;
            wu wuVar8 = this.irt;
            this.irt = wuVar2;
            ro(wuVar8, wuVar2, jnrVar);
            wuVar2.ro(this.fm, jnrVar);
            com.bytedance.sdk.openadsdk.component.reward.view.wu wuVarFm3 = wuVar2.fm();
            if (wuVarFm3 != null) {
                ViewParent parent = wuVarFm3.getParent();
                if (parent != null) {
                    if (parent == this.ku) {
                        wuVarFm3.setVisibility(0);
                    } else if (parent instanceof ViewGroup) {
                        ((ViewGroup) parent).removeView(wuVarFm3);
                    }
                }
                if (wuVarFm3.getParent() == null) {
                    this.ku.addView(wuVarFm3, new ViewGroup.LayoutParams(-1, -1));
                }
            }
            for (int i12 = wuVar8 != null ? wuVar8.vt : 0; i12 < this.wsy.size(); i12++) {
                this.wsy.get(i12).fm(wuVar8, this.irt, jnrVar);
            }
            this.yz.ro(this.irt);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0041  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private int ro(wu wuVar) {
        lse lseVar;
        int iYz;
        int i10 = 0;
        for (int i11 = wuVar.vt; i11 < this.wsy.size(); i11++) {
            wu wuVar2 = this.wsy.get(i11);
            if ((wuVar2 instanceof jnr) && ((jnr) wuVar2).fm) {
                break;
            }
            boolean z10 = wuVar2.irt;
            boolean zWsy = com.bytedance.sdk.openadsdk.core.model.wey.wsy(wuVar2.ajl);
            boolean zAjl = com.bytedance.sdk.openadsdk.core.model.wey.ajl(wuVar2.ajl);
            hlt hltVarFm = wuVar2.ajl.fm();
            int iLb = hltVarFm != null ? hltVarFm.lb() : 10;
            if (wuVar2 instanceof fm) {
                if (zAjl) {
                    i10 += iLb;
                } else {
                    b bVarEx = wuVar2.ajl.ex();
                    i10 = bVarEx != null ? (int) (((double) i10) + bVarEx.f5924d) : (int) (((long) i10) + 10);
                }
            } else if (wuVar2 instanceof jnr) {
                if (!zWsy) {
                    if (z10) {
                        if (!wuVar2.ajl.wzb()) {
                            iYz = ai.hi(wuVar2.ajl) + ai.sds(wuVar2.ajl);
                        }
                        i10 += iLb;
                    } else if (this.yz.jnr() && (lseVar = wuVar2.ajl) != null && !lseVar.mh()) {
                        iYz = wuVar2.ajl.jd().yz();
                    }
                    i10 = iYz + i10;
                }
            }
        }
        return i10;
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(int i10, int i11) {
        super.fm(i10, i11);
        if (i10 >= 0) {
            if (TextUtils.isEmpty(this.f6787lb)) {
                this.duv.setText(this.fm.getString(maa.ro(gof.fm(), "tt_multiple_playable_wait_tips"), Integer.valueOf(i10)));
            } else {
                this.duv.setText(String.format(this.f6787lb, Integer.valueOf(i10)));
            }
            this.duv.setVisibility(0);
            return;
        }
        this.duv.setVisibility(8);
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void ro() {
        super.ro();
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.lb();
        }
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            abstractC0048ro.ro(-1);
        }
        onz onzVar = this.ajl;
        if (onzVar != null) {
            onzVar.fm();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(Activity activity) {
        super.fm(activity);
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.ro(activity);
        }
        int iWey = wey();
        for (wu wuVar2 : this.wsy) {
            if (wuVar2.vt >= iWey) {
                wuVar2.gqi();
            }
        }
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            abstractC0048ro.lb();
        }
        onz onzVar = this.ajl;
        if (onzVar != null) {
            onzVar.lb();
        }
        wu wuVar3 = this.irt;
        if (wuVar3 != null && !wuVar3.maa() && !this.ro.emt()) {
            com.bytedance.sdk.openadsdk.core.fhx.ro().post(new ro.lb(this.ro));
        }
        this.irt = null;
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void ro(wu wuVar, int i10) {
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro == null) {
            return;
        }
        if (i10 == 2) {
            abstractC0048ro.fm(i10);
            onz onzVar = this.ajl;
            if (onzVar != null) {
                onzVar.ro();
                return;
            }
            return;
        }
        if (i10 == 1) {
            abstractC0048ro.ro(i10);
            onz onzVar2 = this.ajl;
            if (onzVar2 != null) {
                onzVar2.fm();
                return;
            }
            return;
        }
        if (i10 == 3 || i10 == 4) {
            try {
                this.irt.hlt().sds.ha();
            } catch (Throwable th) {
                wey.lb("SeqSwitchLayoutManager", th);
            }
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void ro(Activity activity) {
        super.ro(activity);
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.fm(activity);
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(float f10) {
        com.bytedance.sdk.openadsdk.fhx.fm fmVar = this.f6782ef;
        if (fmVar == null) {
            return;
        }
        fmVar.setProgress(f10);
        if (f10 == 0.0f && this.f6782ef.getVisibility() == 0) {
            this.f6782ef.setVisibility(4);
        } else {
            if (f10 <= 0.0f || this.f6782ef.getVisibility() == 0) {
                return;
            }
            this.f6782ef.setVisibility(0);
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(int i10) {
        ro.AbstractC0048ro abstractC0048ro = this.dsz;
        if (abstractC0048ro != null) {
            if (i10 == 2) {
                abstractC0048ro.fm(2);
            } else if (i10 == 1) {
                abstractC0048ro.ro(1);
            }
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(wu wuVar, ro.jnr jnrVar) {
        wu wuVar2 = this.irt;
        if (wuVar2 == null || wuVar2 == wuVar) {
            if (wuVar2 != null && (wuVar2 instanceof fm)) {
                final long jOnz = (wuVar2.hlt() == null || this.irt.hlt().sds == null) ? 0L : this.irt.hlt().sds.onz();
                final int i10 = this.irt.ku + 1;
                long jCurrentTimeMillis = System.currentTimeMillis();
                wu wuVar3 = this.irt;
                com.bytedance.sdk.openadsdk.yz.lb.fm(jCurrentTimeMillis, wuVar3.ajl, wuVar3.d_(), "dislike_skip", new com.bytedance.sdk.openadsdk.irt.ro.fm() { // from class: com.bytedance.sdk.openadsdk.activity.single.ef.3
                    @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                    public JSONObject fm() {
                        return com.bytedance.sdk.openadsdk.yz.lb.fm(i10);
                    }

                    @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                    public JSONObject ro() {
                        JSONObject jSONObject = new JSONObject();
                        try {
                            jSONObject.put("duration", jOnz);
                        } catch (Throwable unused) {
                        }
                        return jSONObject;
                    }
                });
            }
            wu wuVarDsz = dsz();
            if (wuVarDsz == null) {
                wuVarDsz = onz();
            }
            fm(this.irt, wuVarDsz, jnrVar);
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(wu wuVar, boolean z10, boolean z11, boolean z12, int i10) {
        jnr jnrVarOnz;
        wu wuVar2 = this.irt;
        if ((wuVar2 == null || wuVar2 == wuVar) && (jnrVarOnz = onz()) != null) {
            ro.jnr jnrVar = new ro.jnr(i10, wuVar != null ? wuVar.hlt() : null);
            jnrVar.fm.putBoolean("isSkip", z10);
            jnrVar.fm.putBoolean("force", z11);
            jnrVar.fm.putBoolean("isFromLandingPage", z12);
            fm(this.irt, jnrVarOnz, jnrVar);
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(fm fmVar, boolean z10) {
        ro.AbstractC0048ro abstractC0048ro;
        super.fm(fmVar, z10);
        if (fmVar == null || fmVar != this.irt || (abstractC0048ro = this.dsz) == null) {
            return;
        }
        abstractC0048ro.ro(z10);
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(wu wuVar) {
        ro.AbstractC0048ro abstractC0048ro;
        super.fm(wuVar);
        if (wuVar == null) {
            return;
        }
        wuVar.toString();
        if (wuVar.duv && (abstractC0048ro = this.dsz) != null) {
            abstractC0048ro.ajl();
        }
        wu wuVarDsz = dsz();
        if (wuVarDsz instanceof fm) {
            com.bytedance.sdk.openadsdk.component.reward.fm.ro roVarHlt = wuVarDsz.hlt();
            if (roVarHlt == null || !com.bytedance.sdk.openadsdk.core.model.wey.ajl(roVarHlt.ro)) {
                ((fm) wuVarDsz).sds();
            }
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(wu wuVar, boolean z10) {
        ro.AbstractC0048ro abstractC0048ro;
        super.fm(wuVar, z10);
        if (wuVar == null) {
            return;
        }
        wuVar.toString();
        if (!wuVar.duv || (abstractC0048ro = this.dsz) == null) {
            return;
        }
        abstractC0048ro.fm(z10);
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(View view) {
        super.fm(view);
        if (view.getParent() != null) {
            return;
        }
        view.setVisibility(4);
        this.ku.addView(view, 0);
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(View view, boolean z10) {
        super.fm(view, z10);
        if (view.getParent() == null && this.ku != null) {
            view.setVisibility(4);
            int childCount = this.ku.getChildCount();
            if (z10) {
                this.ku.addView(view, 0);
            } else {
                this.ku.addView(view, childCount - 1);
            }
        }
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public boolean fm(wu wuVar, int i10) {
        return i10 == this.wsy.size() - 1 && this.wsy.get(i10) != null && (this.wsy.get(i10) instanceof jnr);
    }

    @Override // com.bytedance.sdk.openadsdk.activity.single.lb
    public void fm(boolean z10) {
        super.fm(z10);
        wu wuVar = this.irt;
        if (wuVar != null) {
            wuVar.lb(z10);
        }
    }
}
