package ඓ.㴹.K;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.AndroidRuntimeException;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import ඓ.K.K.K.C1293;
import ඓ.㴹.K.AbstractC1354;

/* renamed from: ඓ.㴹.K.Ԕ  reason: contains not printable characters */
/* compiled from: ValueAnimator */
public class C1327 extends AbstractC1354 {

    /* renamed from: Ԛ  reason: contains not printable characters */
    public static final ThreadLocal<ArrayList<C1327>> f5146 = new C1332();

    /* renamed from: ᑓ  reason: contains not printable characters */
    public static final ThreadLocal<ArrayList<C1327>> f5147 = new C1329();

    /* renamed from: ᓆ  reason: contains not printable characters */
    public static final ThreadLocal<ArrayList<C1327>> f5148 = new C1328();

    /* renamed from: ゎ  reason: contains not printable characters */
    public static final Interpolator f5149 = new AccelerateDecelerateInterpolator();

    /* renamed from: ト  reason: contains not printable characters */
    public static long f5150 = 10;

    /* renamed from: 㴪  reason: contains not printable characters */
    public static final ThreadLocal<ArrayList<C1327>> f5151 = new C1334();

    /* renamed from: 㶋  reason: contains not printable characters */
    public static final ThreadLocal<ArrayList<C1327>> f5152 = new C1330();

    /* renamed from: 䀟  reason: contains not printable characters */
    public static ThreadLocal<HandlerC1333> f5153 = new ThreadLocal<>();

    /* renamed from: ʬ  reason: contains not printable characters */
    public long f5154;

    /* renamed from: Ԕ  reason: contains not printable characters */
    public int f5155 = 0;

    /* renamed from: ؿ  reason: contains not printable characters */
    public Interpolator f5156 = f5149;

    /* renamed from: ݜ  reason: contains not printable characters */
    public HashMap<String, C1356> f5157;

    /* renamed from: ඓ  reason: contains not printable characters */
    public boolean f5158 = false;

    /* renamed from: ᓣ  reason: contains not printable characters */
    public ArrayList<AbstractC1331> f5159 = null;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public boolean f5160 = false;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public int f5161 = 0;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public boolean f5162 = false;

    /* renamed from: 㑃  reason: contains not printable characters */
    public long f5163 = 300;

    /* renamed from: 㗗  reason: contains not printable characters */
    public int f5164 = 1;

    /* renamed from: 㗽  reason: contains not printable characters */
    public C1356[] f5165;

    /* renamed from: 㳳  reason: contains not printable characters */
    public boolean f5166 = false;

    /* renamed from: 㴹  reason: contains not printable characters */
    public int f5167 = 0;

    /* renamed from: 㸾  reason: contains not printable characters */
    public long f5168 = -1;

    /* renamed from: 㿎  reason: contains not printable characters */
    public long f5169;

    /* renamed from: 䁗  reason: contains not printable characters */
    public long f5170 = 0;

    /* renamed from: ඓ.㴹.K.Ԕ$ʬ  reason: contains not printable characters */
    /* compiled from: ValueAnimator */
    public static class C1328 extends ThreadLocal<ArrayList<C1327>> {
        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // java.lang.ThreadLocal
        public ArrayList<C1327> initialValue() {
            return new ArrayList();
        }
    }

    /* renamed from: ඓ.㴹.K.Ԕ$ඓ  reason: contains not printable characters */
    /* compiled from: ValueAnimator */
    public static class C1329 extends ThreadLocal<ArrayList<C1327>> {
        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // java.lang.ThreadLocal
        public ArrayList<C1327> initialValue() {
            return new ArrayList();
        }
    }

    /* renamed from: ඓ.㴹.K.Ԕ$ῲ  reason: contains not printable characters */
    /* compiled from: ValueAnimator */
    public static class C1330 extends ThreadLocal<ArrayList<C1327>> {
        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // java.lang.ThreadLocal
        public ArrayList<C1327> initialValue() {
            return new ArrayList();
        }
    }

    /* renamed from: ඓ.㴹.K.Ԕ$ⁱ  reason: contains not printable characters */
    /* compiled from: ValueAnimator */
    public interface AbstractC1331 {
        /* renamed from: K  reason: contains not printable characters */
        void m3483(C1327 v);
    }

    /* renamed from: ඓ.㴹.K.Ԕ$K  reason: contains not printable characters */
    /* compiled from: ValueAnimator */
    public static class C1332 extends ThreadLocal<ArrayList<C1327>> {
        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // java.lang.ThreadLocal
        public ArrayList<C1327> initialValue() {
            return new ArrayList();
        }
    }

