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

import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes.dex */
public class gof extends LinearLayout {
    private TextView ajl;
    private JSONObject duv;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private int f6438ef;
    private TextView fm;
    private TextView jnr;
    private int ku;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private ImageView f6439lb;
    private TextView ro;
    private int vt;
    private fm wsy;
    private LinearLayout wu;
    private com.bytedance.sdk.component.utils.hlt yz;

    /* JADX INFO: renamed from: com.bytedance.sdk.component.adexpress.ajl.gof$1, reason: invalid class name */
    public class AnonymousClass1 implements Runnable {
        public AnonymousClass1() {
        }

        @Override // java.lang.Runnable
        public void run() {
            if (gof.this.f6439lb != null) {
                final RotateAnimation rotateAnimation = new RotateAnimation(-14.0f, 14.0f, 1, 0.9f, 1, 0.9f);
                rotateAnimation.setInterpolator(new ro(null));
                rotateAnimation.setDuration(1000L);
                rotateAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.bytedance.sdk.component.adexpress.ajl.gof.1.1
                    @Override // android.view.animation.Animation.AnimationListener
                    public void onAnimationEnd(Animation animation) {
                        gof.this.postDelayed(new Runnable() { // from class: com.bytedance.sdk.component.adexpress.ajl.gof.1.1.1
                            @Override // java.lang.Runnable
                            public void run() {
                                gof.this.f6439lb.startAnimation(rotateAnimation);
                            }
                        }, 250L);
                    }

                    @Override // android.view.animation.Animation.AnimationListener
                    public void onAnimationRepeat(Animation animation) {
                    }

                    @Override // android.view.animation.Animation.AnimationListener
                    public void onAnimationStart(Animation animation) {
                    }
                });
                gof.this.f6439lb.startAnimation(rotateAnimation);
            }
        }
    }

    public interface fm {
    }

    public static class ro implements Interpolator {
        private ro() {
        }

        public /* synthetic */ ro(AnonymousClass1 anonymousClass1) {
            this();
        }

        @Override // android.animation.TimeInterpolator
        public float getInterpolation(float f10) {
            return f10 <= 0.25f ? (f10 * (-2.0f)) + 0.5f : f10 <= 0.5f ? (f10 * 4.0f) - 1.0f : f10 <= 0.75f ? (f10 * (-4.0f)) + 3.0f : (f10 * 2.0f) - 1.5f;
        }
    }

    public gof(@NonNull Context context, View view, int i10, int i11, int i12, JSONObject jSONObject) {
        super(context);
        this.f6438ef = i10;
        this.vt = i11;
        this.ku = i12;
        this.duv = jSONObject;
        fm(context, view);
    }

    public LinearLayout getShakeLayout() {
        return this.wu;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (isShown()) {
            if (this.yz == null) {
                this.yz = new com.bytedance.sdk.component.utils.hlt(getContext().getApplicationContext(), 1);
            }
            new Object() { // from class: com.bytedance.sdk.component.adexpress.ajl.gof.2
            };
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
    }

    @Override // android.view.View
    public void onWindowFocusChanged(boolean z10) {
    }

    public void setOnShakeViewListener(fm fmVar) {
        this.wsy = fmVar;
    }

    public void setShakeText(String str) {
        if (!TextUtils.isEmpty(str)) {
            this.jnr.setText(str);
        } else {
            this.jnr.setVisibility(8);
            this.ajl.setVisibility(8);
        }
    }

    public void fm(Context context, View view) {
        addView(view);
        this.wu = (LinearLayout) findViewById(2097610727);
        this.f6439lb = (ImageView) findViewById(2097610725);
        this.fm = (TextView) findViewById(2097610724);
        this.ro = (TextView) findViewById(2097610726);
        this.jnr = (TextView) findViewById(2097610723);
        this.ajl = (TextView) findViewById(2097610728);
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setShape(1);
        gradientDrawable.setColor(Color.parseColor("#57000000"));
        this.wu.setBackground(gradientDrawable);
    }

    public void fm() {
        ObjectAnimator objectAnimatorOfFloat = ObjectAnimator.ofFloat(this, "alpha", 0.0f, 1.0f);
        objectAnimatorOfFloat.setDuration(300L);
        objectAnimatorOfFloat.start();
        postDelayed(new AnonymousClass1(), 500L);
    }
}
