package com.bytedance.android.livesdk.like.widget;

import X.0CB;
import X.0CH;
import X.0b0;
import X.0bQ;
import X.0cm;
import X.15V;
import X.1Fq;
import X.6Is;
import X.C2272GYv;
import X.C3086Gmd;
import X.C3909Gzu;
import X.C3975H2i;
import X.H3C;
import X.HEP;
import X.HI6;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.Keyframe;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.util.Property;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bytedance.android.livesdk.IBarrageService;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.bytedance.ies.sdk.widgets.LiveRecyclableWidget;

public class LikeUserInfoAnimWidget extends LiveRecyclableWidget implements H3C, 6Is {
    public static final float LJ;
    public View LIZ;
    public ProgressBar LIZIZ;
    public 1Fq LIZJ;
    public View LIZLLL;
    public ValueAnimator LJFF;
    public ObjectAnimator LJI;
    public ObjectAnimator LJII;
    public int LJIIIIZZ;
    public int LJIIIZ;
    public AnimatorSet LJIIJ;
    public AnimatorSet LJIIJJI;
    public Keyframe[] LJIIL;
    public AnimatorSet LJIILIIL;
    public Keyframe[] LJIILJJIL;
    public ImageView LJIILL;
    public TextView LJIILLIIL;
    public AnimatorSet LJIIZILJ;
    public Property<View, Integer> LJIJ;

    public int getLayoutId() {
        return 2131561883;
    }

    public void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    static {
        float f;
        Covode.recordClassIndex(17397);
        if (15V.LIZ(0b0.LJ())) {
            f = -18.0f;
        } else {
            f = 18.0f;
        }
        LJ = f;
    }

    public void onUnload() {
        C2272GYv likeHelper;
        Room room = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
        if (room != null && (likeHelper = 0cm.LIZ(IBarrageService.class).getLikeHelper(room.getId())) != null && likeHelper.LJIIJJI() && likeHelper.LJIIIZ()) {
            likeHelper.LIZIZ((H3C) this);
        }
        AnimatorSet animatorSet = this.LJIIZILJ;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        this.LJFF.cancel();
        this.LJI.cancel();
        this.LJII.cancel();
        this.LJIIJ.cancel();
        this.LJIIJJI.cancel();
        this.LIZJ.LJII();
    }

    public void onLoad(Object[] objArr) {
        C2272GYv likeHelper;
        Room room = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
        if (room != null && (likeHelper = 0cm.LIZ(IBarrageService.class).getLikeHelper(room.getId())) != null && likeHelper.LJIIJJI() && likeHelper.LJIIIZ()) {
            likeHelper.LIZ((H3C) this);
        }
        this.LIZLLL.setVisibility(8);
        if (!(room == null || room.getOwner() == null)) {
            HI6.LIZ(this.LJIILL, room.getOwner().getAvatarThumb(), 2131234641);
            this.LJIILL.setOnClickListener(new C3086Gmd(room));
        }
        this.LIZ.setScaleX(0.0f);
        this.LIZ.setScaleY(0.0f);
        this.LIZ.setRotation(0.0f);
        this.LIZIZ.setAlpha(0.0f);
        this.LIZIZ.setProgress(0);
        this.LIZJ.setVisibility(4);
        this.LJIIIIZZ = 0;
        this.LJIIIZ = 0;
    }