    /* renamed from: ඓ.㴹.K.Ԕ$㴹  reason: contains not printable characters */
    /* compiled from: ValueAnimator */
    public static class HandlerC1333 extends Handler {
        public HandlerC1333() {
        }

        /* JADX WARNING: Removed duplicated region for block: B:22:0x0081  */
        /* JADX WARNING: Removed duplicated region for block: B:30:0x00a6  */
        /* JADX WARNING: Removed duplicated region for block: B:34:0x00b4  */
        /* JADX WARNING: Removed duplicated region for block: B:40:0x00d3  */
        /* JADX WARNING: Removed duplicated region for block: B:49:0x00f7 A[LOOP:5: B:49:0x00f7->B:51:0x00fd, LOOP_START, PHI: r5 
          PHI: (r5v1 int) = (r5v0 int), (r5v2 int) binds: [B:48:0x00f5, B:51:0x00fd] A[DONT_GENERATE, DONT_INLINE]] */
        /* JADX WARNING: Removed duplicated region for block: B:65:0x00a9 A[SYNTHETIC] */
        public void handleMessage(Message message) {
            boolean z;
            long currentAnimationTimeMillis;
            ArrayList<C1327> arrayList;
            int size;
            int i;
            int size2;
            int size3;
            int i2;
            boolean z2;
            ArrayList<C1327> arrayList2 = C1327.f5146.get();
            ArrayList<C1327> arrayList3 = C1327.f5148.get();
            int i3 = message.what;
            if (i3 == 0) {
                ArrayList<C1327> arrayList4 = C1327.f5152.get();
                z = arrayList2.size() <= 0 && arrayList3.size() <= 0;
                while (arrayList4.size() > 0) {
                    ArrayList arrayList5 = (ArrayList) arrayList4.clone();
                    arrayList4.clear();
                    int size4 = arrayList5.size();
                    for (int i4 = 0; i4 < size4; i4++) {
                        C1327 r11 = (C1327) arrayList5.get(i4);
                        if (r11.f5170 == 0) {
                            C1327.m3471(r11);
                        } else {
                            arrayList3.add(r11);
                        }
                    }
                }
                currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
                ArrayList<C1327> arrayList6 = C1327.f5147.get();
                arrayList = C1327.f5151.get();
                size = arrayList3.size();
                while (i < size) {
                }
                size2 = arrayList6.size();
                if (size2 > 0) {
                }
                size3 = arrayList2.size();
                i2 = 0;
                while (i2 < size3) {
                }
                if (arrayList.size() > 0) {
                }
                sendEmptyMessageDelayed(1, Math.max(0L, C1327.f5150 - (AnimationUtils.currentAnimationTimeMillis() - currentAnimationTimeMillis)));
            } else if (i3 == 1) {
                z = true;
                currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
                ArrayList<C1327> arrayList62 = C1327.f5147.get();
                arrayList = C1327.f5151.get();
                size = arrayList3.size();
                for (i = 0; i < size; i++) {
                    C1327 r13 = arrayList3.get(i);
                    if (!r13.f5162) {
                        r13.f5162 = true;
                        r13.f5169 = currentAnimationTimeMillis;
                    } else {
                        long j = currentAnimationTimeMillis - r13.f5169;
                        long j2 = r13.f5170;
                        if (j > j2) {
                            r13.f5154 = currentAnimationTimeMillis - (j - j2);
                            r13.f5161 = 1;
                            z2 = true;
                            if (!z2) {
                                arrayList62.add(r13);
                            }
                        }
                    }
                    z2 = false;
                    if (!z2) {
                    }
                }
                size2 = arrayList62.size();
                if (size2 > 0) {
                    for (int i5 = 0; i5 < size2; i5++) {
                        C1327 r112 = arrayList62.get(i5);
                        C1327.m3471(r112);
                        r112.f5166 = true;
                        arrayList3.remove(r112);
                    }
                    arrayList62.clear();
                }
                size3 = arrayList2.size();
                i2 = 0;
                while (i2 < size3) {
                    C1327 r4 = arrayList2.get(i2);
                    if (r4.m3474(currentAnimationTimeMillis)) {
                        arrayList.add(r4);
                    }
                    if (arrayList2.size() == size3) {
                        i2++;
                    } else {
                        size3--;
                        arrayList.remove(r4);
                    }
                }
                if (arrayList.size() > 0) {
                    for (int i6 = 0; i6 < arrayList.size(); i6++) {
                        arrayList.get(i6).m3472();
                    }
                    arrayList.clear();
                }
                if (z && (!arrayList2.isEmpty() || !arrayList3.isEmpty())) {
                    sendEmptyMessageDelayed(1, Math.max(0L, C1327.f5150 - (AnimationUtils.currentAnimationTimeMillis() - currentAnimationTimeMillis)));
                }
            }
        }

