package com.ss.android.ugc.aweme.feed.widget;

import X.C5383TBb;
import X.HeD;
import X.Ijl;
import X.M12;
import X.QjQ;
import X.TBT;
import X.TBW;
import X.TBZ;
import android.animation.ValueAnimator;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;

public class PeriscopeLayout$1 implements Runnable {
    public final /* synthetic */ TBW LIZ;

    static {
        Covode.recordClassIndex(80034);
    }

    public final void run() {
        ImageView poll;
        float LIZIZ;
        float f;
        MethodCollector.i(6448);
        TBW tbw = this.LIZ;
        if (tbw.LJFF.isEmpty()) {
            poll = new ImageView(tbw.getContext());
            poll.setLayoutParams(tbw.LIZJ);
            tbw.addView(poll);
        } else {
            poll = tbw.LJFF.poll();
        }
        Drawable[] drawableArr = tbw.LIZLLL;
        int i = tbw.LJIILIIL;
        tbw.LJIILIIL = i + 1;
        poll.setImageDrawable(drawableArr[i & 1]);
        if (tbw.LJIJI == -1.0f) {
            tbw.LJIJI = tbw.LJIILL;
            float f2 = tbw.LJIILLIIL;
            tbw.LJIJJ = tbw.LJIILLIIL;
            if (tbw.LJIIL) {
                tbw.LJIJI = (((float) tbw.LIZIZ) - tbw.LJIJI) - tbw.LJIJJ;
                f2 = (((float) tbw.LIZIZ) - f2) - tbw.LJIJJ;
            }
            tbw.LJIJJLI = new PointF(tbw.LJIJI, ((float) (tbw.LIZ - tbw.LJI)) - tbw.LJIIZILJ);
            tbw.LJIL = new PointF(f2, tbw.LJIILJJIL);
            if (tbw.LJIIL) {
                f = ((float) tbw.LJII) - tbw.LJIJJ;
            } else {
                f = (float) (tbw.LIZIZ - tbw.LJII);
            }
            tbw.LJJ = new PointF(f, ((float) (tbw.LIZ - tbw.LJI)) - tbw.LJIJ);
        }
        QjQ qjQ = new QjQ(tbw.LJIJJLI, tbw.LJIL);
        Object[] objArr = new Object[2];
        objArr[0] = tbw.LJJ;
        if (tbw.LJIIL) {
            LIZIZ = (((float) tbw.LIZIZ) - tbw.LJIJJ) - HeD.LIZIZ(tbw.getContext(), (float) (tbw.LJ.nextInt(30) + 12));
        } else {
            LIZIZ = HeD.LIZIZ(tbw.getContext(), (float) (tbw.LJ.nextInt(30) + 12));
        }
        objArr[1] = new PointF(LIZIZ, 0.0f);
        ValueAnimator ofObject = ValueAnimator.ofObject(qjQ, objArr);
        TBT tbt = new TBT(tbw, poll);
        ofObject.addUpdateListener(tbt);
        ofObject.setTarget(poll);
        poll.setTag(2131371012, tbt);
        ofObject.setDuration((long) tbw.LJIIIZ);
        poll.setTag(ofObject);
        int i2 = C5383TBb.LIZIZ;
        M12.LIZ(ofObject, poll);
        if (i2 == C5383TBb.LIZIZ && !Ijl.LIZIZ()) {
            poll.setVisibility(8);
        } else if (TBZ.LIZ.LIZ(i2)) {
            ofObject.start();
        }
        if (this.LIZ.LJIIJ != null) {
            this.LIZ.LJIIJ.postDelayed(this, (long) this.LIZ.LJIIIIZZ);
        }
        MethodCollector.o(6448);
    }

    public PeriscopeLayout$1(TBW tbw) {
        this.LIZ = tbw;
    }
}
