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

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import com.bytedance.sdk.openadsdk.utils.zan;

/* JADX INFO: loaded from: classes2.dex */
public class gof extends fm {
    private FrameLayout dsz;
    private sds duv;
    private FrameLayout fm;

    public gof(@NonNull Context context) {
        super(context);
        this.ro = context;
    }

    private void lb() {
        com.bytedance.sdk.openadsdk.core.ajl.lb lbVar = new com.bytedance.sdk.openadsdk.core.ajl.lb(this.ro);
        this.fm = lbVar;
        addView(lbVar, new FrameLayout.LayoutParams(-1, -1));
        com.bytedance.sdk.openadsdk.core.ajl.lb lbVar2 = new com.bytedance.sdk.openadsdk.core.ajl.lb(this.ro);
        this.dsz = lbVar2;
        this.fm.addView(lbVar2, new FrameLayout.LayoutParams(-1, -1));
        this.dsz.removeAllViews();
    }

    private void ro() {
        this.wsy = zan.ro(this.ro, this.duv.getExpectExpressWidth());
        this.wu = zan.ro(this.ro, this.duv.getExpectExpressWidth());
        ViewGroup.LayoutParams layoutParams = getLayoutParams();
        if (layoutParams == null) {
            layoutParams = new ViewGroup.LayoutParams(this.wsy, this.wu);
        }
        layoutParams.width = this.wsy;
        layoutParams.height = this.wu;
        if (layoutParams instanceof FrameLayout.LayoutParams) {
            ((FrameLayout.LayoutParams) layoutParams).gravity = 17;
        }
        setLayoutParams(layoutParams);
        this.f7298lb.daz();
        lb();
    }

    public void fm(com.bytedance.sdk.openadsdk.core.model.lse lseVar, sds sdsVar, ViewGroup viewGroup) {
        if (lseVar == null) {
            return;
        }
        setBackgroundColor(-1);
        this.f7298lb = lseVar;
        this.duv = sdsVar;
        if (lseVar.ie() == 7) {
            this.ajl = "rewarded_video";
        } else {
            this.ajl = "fullscreen_interstitial_ad";
        }
        ro();
        if (com.bytedance.sdk.openadsdk.core.model.wey.lb(lseVar)) {
            this.duv.addView(this, new ViewGroup.LayoutParams(-1, -1));
        } else {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
            layoutParams.gravity = 17;
            this.duv.addView(this, layoutParams);
        }
        int i10 = com.bytedance.sdk.openadsdk.utils.qhl.gz;
        View viewFindViewById = viewGroup.findViewById(i10);
        if (viewFindViewById != null) {
            Object tag = viewFindViewById.getTag(i10);
            if (tag instanceof String) {
                String str = (String) tag;
                if (TextUtils.isEmpty(str)) {
                    return;
                }
                com.bytedance.sdk.openadsdk.wey.ro.ro().fm(str, viewFindViewById);
            }
        }
    }

    public View getBackupContainerBackgroundView() {
        return this.fm;
    }

    public FrameLayout getVideoContainer() {
        return this.dsz;
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.fm
    public void fm(View view, int i10, com.bytedance.sdk.openadsdk.core.model.irt irtVar) {
        sds sdsVar = this.duv;
        if (sdsVar != null) {
            sdsVar.fm(view, i10, irtVar);
        }
    }
}
