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.text.TextUtils;
import android.view.animation.PathInterpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

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

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

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

    public sds(Context context) {
        super(context);
        this.ajl = new AnimatorSet();
        this.wsy = new AnimatorSet();
        this.wu = new AnimatorSet();
        this.f6453ef = new AnimatorSet();
        this.ku = 100;
        fm(context);
    }

    public AnimatorSet getSlideUpAnimatorSet() {
        return this.ajl;
    }

    public void lb() {
        ObjectAnimator objectAnimatorOfFloat = ObjectAnimator.ofFloat(this.fm, "alpha", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat2 = ObjectAnimator.ofFloat(this.fm, "alpha", 1.0f, 0.0f);
        ObjectAnimator objectAnimatorOfFloat3 = ObjectAnimator.ofFloat(this.fm, "translationY", 0.0f, com.bytedance.sdk.component.adexpress.yz.wsy.fm(getContext(), -this.ku));
        objectAnimatorOfFloat3.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(), this.ku));
        valueAnimatorOfInt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.component.adexpress.ajl.sds.2
            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                if (sds.this.f6454lb != null) {
                    Integer num = (Integer) valueAnimator.getAnimatedValue();
                    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) sds.this.f6454lb.getLayoutParams();
                    layoutParams.height = num.intValue();
                    sds.this.f6454lb.setLayoutParams(layoutParams);
                }
            }
        });
        valueAnimatorOfInt.setInterpolator(new PathInterpolator(0.2f, 0.0f, 0.3f, 1.0f));
        ObjectAnimator objectAnimatorOfFloat4 = ObjectAnimator.ofFloat(this.f6454lb, "alpha", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat5 = ObjectAnimator.ofFloat(this.f6454lb, "alpha", 1.0f, 0.0f);
        ObjectAnimator objectAnimatorOfFloat6 = ObjectAnimator.ofFloat(this.ro, "alpha", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat7 = ObjectAnimator.ofFloat(this.ro, "alpha", 1.0f, 0.0f);
        ObjectAnimator objectAnimatorOfFloat8 = ObjectAnimator.ofFloat(this.ro, "scaleX", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat9 = ObjectAnimator.ofFloat(this.ro, "scaleY", 0.0f, 1.0f);
        ObjectAnimator objectAnimatorOfFloat10 = ObjectAnimator.ofFloat(this.ro, "translationY", 0.0f, com.bytedance.sdk.component.adexpress.yz.wsy.fm(getContext(), -this.ku));
        objectAnimatorOfFloat10.setInterpolator(new PathInterpolator(0.2f, 0.0f, 0.3f, 1.0f));
        this.wsy.setDuration(50L);
        this.f6453ef.setDuration(1500L);
        this.wu.setDuration(50L);
        this.wsy.playTogether(objectAnimatorOfFloat2, objectAnimatorOfFloat7, objectAnimatorOfFloat5);
        this.wu.playTogether(objectAnimatorOfFloat, objectAnimatorOfFloat6, objectAnimatorOfFloat8, objectAnimatorOfFloat9, objectAnimatorOfFloat4);
        this.f6453ef.playTogether(objectAnimatorOfFloat3, valueAnimatorOfInt, objectAnimatorOfFloat10);
        this.ajl.playSequentially(this.wu, this.f6453ef, this.wsy);
    }

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

    public void setGuideText(String str) {
        TextView textView = this.yz;
        if (textView != null) {
            textView.setText(str);
        }
    }

    public void setSlideText(String str) {
        if (this.jnr != null) {
            if (TextUtils.isEmpty(str)) {
                this.jnr.setText("");
            } else {
                this.jnr.setText(str);
            }
        }
    }

    public void fm(Context context) {
        if (context == null) {
            context = com.bytedance.sdk.component.adexpress.yz.fm();
        }
        if ("5".equals(this.vt)) {
            addView(com.bytedance.sdk.component.adexpress.lb.fm.ajl(context));
            this.ku = (int) (((double) this.ku) * 1.25d);
        } else {
            addView(com.bytedance.sdk.component.adexpress.lb.fm.jnr(context));
        }
        this.fm = (ImageView) findViewById(2097610734);
        this.ro = (ImageView) findViewById(2097610735);
        this.yz = (TextView) findViewById(2097610730);
        this.f6454lb = (ImageView) findViewById(2097610733);
        this.jnr = (TextView) findViewById(2097610731);
    }

    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.wsy;
            if (animatorSet3 != null) {
                animatorSet3.cancel();
            }
            AnimatorSet animatorSet4 = this.f6453ef;
            if (animatorSet4 != null) {
                animatorSet4.cancel();
            }
        } catch (Exception e10) {
            e10.getMessage();
        }
    }

    public sds(Context context, String str) {
        super(context);
        this.ajl = new AnimatorSet();
        this.wsy = new AnimatorSet();
        this.wu = new AnimatorSet();
        this.f6453ef = new AnimatorSet();
        this.ku = 100;
        setClipChildren(false);
        this.vt = str;
        fm(context);
    }

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