package com.bytedance.sdk.openadsdk.component.ef;

import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.bytedance.sdk.openadsdk.core.gof;
import com.bytedance.sdk.openadsdk.core.model.lse;
import com.bytedance.sdk.openadsdk.core.vt;
import com.bytedance.sdk.openadsdk.core.widget.qhl;
import com.bytedance.sdk.openadsdk.utils.zan;

/* JADX INFO: loaded from: classes2.dex */
public class wu {
    private static boolean fm;
    private static Drawable ro;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private qhl f6877lb;
    private TextView yz;

    public static Drawable lb() {
        return ro;
    }

    public void fm(lb lbVar, lse lseVar, float f10, float f11, boolean z10) {
        ViewGroup.LayoutParams layoutParams;
        ViewGroup.LayoutParams layoutParams2;
        if (lbVar != null) {
            this.f6877lb = lbVar.getHostAppIcon();
            this.yz = lbVar.getHostAppName();
            View userInfo = lbVar.getUserInfo();
            if (lbVar instanceof yz) {
                qhl qhlVar = this.f6877lb;
                if (qhlVar != null && (layoutParams2 = qhlVar.getLayoutParams()) != null) {
                    if (lseVar.nnq() == 1) {
                        int iRo = zan.ro(this.f6877lb.getContext(), 40.0f);
                        layoutParams2.width = iRo;
                        layoutParams2.height = iRo;
                    } else {
                        int iRo2 = zan.ro(this.f6877lb.getContext(), 30.0f);
                        layoutParams2.width = iRo2;
                        layoutParams2.height = iRo2;
                    }
                    this.f6877lb.setLayoutParams(layoutParams2);
                }
                if (this.yz != null) {
                    if (lseVar.nnq() == 1) {
                        this.yz.setTextSize(30.0f);
                    } else {
                        this.yz.setTextSize(24.0f);
                    }
                }
                if (userInfo != null && (layoutParams = userInfo.getLayoutParams()) != null) {
                    if (lseVar.nnq() == 1) {
                        layoutParams.height = zan.ro(userInfo.getContext(), 107.0f);
                    } else {
                        layoutParams.height = zan.ro(userInfo.getContext(), 60.0f);
                    }
                    userInfo.setLayoutParams(layoutParams);
                }
            }
            if (userInfo != null) {
                userInfo.setOnClickListener(new View.OnClickListener() { // from class: com.bytedance.sdk.openadsdk.component.ef.wu.1
                    @Override // android.view.View.OnClickListener
                    public void onClick(View view) {
                    }
                });
            }
        }
    }

    public void ro() {
        if (fm) {
            return;
        }
        try {
            int iEf = vt.ro().ef();
            if (iEf != 0) {
                ro = gof.fm().getResources().getDrawable(iEf);
            }
            fm = true;
        } catch (Throwable unused) {
            fm = true;
        }
    }

    public void fm() {
        String strWu = vt.ro().wu();
        if (TextUtils.isEmpty(strWu)) {
            this.yz.setVisibility(8);
        } else {
            this.yz.setText(strWu);
        }
        ro();
        try {
            Drawable drawable = ro;
            if (drawable == null) {
                this.f6877lb.setVisibility(8);
                return;
            }
            this.f6877lb.setImageDrawable(drawable);
            if (this.yz.getVisibility() == 8) {
                ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.f6877lb.getLayoutParams();
                marginLayoutParams.setMargins(0, 0, 0, 0);
                this.f6877lb.setLayoutParams(marginLayoutParams);
            }
        } catch (Throwable unused) {
            this.f6877lb.setVisibility(8);
        }
    }
}
