package o; import android.content.Context; import android.content.res.TypedArray; import android.util.SparseArray; import android.util.Xml; import java.io.IOException; import java.util.ArrayList; import o.C3345avm; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /* renamed from: o.gqk, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C15442gqk { private int f; private int d = -1; private int c = -1; public SparseArray b = new SparseArray<>(); private SparseArray a = new SparseArray<>(); private AtR e = null; public C15442gqk(Context context, XmlPullParser xmlPullParser) { this.f = -1; IeS ieS = null; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), C3345avm.IeS.StateSet); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i = 0; i < indexCount; i++) { int index = obtainStyledAttributes.getIndex(i); if (index == C3345avm.IeS.StateSet_defaultState) { this.f = obtainStyledAttributes.getResourceId(index, this.f); } } obtainStyledAttributes.recycle(); try { int eventType = xmlPullParser.getEventType(); while (true) { char c = 1; if (eventType == 1) { return; } if (eventType == 0) { xmlPullParser.getName(); } else if (eventType == 2) { String name = xmlPullParser.getName(); switch (name.hashCode()) { case 80204913: if (name.equals("State")) { c = 2; break; } break; case 1301459538: if (name.equals("LayoutDescription")) { c = 0; break; } break; case 1382829617: if (name.equals("StateSet")) { break; } break; case 1901439077: if (name.equals("Variant")) { c = 3; break; } break; } c = 65535; if (c == 2) { ieS = new IeS(context, xmlPullParser); this.b.put(ieS.e, ieS); } else if (c == 3) { LWm lWm = new LWm(context, xmlPullParser); if (ieS != null) { ieS.d.add(lWm); } } } else if (eventType != 3) { continue; } else if ("StateSet".equals(xmlPullParser.getName())) { return; } eventType = xmlPullParser.next(); } } catch (IOException | XmlPullParserException unused) { } } public final int a(int i) { IeS ieS; int e; if (-1 != i) { IeS ieS2 = this.b.get(i); if (ieS2 == null) { return -1; } int e2 = ieS2.e(-1.0f, -1.0f); return e2 == -1 ? ieS2.a : ieS2.d.get(e2).d; } if (i == -1) { ieS = this.b.valueAt(0); } else { ieS = this.b.get(this.d); } if (ieS == null) { return -1; } if ((this.c == -1 || !ieS.d.get(-1).c(-1.0f, -1.0f)) && -1 != (e = ieS.e(-1.0f, -1.0f))) { return e == -1 ? ieS.a : ieS.d.get(e).d; } return -1; } /* renamed from: o.gqk$IeS */ /* loaded from: classes.dex */ public static class IeS { public int a; private boolean b; public ArrayList d = new ArrayList<>(); int e; public IeS(Context context, XmlPullParser xmlPullParser) { this.a = -1; this.b = false; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), C3345avm.IeS.State); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i = 0; i < indexCount; i++) { int index = obtainStyledAttributes.getIndex(i); if (index == C3345avm.IeS.State_android_id) { this.e = obtainStyledAttributes.getResourceId(index, this.e); } else if (index == C3345avm.IeS.State_constraints) { this.a = obtainStyledAttributes.getResourceId(index, this.a); String resourceTypeName = context.getResources().getResourceTypeName(this.a); context.getResources().getResourceName(this.a); if ("layout".equals(resourceTypeName)) { this.b = true; } } } obtainStyledAttributes.recycle(); } public final int e(float f, float f2) { for (int i = 0; i < this.d.size(); i++) { if (this.d.get(i).c(-1.0f, -1.0f)) { return i; } } return -1; } } /* renamed from: o.gqk$LWm */ /* loaded from: classes.dex */ public static class LWm { private boolean a; private float b; private float c; public int d; private float e; private float f; public LWm(Context context, XmlPullParser xmlPullParser) { this.f = Float.NaN; this.b = Float.NaN; this.e = Float.NaN; this.c = Float.NaN; this.d = -1; this.a = false; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), C3345avm.IeS.Variant); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i = 0; i < indexCount; i++) { int index = obtainStyledAttributes.getIndex(i); if (index == C3345avm.IeS.Variant_constraints) { this.d = obtainStyledAttributes.getResourceId(index, this.d); String resourceTypeName = context.getResources().getResourceTypeName(this.d); context.getResources().getResourceName(this.d); if ("layout".equals(resourceTypeName)) { this.a = true; } } else if (index == C3345avm.IeS.Variant_region_heightLessThan) { this.c = obtainStyledAttributes.getDimension(index, this.c); } else if (index == C3345avm.IeS.Variant_region_heightMoreThan) { this.b = obtainStyledAttributes.getDimension(index, this.b); } else if (index == C3345avm.IeS.Variant_region_widthLessThan) { this.e = obtainStyledAttributes.getDimension(index, this.e); } else if (index == C3345avm.IeS.Variant_region_widthMoreThan) { this.f = obtainStyledAttributes.getDimension(index, this.f); } } obtainStyledAttributes.recycle(); } public final boolean c(float f, float f2) { if (!Float.isNaN(this.f) && f < this.f) { return false; } if (!Float.isNaN(this.b) && f2 < this.b) { return false; } if (Float.isNaN(this.e) || f <= this.e) { return Float.isNaN(this.c) || f2 <= this.c; } return false; } } }