package p052r; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import p040n.C1482d; import p049q.C1545b; import p049q.C1547d; import p049q.C1550e; import p049q.C1553f; /* renamed from: r.o */ /* loaded from: classes.dex */ public class C1589o { /* renamed from: g */ public static int f3700g; /* renamed from: b */ public int f3702b; /* renamed from: d */ public int f3704d; /* renamed from: a */ public ArrayList f3701a = new ArrayList<>(); /* renamed from: c */ public boolean f3703c = false; /* renamed from: e */ public ArrayList f3705e = null; /* renamed from: f */ public int f3706f = -1; /* renamed from: r.o$a */ /* loaded from: classes.dex */ public class C1590a { /* renamed from: a */ public WeakReference f3707a; /* renamed from: b */ public int f3708b; /* renamed from: c */ public int f3709c; /* renamed from: d */ public int f3710d; /* renamed from: e */ public int f3711e; /* renamed from: f */ public int f3712f; /* renamed from: g */ public int f3713g; public C1590a(C1550e c1550e, C1482d c1482d, int i) { this.f3707a = new WeakReference<>(c1550e); this.f3708b = c1482d.m1216x(c1550e.f3503O); this.f3709c = c1482d.m1216x(c1550e.f3504P); this.f3710d = c1482d.m1216x(c1550e.f3505Q); this.f3711e = c1482d.m1216x(c1550e.f3506R); this.f3712f = c1482d.m1216x(c1550e.f3507S); this.f3713g = i; } } public C1589o(int i) { int i2 = f3700g; f3700g = i2 + 1; this.f3702b = i2; this.f3704d = i; } /* renamed from: a */ public boolean m834a(C1550e c1550e) { if (this.f3701a.contains(c1550e)) { return false; } this.f3701a.add(c1550e); return true; } /* renamed from: b */ public void m833b(ArrayList arrayList) { int size = this.f3701a.size(); if (this.f3706f != -1 && size > 0) { for (int i = 0; i < arrayList.size(); i++) { C1589o c1589o = arrayList.get(i); if (this.f3706f == c1589o.f3702b) { m828g(this.f3704d, c1589o); } } } if (size == 0) { arrayList.remove(this); } } /* renamed from: c */ public int m832c() { return this.f3702b; } /* renamed from: d */ public int m831d() { return this.f3704d; } /* renamed from: e */ public final String m830e() { int i = this.f3704d; return i == 0 ? "Horizontal" : i == 1 ? "Vertical" : i == 2 ? "Both" : "Unknown"; } /* renamed from: f */ public int m829f(C1482d c1482d, int i) { if (this.f3701a.size() == 0) { return 0; } return m825j(c1482d, this.f3701a, i); } /* renamed from: g */ public void m828g(int i, C1589o c1589o) { Iterator it = this.f3701a.iterator(); while (it.hasNext()) { C1550e next = it.next(); c1589o.m834a(next); int m832c = c1589o.m832c(); if (i == 0) { next.f3496I0 = m832c; } else { next.f3498J0 = m832c; } } this.f3706f = c1589o.f3702b; } /* renamed from: h */ public void m827h(boolean z) { this.f3703c = z; } /* renamed from: i */ public void m826i(int i) { this.f3704d = i; } /* renamed from: j */ public final int m825j(C1482d c1482d, ArrayList arrayList, int i) { int m1216x; C1547d c1547d; C1553f c1553f = (C1553f) arrayList.get(0).m1038I(); c1482d.m1240D(); c1553f.mo916g(c1482d, false); for (int i2 = 0; i2 < arrayList.size(); i2++) { arrayList.get(i2).mo916g(c1482d, false); } if (i == 0 && c1553f.f3584W0 > 0) { C1545b.m1077b(c1553f, c1482d, arrayList, 0); } if (i == 1 && c1553f.f3585X0 > 0) { C1545b.m1077b(c1553f, c1482d, arrayList, 1); } try { c1482d.m1214z(); } catch (Exception e) { e.printStackTrace(); } this.f3705e = new ArrayList<>(); for (int i3 = 0; i3 < arrayList.size(); i3++) { this.f3705e.add(new C1590a(arrayList.get(i3), c1482d, i)); } if (i == 0) { m1216x = c1482d.m1216x(c1553f.f3503O); c1547d = c1553f.f3505Q; } else { m1216x = c1482d.m1216x(c1553f.f3504P); c1547d = c1553f.f3506R; } int m1216x2 = c1482d.m1216x(c1547d); c1482d.m1240D(); return m1216x2 - m1216x; } public String toString() { Iterator it; String str = m830e() + " [" + this.f3702b + "] <"; while (this.f3701a.iterator().hasNext()) { str = str + " " + it.next().m965r(); } return str + " >"; } }