package d.r;

import android.animation.Animator;
import android.animation.TimeInterpolator;
import android.graphics.Path;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import d.h.j.y;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicInteger;

/* JADX INFO: loaded from: classes.dex */
public abstract class h implements Cloneable {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final int[] f3386f = {2, 1, 3, 4};

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final e f3387m = new a();

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static ThreadLocal<d.e.a<Animator, b>> f3388n = new ThreadLocal<>();
    public c G;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public ArrayList<p> f3399y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public ArrayList<p> f3400z;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public String f3389o = getClass().getName();

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public long f3390p = -1;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public long f3391q = -1;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public TimeInterpolator f3392r = null;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public ArrayList<Integer> f3393s = new ArrayList<>();

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public ArrayList<View> f3394t = new ArrayList<>();

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public q f3395u = new q();

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public q f3396v = new q();

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public n f3397w = null;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public int[] f3398x = f3386f;
    public ArrayList<Animator> A = new ArrayList<>();
    public int B = 0;
    public boolean C = false;
    public boolean D = false;
    public ArrayList<d> E = null;
    public ArrayList<Animator> F = new ArrayList<>();
    public e H = f3387m;

    public static class a extends e {
        @Override // d.r.e
        public Path a(float f2, float f3, float f4, float f5) {
            Path path = new Path();
            path.moveTo(f2, f3);
            path.lineTo(f4, f5);
            return path;
        }
    }

    public static class b {
        public View a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public String f3401b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public p f3402c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public c0 f3403d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public h f3404e;

        public b(View view, String str, h hVar, c0 c0Var, p pVar) {
            this.a = view;
            this.f3401b = str;
            this.f3402c = pVar;
            this.f3403d = c0Var;
            this.f3404e = hVar;
        }
    }

    public static abstract class c {
    }

    public interface d {
        void a(h hVar);

        void b(h hVar);

        void c(h hVar);

        void d(h hVar);

        void e(h hVar);
    }

    public static void d(q qVar, View view, p pVar) {
        qVar.a.put(view, pVar);
        int id = view.getId();
        if (id >= 0) {
            if (qVar.f3415b.indexOfKey(id) >= 0) {
                qVar.f3415b.put(id, null);
            } else {
                qVar.f3415b.put(id, view);
            }
        }
        AtomicInteger atomicInteger = d.h.j.y.a;
        String strK = y.h.k(view);
        if (strK != null) {
            if (qVar.f3417d.f(strK) >= 0) {
                qVar.f3417d.put(strK, null);
            } else {
                qVar.f3417d.put(strK, view);
            }
        }
        if (view.getParent() instanceof ListView) {
            ListView listView = (ListView) view.getParent();
            if (listView.getAdapter().hasStableIds()) {
                long itemIdAtPosition = listView.getItemIdAtPosition(listView.getPositionForView(view));
                d.e.e<View> eVar = qVar.f3416c;
                if (eVar.f2184m) {
                    eVar.d();
                }
                if (d.e.d.b(eVar.f2185n, eVar.f2187p, itemIdAtPosition) < 0) {
                    y.c.r(view, true);
                    qVar.f3416c.i(itemIdAtPosition, view);
                    return;
                }
                View viewF = qVar.f3416c.f(itemIdAtPosition);
                if (viewF != null) {
                    y.c.r(viewF, false);
                    qVar.f3416c.i(itemIdAtPosition, null);
                }
            }
        }
    }

    public static d.e.a<Animator, b> r() {
        d.e.a<Animator, b> aVar = f3388n.get();
        if (aVar != null) {
            return aVar;
        }
        d.e.a<Animator, b> aVar2 = new d.e.a<>();
        f3388n.set(aVar2);
        return aVar2;
    }

    public static boolean w(p pVar, p pVar2, String str) {
        Object obj = pVar.a.get(str);
        Object obj2 = pVar2.a.get(str);
        if (obj == null && obj2 == null) {
            return false;
        }
        if (obj == null || obj2 == null) {
            return true;
        }
        return true ^ obj.equals(obj2);
    }

