package com.bytedance.sdk.component.adexpress.vc;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
/* loaded from: classes2.dex */
public class YI extends LinearLayout {
    private YFl AlY;
    private com.bytedance.sdk.component.adexpress.dynamic.AlY.nc DSW;
    private com.bytedance.sdk.component.utils.aIu Sg;
    private TextView YFl;
    private TextView tN;
    private com.bytedance.adsdk.Sg.vc vc;
    private LinearLayout wN;

    /* loaded from: classes2.dex */
    public interface YFl {
    }

    public TextView getTopTextView() {
        return this.YFl;
    }

    public LinearLayout getWriggleLayout() {
        return this.wN;
    }

    public View getWriggleProgressIv() {
        return this.vc;
    }

    public void setOnShakeViewListener(YFl yFl) {
        this.AlY = yFl;
    }

    public YI(Context context, View view, com.bytedance.sdk.component.adexpress.dynamic.AlY.nc ncVar) {
        super(context);
        this.DSW = ncVar;
        YFl(context, view);
    }

    private void YFl(Context context, View view) {
        setClipChildren(false);
        addView(view);
        this.wN = (LinearLayout) findViewById(2097610722);
        this.YFl = (TextView) findViewById(2097610719);
        this.tN = (TextView) findViewById(2097610718);
        com.bytedance.adsdk.Sg.vc vcVar = (com.bytedance.adsdk.Sg.vc) findViewById(2097610706);
        this.vc = vcVar;
        vcVar.setAnimation("lottie_json/twist_multi_angle.json");
        this.vc.setImageAssetsFolder("images/");
        this.vc.YFl(true);
    }

    public void setShakeText(String str) {
        this.tN.setText(str);
    }

    public void YFl() {
        postDelayed(new Runnable() { // from class: com.bytedance.sdk.component.adexpress.vc.YI.1
            @Override // java.lang.Runnable
            public void run() {
                try {
                    YI.this.vc.YFl();
                } catch (Throwable unused) {
                }
            }
        }, 500L);
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (isShown()) {
            if (this.Sg == null) {
                this.Sg = new com.bytedance.sdk.component.utils.aIu(getContext().getApplicationContext(), 2);
            }
            new Object() { // from class: com.bytedance.sdk.component.adexpress.vc.YI.2
            };
            com.bytedance.sdk.component.adexpress.dynamic.AlY.nc ncVar = this.DSW;
            if (ncVar != null) {
                ncVar.tN();
                this.DSW.wN();
                this.DSW.vc();
                this.DSW.qsH();
            }
            this.Sg.onResume();
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        try {
            com.bytedance.adsdk.Sg.vc vcVar = this.vc;
            if (vcVar != null) {
                vcVar.wN();
            }
        } catch (Exception unused) {
        }
    }

    @Override // android.view.View
    public void onWindowFocusChanged(boolean z) {
        com.bytedance.sdk.component.utils.aIu aiu = this.Sg;
        if (aiu == null || !z) {
            return;
        }
        aiu.onResume();
    }
}
