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

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;

/* JADX INFO: loaded from: classes.dex */
public class wey extends FrameLayout {
    private AnimatorSet ajl;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private AnimatorSet f6457ef;
    private Context fm;
    private TextView jnr;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private ImageView f6458lb;
    private ImageView ro;
    private AnimatorSet wsy;
    private AnimatorSet wu;
    private ImageView yz;

    public wey(@NonNull Context context) {
        super(context);
        this.ajl = new AnimatorSet();
        this.wsy = new AnimatorSet();
        this.wu = new AnimatorSet();
        this.f6457ef = new AnimatorSet();
        this.fm = context;
        lb();
    }

    @Override // android.view.View
    public void onSizeChanged(int i10, int i11, int i12, int i13) {
        super.onSizeChanged(i10, i11, i12, i13);
    }

    public void setGuideText(String str) {
        this.jnr.setText(str);
    }

    private void lb() {
        ImageView imageView = new ImageView(this.fm);
        this.yz = imageView;
        imageView.setBackgroundResource(com.bytedance.sdk.component.utils.maa.yz(this.fm, "tt_splash_slide_right_bg"));
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(0, -2);
        layoutParams.gravity = 48;
        layoutParams.leftMargin = (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.fm, 30.0f);
        addView(this.yz, layoutParams);
        setClipChildren(false);
        setClipToPadding(false);
        ImageView imageView2 = new ImageView(this.fm);
        this.f6458lb = imageView2;
        imageView2.setImageResource(com.bytedance.sdk.component.utils.maa.yz(this.fm, "tt_splash_slide_right_circle"));
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.fm, 50.0f), (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.fm, 50.0f));
        layoutParams2.gravity = 48;
        layoutParams2.leftMargin = (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.fm, 30.0f);
        addView(this.f6458lb, layoutParams2);
        ImageView imageView3 = new ImageView(this.fm);
        this.ro = imageView3;
        imageView3.setImageResource(com.bytedance.sdk.component.utils.maa.yz(this.fm, "tt_splash_hand2"));
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.fm, 80.0f), (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.fm, 80.0f));
        layoutParams3.gravity = 48;
        layoutParams3.leftMargin = (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(this.fm, 30.0f);
        addView(this.ro, layoutParams3);
        TextView textView = new TextView(this.fm);
        this.jnr = textView;
        textView.setTextColor(-1);
        this.jnr.setSingleLine();
        FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams4.gravity = 80;
        addView(this.jnr, layoutParams4);
        post(new Runnable() { // from class: com.bytedance.sdk.component.adexpress.ajl.wey.1
            @Override // java.lang.Runnable
            public void run() {
                FrameLayout.LayoutParams layoutParams5 = (FrameLayout.LayoutParams) wey.this.ro.getLayoutParams();
                layoutParams5.topMargin = (int) ((wey.this.f6458lb.getMeasuredHeight() / 2.0f) - com.bytedance.sdk.component.adexpress.yz.wsy.fm(wey.this.getContext(), 7.0f));
                int iFm = (-wey.this.f6458lb.getMeasuredWidth()) + ((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(wey.this.fm, 30.0f));
                layoutParams5.leftMargin = iFm;
                layoutParams5.setMarginStart(iFm);
                layoutParams5.setMarginEnd(layoutParams5.rightMargin);
                wey.this.ro.setLayoutParams(layoutParams5);
                FrameLayout.LayoutParams layoutParams6 = (FrameLayout.LayoutParams) wey.this.yz.getLayoutParams();
                layoutParams6.topMargin = (int) ((wey.this.f6458lb.getMeasuredHeight() / 2.0f) - com.bytedance.sdk.component.adexpress.yz.wsy.fm(wey.this.getContext(), 5.0f));
                layoutParams6.leftMargin = (int) ((wey.this.f6458lb.getMeasuredWidth() / 2.0f) + ((int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(wey.this.fm, 30.0f)));
                layoutParams5.setMarginStart(layoutParams5.leftMargin);
                layoutParams5.setMarginEnd(layoutParams5.rightMargin);
                wey.this.yz.setLayoutParams(layoutParams6);
            }
        });
    }

    private void yz() {
        ObjectAnimator objectAnimatorOfFloat = ObjectAnimator.ofFloat(this.ro, "alpha", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat2 = ObjectAnimator.ofFloat(this.f6458lb, "scaleX", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat3 = ObjectAnimator.ofFloat(this.f6458lb, "scaleY", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat4 = ObjectAnimator.ofFloat(this.yz, "alpha", 0.0f, 1.0f);
        this.wu.setDuration(300L);
        this.wu.playTogether(objectAnimatorOfFloat, objectAnimatorOfFloat2, objectAnimatorOfFloat3, objectAnimatorOfFloat4);
        ObjectAnimator objectAnimatorOfFloat5 = ObjectAnimator.ofFloat(this.ro, "translationX", 0.0f, com.bytedance.sdk.component.adexpress.yz.wsy.fm(getContext(), 90.0f));
        objectAnimatorOfFloat5.setInterpolator(new PathInterpolator(0.2f, 0.0f, 0.3f, 1.0f));
        ValueAnimator valueAnimatorOfInt = ValueAnimator.ofInt(0, (int) com.bytedance.sdk.component.adexpress.yz.wsy.fm(getContext(), 90.0f));
        valueAnimatorOfInt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.component.adexpress.ajl.wey.2
            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                Integer num = (Integer) valueAnimator.getAnimatedValue();
                FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) wey.this.yz.getLayoutParams();
                layoutParams.width = num.intValue();
                wey.this.yz.setLayoutParams(layoutParams);
            }
        });
        valueAnimatorOfInt.setInterpolator(new PathInterpolator(0.2f, 0.0f, 0.3f, 1.0f));
        ObjectAnimator objectAnimatorOfFloat6 = ObjectAnimator.ofFloat(this.f6458lb, "translationX", 0.0f, com.bytedance.sdk.component.adexpress.yz.wsy.fm(getContext(), 90.0f));
        objectAnimatorOfFloat6.setInterpolator(new PathInterpolator(0.2f, 0.0f, 0.3f, 1.0f));
        this.f6457ef.setDuration(1500L);
        this.f6457ef.playTogether(objectAnimatorOfFloat5, valueAnimatorOfInt, objectAnimatorOfFloat6);
        ObjectAnimator objectAnimatorOfFloat7 = ObjectAnimator.ofFloat(this.ro, "alpha", 1.0f, 0.0f);
        ObjectAnimator objectAnimatorOfFloat8 = ObjectAnimator.ofFloat(this.yz, "alpha", 1.0f, 0.0f);
        ObjectAnimator objectAnimatorOfFloat9 = ObjectAnimator.ofFloat(this.f6458lb, "alpha", 1.0f, 0.0f);
        this.wsy.setDuration(50L);
        this.wsy.playTogether(objectAnimatorOfFloat7, objectAnimatorOfFloat8, objectAnimatorOfFloat9);
        this.ajl.playSequentially(this.wu, this.f6457ef, this.wsy);
    }

    public void fm() {
        yz();
        this.ajl.start();
        this.ajl.addListener(new AnimatorListenerAdapter() { // from class: com.bytedance.sdk.component.adexpress.ajl.wey.3
            @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
            public void onAnimationEnd(Animator animator) {
                super.onAnimationEnd(animator);
                wey.this.postDelayed(new Runnable() { // from class: com.bytedance.sdk.component.adexpress.ajl.wey.3.1
                    @Override // java.lang.Runnable
                    public void run() {
                        wey.this.ajl.start();
                    }
                }, 200L);
            }
        });
    }

    public void ro() {
        try {
            AnimatorSet animatorSet = this.ajl;
            if (animatorSet != null) {
                animatorSet.cancel();
            }
            AnimatorSet animatorSet2 = this.wu;
            if (animatorSet2 != null) {
                animatorSet2.cancel();
            }
            AnimatorSet animatorSet3 = this.f6457ef;
            if (animatorSet3 != null) {
                animatorSet3.cancel();
            }
            AnimatorSet animatorSet4 = this.wsy;
            if (animatorSet4 != null) {
                animatorSet4.cancel();
            }
        } catch (Throwable unused) {
        }
    }
}