    public void A(View view) {
        if (this.C) {
            if (!this.D) {
                d.e.a<Animator, b> aVarR = r();
                int i2 = aVarR.f2214r;
                y yVar = s.a;
                b0 b0Var = new b0(view);
                for (int i3 = i2 - 1; i3 >= 0; i3--) {
                    b bVarL = aVarR.l(i3);
                    if (bVarL.a != null && b0Var.equals(bVarL.f3403d)) {
                        aVarR.i(i3).resume();
                    }
                }
                ArrayList<d> arrayList = this.E;
                if (arrayList != null && arrayList.size() > 0) {
                    ArrayList arrayList2 = (ArrayList) this.E.clone();
                    int size = arrayList2.size();
                    for (int i4 = 0; i4 < size; i4++) {
                        ((d) arrayList2.get(i4)).e(this);
                    }
                }
            }
            this.C = false;
        }
    }

    public void B() {
        I();
        d.e.a<Animator, b> aVarR = r();
        for (Animator animator : this.F) {
            if (aVarR.containsKey(animator)) {
                I();
                if (animator != null) {
                    animator.addListener(new i(this, aVarR));
                    long j2 = this.f3391q;
                    if (j2 >= 0) {
                        animator.setDuration(j2);
                    }
                    long j3 = this.f3390p;
                    if (j3 >= 0) {
                        animator.setStartDelay(animator.getStartDelay() + j3);
                    }
                    TimeInterpolator timeInterpolator = this.f3392r;
                    if (timeInterpolator != null) {
                        animator.setInterpolator(timeInterpolator);
                    }
                    animator.addListener(new j(this));
                    animator.start();
                }
            }
        }
        this.F.clear();
        p();
    }

    public h C(long j2) {
        this.f3391q = j2;
        return this;
    }

    public void D(c cVar) {
        this.G = cVar;
    }

    public h E(TimeInterpolator timeInterpolator) {
        this.f3392r = timeInterpolator;
        return this;
    }

    public void F(e eVar) {
        if (eVar == null) {
            eVar = f3387m;
        }
        this.H = eVar;
    }

    public void G(m mVar) {
    }

    public h H(long j2) {
        this.f3390p = j2;
        return this;
    }

    public void I() {
        if (this.B == 0) {
            ArrayList<d> arrayList = this.E;
            if (arrayList != null && arrayList.size() > 0) {
                ArrayList arrayList2 = (ArrayList) this.E.clone();
                int size = arrayList2.size();
                for (int i2 = 0; i2 < size; i2++) {
                    ((d) arrayList2.get(i2)).a(this);
                }
            }
            this.D = false;
        }
        this.B++;
    }

    public String J(String str) {
        StringBuilder sbF = g.a.a.a.a.F(str);
        sbF.append(getClass().getSimpleName());
        sbF.append("@");
        sbF.append(Integer.toHexString(hashCode()));
        sbF.append(": ");
        String string = sbF.toString();
        if (this.f3391q != -1) {
            StringBuilder sbJ = g.a.a.a.a.J(string, "dur(");
            sbJ.append(this.f3391q);
            sbJ.append(") ");
            string = sbJ.toString();
        }
        if (this.f3390p != -1) {
            StringBuilder sbJ2 = g.a.a.a.a.J(string, "dly(");
            sbJ2.append(this.f3390p);
            sbJ2.append(") ");
            string = sbJ2.toString();
        }
        if (this.f3392r != null) {
            StringBuilder sbJ3 = g.a.a.a.a.J(string, "interp(");
            sbJ3.append(this.f3392r);
            sbJ3.append(") ");
            string = sbJ3.toString();
        }
        if (this.f3393s.size() <= 0 && this.f3394t.size() <= 0) {
            return string;
        }
        String strT = g.a.a.a.a.t(string, "tgts(");
        if (this.f3393s.size() > 0) {
            for (int i2 = 0; i2 < this.f3393s.size(); i2++) {
                if (i2 > 0) {
                    strT = g.a.a.a.a.t(strT, ", ");
                }
                StringBuilder sbF2 = g.a.a.a.a.F(strT);
                sbF2.append(this.f3393s.get(i2));
                strT = sbF2.toString();
            }
        }
        if (this.f3394t.size() > 0) {
            for (int i3 = 0; i3 < this.f3394t.size(); i3++) {
                if (i3 > 0) {
                    strT = g.a.a.a.a.t(strT, ", ");
                }
                StringBuilder sbF3 = g.a.a.a.a.F(strT);
                sbF3.append(this.f3394t.get(i3));
                strT = sbF3.toString();
            }
        }
        return g.a.a.a.a.t(strT, ")");
    }