        public /* synthetic */ HandlerC1333(C1332 k) {
        }
    }

    /* renamed from: ඓ.㴹.K.Ԕ$㸾  reason: contains not printable characters */
    /* compiled from: ValueAnimator */
    public static class C1334 extends ThreadLocal<ArrayList<C1327>> {
        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // java.lang.ThreadLocal
        public ArrayList<C1327> initialValue() {
            return new ArrayList();
        }
    }

    @Override // ඓ.㴹.K.AbstractC1354
    public void cancel() {
        ArrayList<AbstractC1354.AbstractC1355> arrayList;
        if (this.f5161 != 0 || f5152.get().contains(this) || f5148.get().contains(this)) {
            if (this.f5166 && (arrayList = this.f5190) != null) {
                Iterator it2 = ((ArrayList) arrayList.clone()).iterator();
                while (it2.hasNext()) {
                    ((AbstractC1354.AbstractC1355) it2.next()).m3521(this);
                }
            }
            m3472();
        }
    }

    public String toString() {
        StringBuilder r0 = C1293.m3416("ValueAnimator@");
        r0.append(Integer.toHexString(hashCode()));
        String sb = r0.toString();
        if (this.f5165 != null) {
            for (int i = 0; i < this.f5165.length; i++) {
                StringBuilder r02 = C1293.m3402(sb, "\n    ");
                r02.append(this.f5165[i].toString());
                sb = r02.toString();
            }
        }
        return sb;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public final void m3472() {
        ArrayList<AbstractC1354.AbstractC1355> arrayList;
        f5146.get().remove(this);
        f5152.get().remove(this);
        f5148.get().remove(this);
        this.f5161 = 0;
        if (this.f5166 && (arrayList = this.f5190) != null) {
            ArrayList arrayList2 = (ArrayList) arrayList.clone();
            int size = arrayList2.size();
            for (int i = 0; i < size; i++) {
                ((AbstractC1354.AbstractC1355) arrayList2.get(i)).m3520(this);
            }
        }
        this.f5166 = false;
    }

    @Override // ඓ.㴹.K.AbstractC1354
    /* renamed from: ῲ  reason: contains not printable characters */
    public void m3473() {
        if (Looper.myLooper() != null) {
            this.f5158 = false;
            this.f5167 = 0;
            this.f5161 = 0;
            this.f5162 = false;
            f5152.get().add(this);
            long j = 0;
            if (this.f5170 == 0) {
                if (this.f5160 && this.f5161 != 0) {
                    j = AnimationUtils.currentAnimationTimeMillis() - this.f5154;
                }
                m3482();
                long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
                if (this.f5161 != 1) {
                    this.f5168 = j;
                    this.f5161 = 2;
                }
                this.f5154 = currentAnimationTimeMillis - j;
                m3474(currentAnimationTimeMillis);
                this.f5161 = 0;
                this.f5166 = true;
                ArrayList<AbstractC1354.AbstractC1355> arrayList = this.f5190;
                if (arrayList != null) {
                    ArrayList arrayList2 = (ArrayList) arrayList.clone();
                    int size = arrayList2.size();
                    for (int i = 0; i < size; i++) {
                        ((AbstractC1354.AbstractC1355) arrayList2.get(i)).m3518(this);
                    }
                }
            }
            HandlerC1333 r1 = f5153.get();
            if (r1 == null) {
                r1 = new HandlerC1333(null);
                f5153.set(r1);
            }
            r1.sendEmptyMessage(0);
            return;
        }
        throw new AndroidRuntimeException("Animators may only be run on Looper threads");
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public void m3482() {
        if (!this.f5160) {
            int length = this.f5165.length;
            for (int i = 0; i < length; i++) {
                C1356 r2 = this.f5165[i];
                if (r2.f5204 == null) {
                    Class cls = r2.f5205;
                    r2.f5204 = cls == Integer.class ? C1356.f5194 : cls == Float.class ? C1356.f5197 : null;
                }
                AbstractC1364 r3 = r2.f5204;
                if (r3 != null) {
                    r2.f5203.f5186 = r3;
                }
            }
            this.f5160 = true;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3479(float... fArr) {
        if (fArr != null && fArr.length != 0) {
            C1356[] r0 = this.f5165;
            if (r0 == null || r0.length == 0) {
                m3480(C1356.m3522("", fArr));
            } else {
                r0[0].m3530(fArr);
            }
            this.f5160 = false;
        }
    }

    @Override // ඓ.㴹.K.AbstractC1354, ඓ.㴹.K.AbstractC1354, java.lang.Object
    public C1327 clone() {
        C1327 r0 = (C1327) super.clone();
        ArrayList<AbstractC1331> arrayList = this.f5159;
        if (arrayList != null) {
            r0.f5159 = new ArrayList<>();
            int size = arrayList.size();
            for (int i = 0; i < size; i++) {
                r0.f5159.add(arrayList.get(i));
            }
        }
        r0.f5168 = -1;
        r0.f5158 = false;
        r0.f5167 = 0;
        r0.f5160 = false;
        r0.f5161 = 0;
        r0.f5162 = false;
        C1356[] r1 = this.f5165;
        if (r1 != null) {
            int length = r1.length;
            r0.f5165 = new C1356[length];
            r0.f5157 = new HashMap<>(length);
            for (int i2 = 0; i2 < length; i2++) {
                C1356 clone = r1[i2].clone();
                r0.f5165[i2] = clone;
                r0.f5157.put(clone.f5202, clone);
            }
        }
        return r0;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3480(C1356... r7) {
        int length = r7.length;
        this.f5165 = r7;
        this.f5157 = new HashMap<>(length);
        for (C1356 r3 : r7) {
            this.f5157.put(r3.f5202, r3);
        }
        this.f5160 = false;
    }

    @Override // ඓ.㴹.K.AbstractC1354
    /* renamed from: K  reason: contains not printable characters */
    public C1327 m3476(long j) {
        if (j >= 0) {
            this.f5163 = j;
            return this;
        }
        throw new IllegalArgumentException(C1293.m3409("Animators cannot have negative duration: ", j));
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3478(Interpolator interpolator) {
        if (interpolator != null) {
            this.f5156 = interpolator;
        } else {
            this.f5156 = new LinearInterpolator();
        }
    }

    @Override // ඓ.㴹.K.AbstractC1354
    /* renamed from: K  reason: contains not printable characters */
    public boolean m3481() {
        return this.f5161 == 1 || this.f5166;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static /* synthetic */ void m3471(C1327 r5) {
        ArrayList<AbstractC1354.AbstractC1355> arrayList;
        r5.m3482();
        f5146.get().add(r5);
        if (r5.f5170 > 0 && (arrayList = r5.f5190) != null) {
            ArrayList arrayList2 = (ArrayList) arrayList.clone();
            int size = arrayList2.size();
            for (int i = 0; i < size; i++) {
                ((AbstractC1354.AbstractC1355) arrayList2.get(i)).m3518(r5);
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3477(float f) {
        float interpolation = this.f5156.getInterpolation(f);
        int length = this.f5165.length;
        for (int i = 0; i < length; i++) {
            this.f5165[i].m3527(interpolation);
        }
        ArrayList<AbstractC1331> arrayList = this.f5159;
        if (arrayList != null) {
            int size = arrayList.size();
            for (int i2 = 0; i2 < size; i2++) {
                this.f5159.get(i2).m3483(this);
            }
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public boolean m3474(long j) {
        if (this.f5161 == 0) {
            this.f5161 = 1;
            long j2 = this.f5168;
            if (j2 < 0) {
                this.f5154 = j;
            } else {
                this.f5154 = j - j2;
                this.f5168 = -1;
            }
        }
        int i = this.f5161;
        boolean z = false;
        if (i == 1 || i == 2) {
            long j3 = this.f5163;
            float f = j3 > 0 ? ((float) (j - this.f5154)) / ((float) j3) : 1.0f;
            if (f >= 1.0f) {
                int i2 = this.f5167;
                int i3 = this.f5155;
                if (i2 < i3 || i3 == -1) {
                    ArrayList<AbstractC1354.AbstractC1355> arrayList = this.f5190;
                    if (arrayList != null) {
                        int size = arrayList.size();
                        for (int i4 = 0; i4 < size; i4++) {
                            this.f5190.get(i4).m3519(this);
                        }
                    }
                    if (this.f5164 == 2) {
                        this.f5158 = !this.f5158;
                    }
                    this.f5167 += (int) f;
                    f %= 1.0f;
                    this.f5154 += this.f5163;
                } else {
                    f = Math.min(f, 1.0f);
                    z = true;
                }
            }
            if (this.f5158) {
                f = 1.0f - f;
            }
            m3477(f);
        }
        return z;
    }
}
