package com.bytedance.sdk.component.adexpress.dynamic.dynamicview;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class mq extends ajl implements com.bytedance.sdk.component.adexpress.dynamic.lb {
    int fm;
    private boolean maa;
    boolean ro;
    private int sds;
    private int wey;

    public mq(Context context, DynamicRootView dynamicRootView, com.bytedance.sdk.component.adexpress.dynamic.yz.wu wuVar) {
        super(context, dynamicRootView, wuVar);
        this.sds = 0;
        setTag(Integer.valueOf(getClickArea()));
        fm();
        dynamicRootView.setTimeOutListener(this);
        if (dynamicRootView.getRenderRequest() == null || dynamicRootView.getRenderRequest().nt()) {
            return;
        }
        View view = this.fhx;
        if (view != null) {
            view.setVisibility(8);
        }
        setVisibility(8);
    }

    private void fm() {
        List<com.bytedance.sdk.component.adexpress.dynamic.yz.wu> listKu = this.dsz.ku();
        if (listKu == null || listKu.size() <= 0) {
            return;
        }
        Iterator<com.bytedance.sdk.component.adexpress.dynamic.yz.wu> it = listKu.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            com.bytedance.sdk.component.adexpress.dynamic.yz.wu next = it.next();
            if (TextUtils.equals("skip-with-time-skip-btn", next.vt().ro())) {
                int iFm = (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.ku, next.wu() + (com.bytedance.sdk.component.adexpress.yz.ro() ? next.dsz() : 0));
                this.wey = iFm;
                this.fm = this.wsy - iFm;
            }
        }
        this.sds = this.wsy - this.fm;
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.dynamicview.jnr
    public void ajl() {
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        if (this.ro) {
            layoutParams.leftMargin = this.f6471ef;
        } else {
            layoutParams.leftMargin = this.f6471ef + this.sds;
        }
        if (this.maa && this.duv != null) {
            layoutParams.leftMargin = ((this.f6471ef + this.sds) - ((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.lb()))) - ((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.yz()));
        }
        if (com.bytedance.sdk.component.adexpress.yz.ro()) {
            layoutParams.topMargin = this.vt - ((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.ro()));
        } else {
            layoutParams.topMargin = this.vt;
        }
        layoutParams.setMarginStart(layoutParams.leftMargin);
        layoutParams.setMarginEnd(layoutParams.rightMargin);
        setLayoutParams(layoutParams);
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.dynamicview.ajl, com.bytedance.sdk.component.adexpress.dynamic.dynamicview.pkk
    public boolean ef() {
        if (com.bytedance.sdk.component.adexpress.yz.ajl.ro(this.onz.getRenderRequest().yz())) {
            return true;
        }
        super.ef();
        setPadding((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.lb()), (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.ro()), (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.yz()), (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.fm()));
        return true;
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.dynamicview.ajl
    public FrameLayout.LayoutParams getWidgetLayoutParams() {
        return new FrameLayout.LayoutParams(-2, -2);
    }

    @Override // android.widget.FrameLayout, android.view.View
    public void onMeasure(int i10, int i11) {
        super.onMeasure(i10, i11);
        if (this.maa && this.duv != null) {
            setMeasuredDimension(this.wey + ((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.lb())) + ((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.yz())), this.wu);
        } else if (this.ro) {
            setMeasuredDimension(this.wsy, this.wu);
        } else {
            setMeasuredDimension(this.fm, this.wu);
        }
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.lb
    public void fm(CharSequence charSequence, boolean z10, int i10, boolean z11) {
        if (z11 && this.maa != z11) {
            this.maa = z11;
            ajl();
            return;
        }
        if (z10 && this.ro != z10) {
            this.ro = z10;
            ajl();
        }
        this.ro = z10;
    }
}