    public h b(d dVar) {
        if (this.E == null) {
            this.E = new ArrayList<>();
        }
        this.E.add(dVar);
        return this;
    }

    public h c(View view) {
        this.f3394t.add(view);
        return this;
    }

    public abstract void f(p pVar);

    public final void g(View view, boolean z2) {
        if (view == null) {
            return;
        }
        view.getId();
        if (view.getParent() instanceof ViewGroup) {
            p pVar = new p(view);
            if (z2) {
                j(pVar);
            } else {
                f(pVar);
            }
            pVar.f3414c.add(this);
            i(pVar);
            d(z2 ? this.f3395u : this.f3396v, view, pVar);
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
                g(viewGroup.getChildAt(i2), z2);
            }
        }
    }

    public void i(p pVar) {
    }

    public abstract void j(p pVar);

    public void k(ViewGroup viewGroup, boolean z2) {
        l(z2);
        if (this.f3393s.size() <= 0 && this.f3394t.size() <= 0) {
            g(viewGroup, z2);
            return;
        }
        for (int i2 = 0; i2 < this.f3393s.size(); i2++) {
            View viewFindViewById = viewGroup.findViewById(this.f3393s.get(i2).intValue());
            if (viewFindViewById != null) {
                p pVar = new p(viewFindViewById);
                if (z2) {
                    j(pVar);
                } else {
                    f(pVar);
                }
                pVar.f3414c.add(this);
                i(pVar);
                d(z2 ? this.f3395u : this.f3396v, viewFindViewById, pVar);
            }
        }
        for (int i3 = 0; i3 < this.f3394t.size(); i3++) {
            View view = this.f3394t.get(i3);
            p pVar2 = new p(view);
            if (z2) {
                j(pVar2);
            } else {
                f(pVar2);
            }
            pVar2.f3414c.add(this);
            i(pVar2);
            d(z2 ? this.f3395u : this.f3396v, view, pVar2);
        }
    }

    public void l(boolean z2) {
        q qVar;
        if (z2) {
            this.f3395u.a.clear();
            this.f3395u.f3415b.clear();
            qVar = this.f3395u;
        } else {
            this.f3396v.a.clear();
            this.f3396v.f3415b.clear();
            qVar = this.f3396v;
        }
        qVar.f3416c.b();
    }

    @Override // 
    /* JADX INFO: renamed from: m, reason: merged with bridge method [inline-methods] */
    public h clone() {
        try {
            h hVar = (h) super.clone();
            hVar.F = new ArrayList<>();
            hVar.f3395u = new q();
            hVar.f3396v = new q();
            hVar.f3399y = null;
            hVar.f3400z = null;
            return hVar;
        } catch (CloneNotSupportedException unused) {
            return null;
        }
    }

    public Animator n(ViewGroup viewGroup, p pVar, p pVar2) {
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0043  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void o(android.view.ViewGroup r20, d.r.q r21, d.r.q r22, java.util.ArrayList<d.r.p> r23, java.util.ArrayList<d.r.p> r24) {
        /*
            Method dump skipped, instruction units count: 315
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.r.h.o(android.view.ViewGroup, d.r.q, d.r.q, java.util.ArrayList, java.util.ArrayList):void");
    }

    public void p() {
        int i2 = this.B - 1;
        this.B = i2;
        if (i2 == 0) {
            ArrayList<d> arrayList = this.E;
            if (arrayList != null && arrayList.size() > 0) {
                ArrayList arrayList2 = (ArrayList) this.E.clone();
                int size = arrayList2.size();
                for (int i3 = 0; i3 < size; i3++) {
                    ((d) arrayList2.get(i3)).c(this);
                }
            }
            for (int i4 = 0; i4 < this.f3395u.f3416c.j(); i4++) {
                View viewK = this.f3395u.f3416c.k(i4);
                if (viewK != null) {
                    AtomicInteger atomicInteger = d.h.j.y.a;
                    y.c.r(viewK, false);
                }
            }
            for (int i5 = 0; i5 < this.f3396v.f3416c.j(); i5++) {
                View viewK2 = this.f3396v.f3416c.k(i5);
                if (viewK2 != null) {
                    AtomicInteger atomicInteger2 = d.h.j.y.a;
                    y.c.r(viewK2, false);
                }
            }
            this.D = true;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:21:0x002e, code lost:
    
        if (r3 < 0) goto L30;
     */
    /* JADX WARN: Code restructure failed: missing block: B:22:0x0030, code lost:
    
        if (r8 == false) goto L24;
     */
    /* JADX WARN: Code restructure failed: missing block: B:23:0x0032, code lost:
    
        r7 = r6.f3400z;
     */
    /* JADX WARN: Code restructure failed: missing block: B:24:0x0035, code lost:
    
        r7 = r6.f3399y;
     */
    /* JADX WARN: Code restructure failed: missing block: B:26:0x003e, code lost:
    
        return r7.get(r3);
     */
    /* JADX WARN: Code restructure failed: missing block: B:30:?, code lost:
    
        return null;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public d.r.p q(android.view.View r7, boolean r8) {
        /*
            r6 = this;
            d.r.n r0 = r6.f3397w
            if (r0 == 0) goto L9
            d.r.p r7 = r0.q(r7, r8)
            return r7
        L9:
            if (r8 == 0) goto Le
            java.util.ArrayList<d.r.p> r0 = r6.f3399y
            goto L10
        Le:
            java.util.ArrayList<d.r.p> r0 = r6.f3400z
        L10:
            r1 = 0
            if (r0 != 0) goto L14
            return r1
        L14:
            int r2 = r0.size()
            r3 = -1
            r4 = 0
        L1a:
            if (r4 >= r2) goto L2e
            java.lang.Object r5 = r0.get(r4)
            d.r.p r5 = (d.r.p) r5
            if (r5 != 0) goto L25
            return r1
        L25:
            android.view.View r5 = r5.f3413b
            if (r5 != r7) goto L2b
            r3 = r4
            goto L2e
        L2b:
            int r4 = r4 + 1
            goto L1a
        L2e:
            if (r3 < 0) goto L3e
            if (r8 == 0) goto L35
            java.util.ArrayList<d.r.p> r7 = r6.f3400z
            goto L37
        L35:
            java.util.ArrayList<d.r.p> r7 = r6.f3399y
        L37:
            java.lang.Object r7 = r7.get(r3)
            r1 = r7
            d.r.p r1 = (d.r.p) r1
        L3e:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: d.r.h.q(android.view.View, boolean):d.r.p");
    }

    public String[] s() {
        return null;
    }

    public p t(View view, boolean z2) {
        n nVar = this.f3397w;
        if (nVar != null) {
            return nVar.t(view, z2);
        }
        return (z2 ? this.f3395u : this.f3396v).a.getOrDefault(view, null);
    }

    public String toString() {
        return J("");
    }

    public boolean u(p pVar, p pVar2) {
        if (pVar == null || pVar2 == null) {
            return false;
        }
        String[] strArrS = s();
        if (strArrS == null) {
            Iterator<String> it = pVar.a.keySet().iterator();
            while (it.hasNext()) {
                if (w(pVar, pVar2, it.next())) {
                }
            }
            return false;
        }
        for (String str : strArrS) {
            if (!w(pVar, pVar2, str)) {
            }
        }
        return false;
        return true;
    }

    public boolean v(View view) {
        return (this.f3393s.size() == 0 && this.f3394t.size() == 0) || this.f3393s.contains(Integer.valueOf(view.getId())) || this.f3394t.contains(view);
    }

    public void x(View view) {
        if (this.D) {
            return;
        }
        d.e.a<Animator, b> aVarR = r();
        int i2 = aVarR.f2214r;
        y yVar = s.a;
        b0 b0Var = new b0(view);
        for (int i3 = i2 - 1; i3 >= 0; i3--) {
            b bVarL = aVarR.l(i3);
            if (bVarL.a != null && b0Var.equals(bVarL.f3403d)) {
                aVarR.i(i3).pause();
            }
        }
        ArrayList<d> arrayList = this.E;
        if (arrayList != null && arrayList.size() > 0) {
            ArrayList arrayList2 = (ArrayList) this.E.clone();
            int size = arrayList2.size();
            for (int i4 = 0; i4 < size; i4++) {
                ((d) arrayList2.get(i4)).b(this);
            }
        }
        this.C = true;
    }

    public h y(d dVar) {
        ArrayList<d> arrayList = this.E;
        if (arrayList == null) {
            return this;
        }
        arrayList.remove(dVar);
        if (this.E.size() == 0) {
            this.E = null;
        }
        return this;
    }

    public h z(View view) {
        this.f3394t.remove(view);
        return this;
    }
}
