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

import android.content.Context;
import android.text.TextUtils;
import android.widget.FrameLayout;
import android.widget.TextView;

/* JADX INFO: loaded from: classes.dex */
public class wsy extends ajl {
    public wsy(Context context, DynamicRootView dynamicRootView, com.bytedance.sdk.component.adexpress.dynamic.yz.wu wuVar) {
        super(context, dynamicRootView, wuVar);
        com.bytedance.sdk.component.adexpress.dynamic.animation.view.fm fmVar = new com.bytedance.sdk.component.adexpress.dynamic.animation.view.fm(context);
        this.fhx = fmVar;
        fmVar.setTag(Integer.valueOf(getClickArea()));
        addView(this.fhx, getWidgetLayoutParams());
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.dynamicview.ajl, com.bytedance.sdk.component.adexpress.dynamic.dynamicview.pkk
    public boolean ef() {
        super.ef();
        if (TextUtils.equals("download-progress-button", this.dsz.vt().ro()) && TextUtils.isEmpty(this.duv.vt())) {
            this.fhx.setVisibility(4);
            return true;
        }
        this.fhx.setTextAlignment(this.duv.wu());
        ((TextView) this.fhx).setText(this.duv.vt());
        ((TextView) this.fhx).setTextColor(this.duv.wsy());
        ((TextView) this.fhx).setTextSize(this.duv.jnr());
        ((TextView) this.fhx).setGravity(17);
        ((TextView) this.fhx).setIncludeFontPadding(false);
        if ("fillButton".equals(this.dsz.vt().ro())) {
            this.fhx.setPadding(0, 0, 0, 0);
        } else {
            this.fhx.setPadding(this.duv.lb(), this.duv.ro(), this.duv.yz(), this.duv.fm());
        }
        return true;
    }

    @Override // com.bytedance.sdk.component.adexpress.dynamic.dynamicview.ajl
    public FrameLayout.LayoutParams getWidgetLayoutParams() {
        if (!com.bytedance.sdk.component.adexpress.yz.ro() || !"fillButton".equals(this.dsz.vt().ro())) {
            return super.getWidgetLayoutParams();
        }
        ((TextView) this.fhx).setEllipsize(TextUtils.TruncateAt.END);
        ((TextView) this.fhx).setMaxLines(1);
        FrameLayout.LayoutParams widgetLayoutParams = super.getWidgetLayoutParams();
        widgetLayoutParams.width -= this.duv.gof() * 2;
        widgetLayoutParams.height -= this.duv.gof() * 2;
        widgetLayoutParams.topMargin = this.duv.gof() + widgetLayoutParams.topMargin;
        int iGof = this.duv.gof() + widgetLayoutParams.leftMargin;
        widgetLayoutParams.leftMargin = iGof;
        widgetLayoutParams.setMarginStart(iGof);
        widgetLayoutParams.setMarginEnd(widgetLayoutParams.rightMargin);
        return widgetLayoutParams;
    }
}
