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

import android.content.Context;
import android.text.TextUtils;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.media3.exoplayer.upstream.CmcdData;

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

    public nt(Context context, DynamicRootView dynamicRootView, com.bytedance.sdk.component.adexpress.dynamic.yz.wu wuVar) {
        super(context, dynamicRootView, wuVar);
        dynamicRootView.setTimeOutListener(this);
        if ("timedown".equals(wuVar.vt().ro())) {
            dynamicRootView.setTimedown(this.wu);
        }
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.dynamicview.jnr
    public void ajl() {
        if (!TextUtils.equals("skip-with-countdowns-video-countdown", this.dsz.vt().ro()) && !TextUtils.equals("skip-with-time-countdown", this.dsz.vt().ro())) {
            super.ajl();
            return;
        }
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(this.wsy, this.wu);
        layoutParams.gravity = 8388627;
        if (com.bytedance.sdk.component.adexpress.yz.ro()) {
            layoutParams.leftMargin = this.f6471ef;
        }
        layoutParams.setMarginStart(layoutParams.leftMargin);
        layoutParams.setMarginEnd(layoutParams.rightMargin);
        setLayoutParams(layoutParams);
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.dynamicview.wsy, com.bytedance.sdk.component.adexpress.dynamic.dynamicview.ajl, com.bytedance.sdk.component.adexpress.dynamic.dynamicview.pkk
    public boolean ef() {
        super.ef();
        if (com.bytedance.sdk.component.adexpress.yz.ajl.ro(this.onz.getRenderRequest().yz())) {
            setVisibility(8);
        }
        if ("timedown".equals(this.dsz.vt().ro())) {
            ((TextView) this.fhx).setText(String.valueOf((int) Double.parseDouble(this.duv.vt())));
            return true;
        }
        ((TextView) this.fhx).setText(((int) Double.parseDouble(this.duv.vt())) + CmcdData.STREAMING_FORMAT_SS);
        return true;
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.lb
    public void fm(CharSequence charSequence, boolean z10, int i10, boolean z11) {
        if (z11 || this.wey) {
            ((TextView) this.fhx).setText("");
            setVisibility(8);
            return;
        }
        try {
            if (Integer.parseInt((String) charSequence) <= 0) {
                setVisibility(8);
                return;
            }
        } catch (Exception unused) {
        }
        setVisibility(0);
        if (!z10 && this.onz.getRenderRequest().fm() && com.bytedance.sdk.component.adexpress.yz.ajl.ro(this.onz.getRenderRequest().yz())) {
            if (com.bytedance.sdk.component.adexpress.yz.ro()) {
                ((TextView) this.fhx).setText(i10 + CmcdData.STREAMING_FORMAT_SS);
            } else {
                ((TextView) this.fhx).setText(String.format(com.bytedance.sdk.component.utils.maa.fm(com.bytedance.sdk.component.adexpress.yz.fm(), "tt_reward_full_skip"), Integer.valueOf(i10)));
            }
            this.fm = true;
            return;
        }
        if (com.bytedance.sdk.component.adexpress.yz.ro() && !"open_ad".equals(this.onz.getRenderRequest().yz()) && this.onz.getRenderRequest().fm()) {
            this.wey = true;
            setVisibility(8);
            return;
        }
        if ("timedown".equals(this.dsz.vt().ro())) {
            ((TextView) this.fhx).setText(charSequence);
            return;
        }
        ((TextView) this.fhx).setText(((Object) charSequence) + CmcdData.STREAMING_FORMAT_SS);
        this.ro = true;
        if (this.fm) {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams((int) (com.bytedance.sdk.component.adexpress.yz.wsy.fm(com.bytedance.sdk.component.adexpress.yz.fm(), this.duv.yz() + this.duv.lb()) + com.bytedance.sdk.component.adexpress.dynamic.jnr.ku.ro(((TextView) this.fhx).getText() != null ? r5.toString() : "", this.duv.jnr(), true)[0]), this.wu);
            layoutParams.gravity = 8388629;
            this.fhx.setLayoutParams(layoutParams);
            this.fm = false;
            requestLayout();
        }
    }

    @Override // android.widget.FrameLayout, android.view.View
    public void onMeasure(int i10, int i11) {
        super.onMeasure(i10, i11);
        if (TextUtils.isEmpty(((TextView) this.fhx).getText())) {
            setMeasuredDimension(0, this.wu);
        }
    }
}