    public void onInit(Object[] objArr) {
        this.LIZ = findViewById(2131365576);
        this.LIZIZ = (ProgressBar) findViewById(2131368999);
        1Fq findViewById = findViewById(2131363066);
        this.LIZJ = findViewById;
        findViewById.LIZ(new AnimatorListenerAdapter() {
            static {
                Covode.recordClassIndex(17398);
            }

            public final void onAnimationEnd(Animator animator) {
                super.onAnimationEnd(animator);
                LikeUserInfoAnimWidget.this.LIZJ.setVisibility(4);
            }
        });
        ValueAnimator ofInt = ValueAnimator.ofInt(new int[]{0, 1200});
        this.LJFF = ofInt;
        ofInt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            static {
                Covode.recordClassIndex(17399);
            }

            /* JADX WARNING: Removed duplicated region for block: B:23:0x0068  */
            /* JADX WARNING: Removed duplicated region for block: B:24:0x006c  */
            /* Code decompiled incorrectly, please refer to instructions dump. */
            public final void onAnimationUpdate(android.animation.ValueAnimator r7) {
                /*
                    r6 = this;
                    java.lang.Object r0 = r7.getAnimatedValue()
                    java.lang.Integer r0 = (java.lang.Integer) r0
                    int r4 = r0.intValue()
                    r0 = 0
                    r5 = 1065353216(0x3f800000, float:1.0)
                    r3 = 200(0xc8, float:2.8E-43)
                    if (r4 < 0) goto L_0x0029
                    if (r4 >= r3) goto L_0x0031
                    com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget r1 = com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget.this
                    android.widget.ProgressBar r1 = r1.LIZIZ
                    r1.setAlpha(r0)
                L_0x001a:
                    com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget r1 = com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget.this
                    android.view.View r1 = r1.LIZ
                    r1.setScaleX(r0)
                    com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget r1 = com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget.this
                    android.view.View r1 = r1.LIZ
                    r1.setScaleY(r0)
                    return
                L_0x0029:
                    com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget r0 = com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget.this
                    android.widget.ProgressBar r0 = r0.LIZIZ
                    r0.setAlpha(r5)
                    goto L_0x0044
                L_0x0031:
                    if (r4 < r3) goto L_0x0029
                    r0 = 400(0x190, float:5.6E-43)
                    if (r4 >= r0) goto L_0x0029
                    com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget r0 = com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget.this
                    android.widget.ProgressBar r2 = r0.LIZIZ
                    r1 = 1000593162(0x3ba3d70a, float:0.005)
                    float r0 = (float) r4
                    float r0 = r0 * r1
                    float r0 = r0 - r5
                    r2.setAlpha(r0)
                L_0x0044:
                    r0 = 450(0x1c2, float:6.3E-43)
                    if (r4 < r3) goto L_0x0051
                    if (r4 >= r0) goto L_0x0051
                    r0 = 999734169(0x3b96bb99, float:0.0046)
                    int r4 = r4 - r3
                    float r1 = (float) r4
                    float r0 = r0 * r1
                    goto L_0x001a
                L_0x0051:
                    r3 = 1064682127(0x3f75c28f, float:0.96)
                    r2 = 600(0x258, float:8.41E-43)
                    if (r4 < r0) goto L_0x0062
                    if (r4 >= r2) goto L_0x0062
                    r1 = -1163524536(0xffffffffbaa60648, float:-0.0012666667)
                L_0x005d:
                    int r4 = r4 - r2
                    float r0 = (float) r4
                    float r0 = r0 * r1
                    float r0 = r0 + r3
                    goto L_0x001a
                L_0x0062:
                    if (r4 < r2) goto L_0x006c
                    r0 = 1200(0x4b0, float:1.682E-42)
                    if (r4 > r0) goto L_0x006c
                    r1 = 948686698(0x388bcf6a, float:6.6666704E-5)
                    goto L_0x005d
                L_0x006c:
                    r0 = 1065353216(0x3f800000, float:1.0)
                    goto L_0x001a
                */
                throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.like.widget.LikeUserInfoAnimWidget.AnonymousClass2.onAnimationUpdate(android.animation.ValueAnimator):void");
            }
        });
        this.LJFF.setDuration(1200);
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.LIZ, View.ROTATION, new float[]{0.0f, LJ, 0.0f});
        this.LJI = ofFloat;
        ofFloat.setDuration(200);
        ObjectAnimator ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_X, new Keyframe[]{Keyframe.ofFloat(0.0f, 1.0f), Keyframe.ofFloat(0.6f, 1.7f), Keyframe.ofFloat(1.0f, 1.5f)}), PropertyValuesHolder.ofKeyframe(View.SCALE_Y, new Keyframe[]{Keyframe.ofFloat(0.0f, 1.0f), Keyframe.ofFloat(0.6f, 1.7f), Keyframe.ofFloat(1.0f, 1.5f)})});
        this.LJII = ofPropertyValuesHolder;
        ofPropertyValuesHolder.setDuration(200);
        this.LJIIL = new Keyframe[]{Keyframe.ofFloat(0.0f, 1.0f), Keyframe.ofFloat(0.375f, 1.15f), Keyframe.ofFloat(1.0f, 0.0f)};
        AnimatorSet animatorSet = new AnimatorSet();
        this.LJIIJJI = animatorSet;
        animatorSet.playTogether(new Animator[]{ObjectAnimator.ofPropertyValuesHolder(this.LIZIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.ALPHA, new Keyframe[]{Keyframe.ofFloat(0.0f, this.LIZ.getAlpha()), Keyframe.ofFloat(0.5f, 0.0f)})})});
        AnimatorSet animatorSet2 = new AnimatorSet();
        this.LJIIJ = animatorSet2;
        animatorSet2.setDuration(400);
        this.LJIILJJIL = new Keyframe[]{Keyframe.ofFloat(0.0f, 1.5f), Keyframe.ofFloat(0.375f, 1.7f), Keyframe.ofFloat(1.0f, 0.0f)};
        AnimatorSet animatorSet3 = new AnimatorSet();
        this.LJIILIIL = animatorSet3;
        animatorSet3.setDuration(400);
        this.LIZLLL = findViewById(2131370925);
        this.LJIILL = (ImageView) findViewById(2131370924);
        this.LJIILLIIL = (TextView) findViewById(2131370926);
        this.LJIJ = new Property<View, Integer>(Integer.class, "width") {
            static {
                Covode.recordClassIndex(17400);
            }

            public final /* synthetic */ Object get(Object obj) {
                return Integer.valueOf(((View) obj).getLayoutParams().width);
            }

            public final /* synthetic */ void set(Object obj, Object obj2) {
                View view = (View) obj;
                ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
                layoutParams.width = ((Integer) obj2).intValue();
                view.setLayoutParams(layoutParams);
            }
        };
    }

    public final void LIZ(C2272GYv gYv, int i) {
        ObjectAnimator ofPropertyValuesHolder;
        ObjectAnimator ofPropertyValuesHolder2;
        ObjectAnimator ofPropertyValuesHolder3;
        ObjectAnimator ofPropertyValuesHolder4;
        if (gYv.LJIIL()) {
            if (i >= gYv.LIZLLL()) {
                if (this.LJII.isRunning()) {
                    this.LJII.cancel();
                    ofPropertyValuesHolder3 = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_X, new Keyframe[]{Keyframe.ofFloat(0.0f, this.LIZ.getScaleX()), Keyframe.ofFloat(1.0f, 0.0f)})});
                    ofPropertyValuesHolder4 = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_Y, new Keyframe[]{Keyframe.ofFloat(0.0f, this.LIZ.getScaleY()), Keyframe.ofFloat(1.0f, 0.0f)})});
                } else {
                    ofPropertyValuesHolder3 = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_X, this.LJIILJJIL)});
                    ofPropertyValuesHolder4 = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_Y, this.LJIILJJIL)});
                }
                this.LJIILIIL.playTogether(new Animator[]{ofPropertyValuesHolder3, ofPropertyValuesHolder4, this.LJIIJJI});
                this.LJIILIIL.start();
                AnimatorSet animatorSet = this.LJIIZILJ;
                if (animatorSet != null) {
                    animatorSet.cancel();
                } else {
                    this.LJIIZILJ = new AnimatorSet();
                }
                TextView textView = this.LJIILLIIL;
                textView.setText(textView.getContext().getString(2131830362, new Object[]{C3909Gzu.LIZ(i)}));
                this.LIZLLL.measure(View.MeasureSpec.makeMeasureSpec(0, 0), View.MeasureSpec.makeMeasureSpec(0, 0));
                ObjectAnimator ofPropertyValuesHolder5 = ObjectAnimator.ofPropertyValuesHolder(this.LIZLLL, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.ALPHA, new Keyframe[]{Keyframe.ofFloat(0.0f, 0.0f), Keyframe.ofFloat(0.15384616f, 1.0f)}), PropertyValuesHolder.ofKeyframe(this.LJIJ, new Keyframe[]{Keyframe.ofInt(0.0f, 0b0.LIZ(36.0f)), Keyframe.ofInt(0.07692308f, 0b0.LIZ(36.0f)), Keyframe.ofInt(1.0f, this.LIZLLL.getMeasuredWidth())})});
                ofPropertyValuesHolder5.setInterpolator(new DecelerateInterpolator());
                ofPropertyValuesHolder5.setDuration(1300);
                ViewGroup.LayoutParams layoutParams = this.LJIILLIIL.getLayoutParams();
                layoutParams.width = this.LIZLLL.getMeasuredWidth();
                this.LJIILLIIL.setLayoutParams(layoutParams);
                ObjectAnimator ofPropertyValuesHolder6 = ObjectAnimator.ofPropertyValuesHolder(this.LIZLLL, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.ALPHA, new Keyframe[]{Keyframe.ofFloat(0.0f, 1.0f), Keyframe.ofFloat(0.8f, 1.0f), Keyframe.ofFloat(1.0f, 0.0f)}), PropertyValuesHolder.ofKeyframe(this.LJIJ, new Keyframe[]{Keyframe.ofInt(0.0f, this.LIZLLL.getMeasuredWidth()), Keyframe.ofInt(1.0f, 0b0.LIZ(36.0f))})});
                ofPropertyValuesHolder6.setInterpolator(new DecelerateInterpolator());
                ofPropertyValuesHolder6.setDuration(1000);
                ofPropertyValuesHolder6.setStartDelay(2000);
                this.LJIIZILJ.playSequentially(new Animator[]{ofPropertyValuesHolder5, ofPropertyValuesHolder6});
                this.LJIIZILJ.addListener(new AnimatorListenerAdapter() {
                    static {
                        Covode.recordClassIndex(17401);
                    }

                    public final void onAnimationEnd(Animator animator) {
                        super.onAnimationEnd(animator);
                        LikeUserInfoAnimWidget.this.LIZLLL.setVisibility(8);
                    }

                    public final void onAnimationStart(Animator animator) {
                        super.onAnimationStart(animator);
                        LikeUserInfoAnimWidget.this.LIZLLL.setVisibility(0);
                    }
                });
                this.LJIIZILJ.start();
            } else if (i >= gYv.LIZJ()) {
                if (this.LJFF.isRunning()) {
                    this.LJFF.cancel();
                    ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_X, new Keyframe[]{Keyframe.ofFloat(0.0f, this.LIZ.getScaleX()), Keyframe.ofFloat(1.0f, 0.0f)})});
                    ofPropertyValuesHolder2 = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_Y, new Keyframe[]{Keyframe.ofFloat(0.0f, this.LIZ.getScaleY()), Keyframe.ofFloat(1.0f, 0.0f)})});
                } else {
                    ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_X, this.LJIIL)});
                    ofPropertyValuesHolder2 = ObjectAnimator.ofPropertyValuesHolder(this.LIZ, new PropertyValuesHolder[]{PropertyValuesHolder.ofKeyframe(View.SCALE_Y, this.LJIIL)});
                }
                this.LJIIJ.playTogether(new Animator[]{ofPropertyValuesHolder, ofPropertyValuesHolder2, this.LJIIJJI});
                this.LJIIJ.start();
            }
        }
    }

    public final void LIZ(C2272GYv gYv, int i, int i2, float f, float f2, float f3, float f4) {
        if (gYv.LJIIL()) {
            if (i2 >= gYv.LIZLLL()) {
                if (this.LJIIIZ != i) {
                    this.LJIIIZ = i;
                    if (this.LJFF.isRunning()) {
                        this.LIZIZ.setProgress(100);
                        this.LIZIZ.setAlpha(1.0f);
                        this.LJFF.cancel();
                    }
                    this.LJII.start();
                }
                this.LJI.start();
                if (!this.LIZJ.LIZIZ.LJI()) {
                    this.LIZJ.setVisibility(0);
                    if (i2 == gYv.LIZLLL()) {
                        0bQ.LIZIZ(this.LIZJ, "full_progress_bubbles_lottie.zip");
                    } else {
                        0bQ.LIZIZ(this.LIZJ, "like_after_full_progress_bubbles_lottie.zip");
                    }
                    this.LIZJ.LIZJ();
                }
                C3975H2i.LJFF++;
            } else if (i2 >= gYv.LIZJ()) {
                if (this.LJIIIIZZ != i) {
                    this.LJIIIIZZ = i;
                    this.LJFF.start();
                }
                this.LJI.start();
                this.LIZIZ.setProgress((int) ((100.0f / ((float) (gYv.LIZLLL() - gYv.LIZJ()))) * ((float) (i2 - gYv.LIZJ()))));
                C3975H2i.LJ++;
            }
        }
    }
}
