package o; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect; import android.util.TypedValue; import android.util.Xml; import android.view.View; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateInterpolator; import android.view.animation.AnimationUtils; import android.view.animation.AnticipateInterpolator; import android.view.animation.BounceInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.OvershootInterpolator; import androidx.constraintlayout.motion.widget.MotionLayout; import androidx.constraintlayout.widget.ConstraintLayout; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import o.C16822rXU; import o.C3345avm; import o.yqQ; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /* loaded from: classes.dex */ public final class MQE { int a; int b; int c; int d; public int e; private Context f; private yqQ.Sts g; int h; private int i; int j; private String k; private boolean l; private int m; private int n; /* renamed from: o, reason: collision with root package name */ private int f8269o; private int p; private int q; private liJ r; private int s = -1; private int t; private String u; private int x; public final String toString() { StringBuilder sb = new StringBuilder("ViewTransition("); sb.append(C6805ccO.e(this.f, this.c)); sb.append(")"); return sb.toString(); } /* JADX INFO: Access modifiers changed from: package-private */ public MQE(Context context, XmlPullParser xmlPullParser) { char c; this.e = -1; this.l = false; this.t = 0; this.f8269o = -1; this.x = -1; this.i = 0; this.k = null; this.m = -1; this.a = -1; this.d = -1; this.q = -1; this.n = -1; this.j = -1; this.b = -1; this.f = context; try { int eventType = xmlPullParser.getEventType(); while (eventType != 1) { if (eventType == 2) { String name = xmlPullParser.getName(); switch (name.hashCode()) { case -1962203927: if (name.equals("ConstraintOverride")) { c = 2; break; } break; case -1239391468: if (name.equals("KeyFrameSet")) { c = 1; break; } break; case 61998586: if (name.equals("ViewTransition")) { c = 0; break; } break; case 366511058: if (name.equals("CustomMethod")) { c = 4; break; } break; case 1791837707: if (name.equals("CustomAttribute")) { c = 3; break; } break; } c = 65535; if (c == 0) { TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), C3345avm.IeS.ViewTransition); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i = 0; i < indexCount; i++) { int index = obtainStyledAttributes.getIndex(i); if (index == C3345avm.IeS.ViewTransition_android_id) { this.c = obtainStyledAttributes.getResourceId(index, this.c); } else if (index == C3345avm.IeS.ViewTransition_motionTarget) { if (MotionLayout.b) { int resourceId = obtainStyledAttributes.getResourceId(index, this.p); this.p = resourceId; if (resourceId == -1) { this.u = obtainStyledAttributes.getString(index); } } else if (obtainStyledAttributes.peekValue(index).type == 3) { this.u = obtainStyledAttributes.getString(index); } else { this.p = obtainStyledAttributes.getResourceId(index, this.p); } } else if (index == C3345avm.IeS.ViewTransition_onStateTransition) { this.e = obtainStyledAttributes.getInt(index, this.e); } else if (index == C3345avm.IeS.ViewTransition_transitionDisable) { this.l = obtainStyledAttributes.getBoolean(index, this.l); } else if (index == C3345avm.IeS.ViewTransition_pathMotionArc) { this.t = obtainStyledAttributes.getInt(index, this.t); } else if (index == C3345avm.IeS.ViewTransition_duration) { this.f8269o = obtainStyledAttributes.getInt(index, this.f8269o); } else if (index == C3345avm.IeS.ViewTransition_upDuration) { this.x = obtainStyledAttributes.getInt(index, this.x); } else if (index == C3345avm.IeS.ViewTransition_viewTransitionMode) { this.h = obtainStyledAttributes.getInt(index, this.h); } else if (index == C3345avm.IeS.ViewTransition_motionInterpolator) { TypedValue peekValue = obtainStyledAttributes.peekValue(index); if (peekValue.type == 1) { int resourceId2 = obtainStyledAttributes.getResourceId(index, -1); this.m = resourceId2; if (resourceId2 != -1) { this.i = -2; } } else if (peekValue.type == 3) { String string = obtainStyledAttributes.getString(index); this.k = string; if (string == null || string.indexOf("/") <= 0) { this.i = -1; } else { this.m = obtainStyledAttributes.getResourceId(index, -1); this.i = -2; } } else { this.i = obtainStyledAttributes.getInteger(index, this.i); } } else if (index == C3345avm.IeS.ViewTransition_setsTag) { this.a = obtainStyledAttributes.getResourceId(index, this.a); } else if (index == C3345avm.IeS.ViewTransition_clearsTag) { this.d = obtainStyledAttributes.getResourceId(index, this.d); } else if (index == C3345avm.IeS.ViewTransition_ifTagSet) { this.q = obtainStyledAttributes.getResourceId(index, this.q); } else if (index == C3345avm.IeS.ViewTransition_ifTagNotSet) { this.n = obtainStyledAttributes.getResourceId(index, this.n); } else if (index == C3345avm.IeS.ViewTransition_SharedValueId) { this.b = obtainStyledAttributes.getResourceId(index, this.b); } else if (index == C3345avm.IeS.ViewTransition_SharedValue) { this.j = obtainStyledAttributes.getInteger(index, this.j); } } obtainStyledAttributes.recycle(); } else if (c == 1) { this.r = new liJ(context, xmlPullParser); } else if (c == 2) { this.g = yqQ.a(context, xmlPullParser); } else if (c == 3 || c == 4) { Prc.a(context, xmlPullParser, this.g.e); } else { StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1]; xmlPullParser.getLineNumber(); } } else if (eventType != 3) { continue; } else if ("ViewTransition".equals(xmlPullParser.getName())) { return; } eventType = xmlPullParser.next(); } } catch (IOException | XmlPullParserException unused) { } } /* loaded from: classes.dex */ public static class IeS { private boolean a; public C15870jKt d; private float f; private int g; private final int h; private long i; private Interpolator j; private Trr k; private float l; private final int m; private int n; /* renamed from: o, reason: collision with root package name */ private long f8270o; private ZhI b = new ZhI(); public boolean e = false; public Rect c = new Rect(); IeS(Trr trr, C15870jKt c15870jKt, int i, int i2, int i3, Interpolator interpolator, int i4, int i5) { this.a = false; this.k = trr; this.d = c15870jKt; this.g = i; this.n = i2; long nanoTime = System.nanoTime(); this.f8270o = nanoTime; this.i = nanoTime; Trr trr2 = this.k; if (trr2.d == null) { trr2.d = new ArrayList<>(); } trr2.d.add(this); this.j = interpolator; this.m = i4; this.h = i5; if (i3 == 3) { this.a = true; } this.f = i == 0 ? Float.MAX_VALUE : 1.0f / i; if (this.e) { b(); } else { d(); } } public final void c() { this.e = true; int i = this.n; if (i != -1) { this.f = i == 0 ? Float.MAX_VALUE : 1.0f / i; } this.k.a.invalidate(); this.i = System.nanoTime(); } public final void b() { long nanoTime = System.nanoTime(); long j = this.i; this.i = nanoTime; float f = this.l - (((float) ((nanoTime - j) * 1.0E-6d)) * this.f); this.l = f; if (f < BitmapDescriptorFactory.HUE_RED) { this.l = BitmapDescriptorFactory.HUE_RED; } Interpolator interpolator = this.j; float interpolation = interpolator == null ? this.l : interpolator.getInterpolation(this.l); C15870jKt c15870jKt = this.d; boolean c = c15870jKt.c(c15870jKt.x, interpolation, nanoTime, this.b); if (this.l <= BitmapDescriptorFactory.HUE_RED) { if (this.m != -1) { this.d.x.setTag(this.m, Long.valueOf(System.nanoTime())); } if (this.h != -1) { this.d.x.setTag(this.h, null); } this.k.b.add(this); } if (this.l > BitmapDescriptorFactory.HUE_RED || c) { this.k.a.invalidate(); } } public final void d() { long nanoTime = System.nanoTime(); long j = this.i; this.i = nanoTime; float f = this.l + (((float) ((nanoTime - j) * 1.0E-6d)) * this.f); this.l = f; if (f >= 1.0f) { this.l = 1.0f; } Interpolator interpolator = this.j; float interpolation = interpolator == null ? this.l : interpolator.getInterpolation(this.l); C15870jKt c15870jKt = this.d; boolean c = c15870jKt.c(c15870jKt.x, interpolation, nanoTime, this.b); if (this.l >= 1.0f) { if (this.m != -1) { this.d.x.setTag(this.m, Long.valueOf(System.nanoTime())); } if (this.h != -1) { this.d.x.setTag(this.h, null); } if (!this.a) { this.k.b.add(this); } } if (this.l < 1.0f || c) { this.k.a.invalidate(); } } } public final void d(Trr trr, MotionLayout motionLayout, int i, yqQ yqq, final View... viewArr) { int[] iArr; if (this.l) { return; } int i2 = this.h; Interpolator interpolator = null; if (i2 == 2) { View view = viewArr[0]; C15870jKt c15870jKt = new C15870jKt(view); c15870jKt.v.m = BitmapDescriptorFactory.HUE_RED; c15870jKt.v.l = BitmapDescriptorFactory.HUE_RED; c15870jKt.t = true; C11094eYU c11094eYU = c15870jKt.v; float x = view.getX(); float y = view.getY(); float width = view.getWidth(); float height = view.getHeight(); c11094eYU.s = x; c11094eYU.r = y; c11094eYU.f8961o = width; c11094eYU.d = height; C11094eYU c11094eYU2 = c15870jKt.h; float x2 = view.getX(); float y2 = view.getY(); float width2 = view.getWidth(); float height2 = view.getHeight(); c11094eYU2.s = x2; c11094eYU2.r = y2; c11094eYU2.f8961o = width2; c11094eYU2.d = height2; TqO tqO = c15870jKt.w; view.getX(); view.getY(); view.getWidth(); view.getHeight(); tqO.d(view); TqO tqO2 = c15870jKt.j; view.getX(); view.getY(); view.getWidth(); view.getHeight(); tqO2.d(view); ArrayList arrayList = this.r.c.get(-1); if (arrayList != null) { c15870jKt.l.addAll(arrayList); } c15870jKt.b(motionLayout.getWidth(), motionLayout.getHeight(), System.nanoTime()); int i3 = this.f8269o; int i4 = this.x; int i5 = this.e; Context context = motionLayout.getContext(); int i6 = this.i; if (i6 == -2) { interpolator = AnimationUtils.loadInterpolator(context, this.m); } else if (i6 == -1) { interpolator = new Interpolator(Yrp.a(this.k)) { // from class: o.MQE.3 final Yrp c; { this.c = r1; } @Override // android.animation.TimeInterpolator public final float getInterpolation(float f) { return (float) this.c.e(f); } }; } else if (i6 == 0) { interpolator = new AccelerateDecelerateInterpolator(); } else if (i6 == 1) { interpolator = new AccelerateInterpolator(); } else if (i6 == 2) { interpolator = new DecelerateInterpolator(); } else if (i6 == 4) { interpolator = new BounceInterpolator(); } else if (i6 == 5) { interpolator = new OvershootInterpolator(); } else if (i6 == 6) { interpolator = new AnticipateInterpolator(); } new IeS(trr, c15870jKt, i3, i4, i5, interpolator, this.a, this.d); return; } if (i2 == 1) { C16822rXU c16822rXU = motionLayout.q; if (c16822rXU == null) { iArr = null; } else { int size = c16822rXU.b.size(); iArr = new int[size]; for (int i7 = 0; i7 < size; i7++) { iArr[i7] = c16822rXU.b.keyAt(i7); } } for (int i8 : iArr) { if (i8 != i) { C16822rXU c16822rXU2 = motionLayout.q; yqQ e = c16822rXU2 == null ? null : c16822rXU2.e(i8); for (View view2 : viewArr) { int id = view2.getId(); yqQ.Sts sts = e.a.containsKey(Integer.valueOf(id)) ? e.a.get(Integer.valueOf(id)) : null; yqQ.Sts sts2 = this.g; if (sts2 != null) { yqQ.Sts.C0128Sts c0128Sts = sts2.b; if (c0128Sts != null) { c0128Sts.a(sts); } sts.e.putAll(this.g.e); } } } } } yqQ yqq2 = new yqQ(); yqq2.a.clear(); for (Integer num : yqq.a.keySet()) { yqQ.Sts sts3 = yqq.a.get(num); if (sts3 != null) { yqq2.a.put(num, sts3.clone()); } } for (View view3 : viewArr) { int id2 = view3.getId(); yqQ.Sts sts4 = yqq2.a.containsKey(Integer.valueOf(id2)) ? yqq2.a.get(Integer.valueOf(id2)) : null; yqQ.Sts sts5 = this.g; if (sts5 != null) { yqQ.Sts.C0128Sts c0128Sts2 = sts5.b; if (c0128Sts2 != null) { c0128Sts2.a(sts4); } sts4.e.putAll(this.g.e); } } motionLayout.d(i, yqq2); motionLayout.d(C3345avm.RVV.view_transition, yqq); motionLayout.setState(C3345avm.RVV.view_transition, -1, -1); C16822rXU.HBt hBt = new C16822rXU.HBt(motionLayout.q, C3345avm.RVV.view_transition, i); for (View view4 : viewArr) { int i9 = this.f8269o; if (i9 != -1) { hBt.h = Math.max(i9, 8); } hBt.k = this.t; int i10 = this.i; String str = this.k; int i11 = this.m; hBt.b = i10; hBt.j = str; hBt.d = i11; int id3 = view4.getId(); liJ lij = this.r; if (lij != null) { ArrayList arrayList2 = lij.c.get(-1); liJ lij2 = new liJ(); Iterator it = arrayList2.iterator(); while (it.hasNext()) { AbstractC0558JiG clone = it.next().clone(); clone.a = id3; lij2.b(clone); } hBt.f9258o.add(lij2); } } motionLayout.d(hBt); Runnable runnable = new Runnable(this, viewArr) { // from class: o.FGd public final View[] c; public final MQE d; @Override // java.lang.Runnable public final void run() { MQE mqe = this.d; View[] viewArr2 = this.c; if (mqe.a != -1) { for (View view5 : viewArr2) { view5.setTag(mqe.a, Long.valueOf(System.nanoTime())); } } if (mqe.d != -1) { for (View view6 : viewArr2) { view6.setTag(mqe.d, null); } } } { this.d = this; this.c = viewArr; } }; motionLayout.e(1.0f); motionLayout.n = runnable; } public final boolean d(View view) { String str; if (view == null) { return false; } if ((this.p == -1 && this.u == null) || !b(view)) { return false; } if (view.getId() == this.p) { return true; } return this.u != null && (view.getLayoutParams() instanceof ConstraintLayout.Sts) && (str = ((ConstraintLayout.Sts) view.getLayoutParams()).f6383o) != null && str.matches(this.u); } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean b(View view) { int i = this.q; boolean z = i == -1 || view.getTag(i) != null; int i2 = this.n; return z && (i2 == -1 || view.getTag(i2) == null); } }