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

import android.content.Context;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bytedance.sdk.component.utils.ai;
import com.bytedance.sdk.component.utils.maa;

/* JADX INFO: loaded from: classes.dex */
public class ku implements wsy<ViewGroup> {
    private final com.bytedance.sdk.component.adexpress.ajl.vt fm;
    private final FrameLayout ro;

    public ku(Context context, com.bytedance.sdk.component.adexpress.dynamic.dynamicview.jnr jnrVar, com.bytedance.sdk.component.adexpress.dynamic.yz.wsy wsyVar, String str, String str2) {
        com.bytedance.sdk.component.adexpress.ajl.vt vtVar = new com.bytedance.sdk.component.adexpress.ajl.vt(context);
        this.fm = vtVar;
        vtVar.setImageLottieTosPath(str);
        FrameLayout frameLayout = new FrameLayout(context);
        this.ro = frameLayout;
        frameLayout.addView(vtVar, new FrameLayout.LayoutParams(-2, -2));
        double dSo = wsyVar.so();
        dSo = dSo == 0.0d ? 1.0d : dSo;
        double dAws = wsyVar.aws();
        double d10 = dAws != 0.0d ? dAws : 1.0d;
        if ("22".equals(str2)) {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(context, 250.0f));
            layoutParams.gravity = 81;
            layoutParams.bottomMargin = (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(context, 120.0f);
            frameLayout.setLayoutParams(layoutParams);
            return;
        }
        if (!"20".equals(str2)) {
            FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams((int) (((double) jnrVar.getDynamicWidth()) * 0.32d * dSo), (int) (((double) jnrVar.getDynamicWidth()) * 0.32d * d10));
            layoutParams2.gravity = 17;
            frameLayout.setLayoutParams(layoutParams2);
        } else {
            fm(context, frameLayout, wsyVar);
            FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-2, -2);
            layoutParams3.gravity = 81;
            layoutParams3.bottomMargin = (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(context, wsyVar.ib() > 0 ? wsyVar.ib() : com.bytedance.sdk.component.adexpress.yz.ro() ? 0 : 120);
            frameLayout.setLayoutParams(layoutParams3);
            frameLayout.setClipChildren(false);
        }
    }

    private void fm(Context context, FrameLayout frameLayout, com.bytedance.sdk.component.adexpress.dynamic.yz.wsy wsyVar) {
        LinearLayout linearLayout = new LinearLayout(context);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        layoutParams.gravity = 17;
        layoutParams.setMargins(0, -ai.fm(context, 5.0f), 0, 0);
        linearLayout.setLayoutParams(layoutParams);
        linearLayout.setOrientation(1);
        TextView textView = new TextView(context);
        textView.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
        textView.setText(context.getString(maa.ro(context, "tt_splash_brush_mask_title")));
        textView.setTextColor(-1);
        textView.setTextSize(2, 20.0f);
        TextView textView2 = new TextView(context);
        textView2.setId(2097610738);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
        layoutParams2.setMargins(0, ai.fm(context, 5.0f), 0, 0);
        textView2.setLayoutParams(layoutParams2);
        textView2.setText(context.getString(maa.ro(context, "tt_splash_brush_mask_hint")));
        if (wsyVar != null && !TextUtils.isEmpty(wsyVar.lmk())) {
            textView2.setText(wsyVar.lmk());
        }
        textView2.setTextColor(-1);
        textView2.setTextSize(2, 14.0f);
        linearLayout.addView(textView);
        linearLayout.addView(textView2);
        frameLayout.addView(linearLayout);
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.lb.wsy
    public ViewGroup lb() {
        return this.ro;
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.lb.wsy
    public void ro() {
        this.fm.ajl();
        ViewParent parent = this.ro.getParent();
        if (parent instanceof ViewGroup) {
            ((ViewGroup) parent).removeView(this.ro);
        }
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.lb.wsy
    public void fm() {
        this.fm.wu();
    }
}
