package X6FRs_4.NQvZgp_17.KQgRr5e_0.KQgRr5e_0;

import X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.animation.Keyframe;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.os.Build;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.util.Xml;
import android.view.InflateException;
import com.wang.avi.BuildConfig;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/* compiled from: AnimatorInflaterCompat.java */
/* loaded from: classes.dex */
public class X6FRs_4 {

    /* compiled from: AnimatorInflaterCompat.java */
    /* loaded from: classes.dex */
    public static class KQgRr5e_0 implements TypeEvaluator<QxJ9d_1.C0038QxJ9d_1[]> {
        public QxJ9d_1.C0038QxJ9d_1[] KQgRr5e_0;

        @Override // android.animation.TypeEvaluator
        /* renamed from: KQgRr5e_0 */
        public QxJ9d_1.C0038QxJ9d_1[] evaluate(float f, QxJ9d_1.C0038QxJ9d_1[] c0038QxJ9d_1Arr, QxJ9d_1.C0038QxJ9d_1[] c0038QxJ9d_1Arr2) {
            if (X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1.m286KQgRr5e_0(c0038QxJ9d_1Arr, c0038QxJ9d_1Arr2)) {
                QxJ9d_1.C0038QxJ9d_1[] c0038QxJ9d_1Arr3 = this.KQgRr5e_0;
                if (c0038QxJ9d_1Arr3 == null || !X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1.m286KQgRr5e_0(c0038QxJ9d_1Arr3, c0038QxJ9d_1Arr)) {
                    this.KQgRr5e_0 = X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1.KQgRr5e_0(c0038QxJ9d_1Arr);
                }
                for (int i = 0; i < c0038QxJ9d_1Arr.length; i++) {
                    this.KQgRr5e_0[i].KQgRr5e_0(c0038QxJ9d_1Arr[i], c0038QxJ9d_1Arr2[i], f);
                }
                return this.KQgRr5e_0;
            }
            throw new IllegalArgumentException("Can't interpolate between two incompatible pathData");
        }
    }

    public static Animator KQgRr5e_0(Context context, int i) throws Resources.NotFoundException {
        if (Build.VERSION.SDK_INT >= 24) {
            return AnimatorInflater.loadAnimator(context, i);
        }
        return KQgRr5e_0(context, context.getResources(), context.getTheme(), i);
    }

    public static boolean KQgRr5e_0(int i) {
        return i >= 28 && i <= 31;
    }

    public static Animator KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, int i) throws Resources.NotFoundException {
        return KQgRr5e_0(context, resources, theme, i, 1.0f);
    }

    public static Animator KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, int i, float f) throws Resources.NotFoundException {
        XmlResourceParser xmlResourceParser = null;
        try {
            try {
                try {
                    xmlResourceParser = resources.getAnimation(i);
                    return KQgRr5e_0(context, resources, theme, xmlResourceParser, f);
                } catch (XmlPullParserException e) {
                    Resources.NotFoundException notFoundException = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(i));
                    notFoundException.initCause(e);
                    throw notFoundException;
                }
            } catch (IOException e2) {
                Resources.NotFoundException notFoundException2 = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(i));
                notFoundException2.initCause(e2);
                throw notFoundException2;
            }
        } finally {
            if (xmlResourceParser != null) {
                xmlResourceParser.close();
            }
        }
    }

    public static PropertyValuesHolder KQgRr5e_0(TypedArray typedArray, int i, int i2, int i3, String str) {
        int i4;
        int i5;
        int i6;
        float f;
        PropertyValuesHolder ofFloat;
        float f2;
        float f3;
        PropertyValuesHolder ofObject;
        TypedValue peekValue = typedArray.peekValue(i2);
        boolean z = peekValue != null;
        int i7 = z ? peekValue.type : 0;
        TypedValue peekValue2 = typedArray.peekValue(i3);
        boolean z2 = peekValue2 != null;
        int i8 = z2 ? peekValue2.type : 0;
        if (i == 4) {
            i = ((z && KQgRr5e_0(i7)) || (z2 && KQgRr5e_0(i8))) ? 3 : 0;
        }
        boolean z3 = i == 0;
        PropertyValuesHolder propertyValuesHolder = null;
        if (i == 2) {
            String string = typedArray.getString(i2);
            String string2 = typedArray.getString(i3);
            QxJ9d_1.C0038QxJ9d_1[] m288KQgRr5e_0 = X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1.m288KQgRr5e_0(string);
            QxJ9d_1.C0038QxJ9d_1[] m288KQgRr5e_02 = X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1.m288KQgRr5e_0(string2);
            if (m288KQgRr5e_0 == null && m288KQgRr5e_02 == null) {
                return null;
            }
            if (m288KQgRr5e_0 == null) {
                if (m288KQgRr5e_02 != null) {
                    return PropertyValuesHolder.ofObject(str, new KQgRr5e_0(), m288KQgRr5e_02);
                }
                return null;
            }
            KQgRr5e_0 kQgRr5e_0 = new KQgRr5e_0();
            if (m288KQgRr5e_02 != null) {
                if (X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1.m286KQgRr5e_0(m288KQgRr5e_0, m288KQgRr5e_02)) {
                    ofObject = PropertyValuesHolder.ofObject(str, kQgRr5e_0, m288KQgRr5e_0, m288KQgRr5e_02);
                } else {
                    throw new InflateException(" Can't morph from " + string + " to " + string2);
                }
            } else {
                ofObject = PropertyValuesHolder.ofObject(str, kQgRr5e_0, m288KQgRr5e_0);
            }
            return ofObject;
        }
        IFxWkV_5 KQgRr5e_02 = i == 3 ? IFxWkV_5.KQgRr5e_0() : null;
        if (z3) {
            if (z) {
                if (i7 == 5) {
                    f2 = typedArray.getDimension(i2, 0.0f);
                } else {
                    f2 = typedArray.getFloat(i2, 0.0f);
                }
                if (z2) {
                    if (i8 == 5) {
                        f3 = typedArray.getDimension(i3, 0.0f);
                    } else {
                        f3 = typedArray.getFloat(i3, 0.0f);
                    }
                    ofFloat = PropertyValuesHolder.ofFloat(str, f2, f3);
                } else {
                    ofFloat = PropertyValuesHolder.ofFloat(str, f2);
                }
            } else {
                if (i8 == 5) {
                    f = typedArray.getDimension(i3, 0.0f);
                } else {
                    f = typedArray.getFloat(i3, 0.0f);
                }
                ofFloat = PropertyValuesHolder.ofFloat(str, f);
            }
            propertyValuesHolder = ofFloat;
        } else if (z) {
            if (i7 == 5) {
                i5 = (int) typedArray.getDimension(i2, 0.0f);
            } else if (KQgRr5e_0(i7)) {
                i5 = typedArray.getColor(i2, 0);
            } else {
                i5 = typedArray.getInt(i2, 0);
            }
            if (z2) {
                if (i8 == 5) {
                    i6 = (int) typedArray.getDimension(i3, 0.0f);
                } else if (KQgRr5e_0(i8)) {
                    i6 = typedArray.getColor(i3, 0);
                } else {
                    i6 = typedArray.getInt(i3, 0);
                }
                propertyValuesHolder = PropertyValuesHolder.ofInt(str, i5, i6);
            } else {
                propertyValuesHolder = PropertyValuesHolder.ofInt(str, i5);
            }
        } else if (z2) {
            if (i8 == 5) {
                i4 = (int) typedArray.getDimension(i3, 0.0f);
            } else if (KQgRr5e_0(i8)) {
                i4 = typedArray.getColor(i3, 0);
            } else {
                i4 = typedArray.getInt(i3, 0);
            }
            propertyValuesHolder = PropertyValuesHolder.ofInt(str, i4);
        }
        if (propertyValuesHolder == null || KQgRr5e_02 == null) {
            return propertyValuesHolder;
        }
        propertyValuesHolder.setEvaluator(KQgRr5e_02);
        return propertyValuesHolder;
    }

    public static void KQgRr5e_0(ValueAnimator valueAnimator, TypedArray typedArray, TypedArray typedArray2, float f, XmlPullParser xmlPullParser) {
        long QxJ9d_1 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(typedArray, xmlPullParser, "duration", 1, 300);
        long QxJ9d_12 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(typedArray, xmlPullParser, "startOffset", 2, 0);
        int QxJ9d_13 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(typedArray, xmlPullParser, "valueType", 7, 4);
        if (X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(xmlPullParser, "valueFrom") && X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(xmlPullParser, "valueTo")) {
            if (QxJ9d_13 == 4) {
                QxJ9d_13 = KQgRr5e_0(typedArray, 5, 6);
            }
            PropertyValuesHolder KQgRr5e_02 = KQgRr5e_0(typedArray, QxJ9d_13, 5, 6, BuildConfig.FLAVOR);
            if (KQgRr5e_02 != null) {
                valueAnimator.setValues(KQgRr5e_02);
            }
        }
        valueAnimator.setDuration(QxJ9d_1);
        valueAnimator.setStartDelay(QxJ9d_12);
        valueAnimator.setRepeatCount(X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(typedArray, xmlPullParser, "repeatCount", 3, 0));
        valueAnimator.setRepeatMode(X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(typedArray, xmlPullParser, "repeatMode", 4, 1));
        if (typedArray2 != null) {
            KQgRr5e_0(valueAnimator, typedArray2, QxJ9d_13, f, xmlPullParser);
        }
    }

    public static void KQgRr5e_0(ValueAnimator valueAnimator, TypedArray typedArray, int i, float f, XmlPullParser xmlPullParser) {
        ObjectAnimator objectAnimator = (ObjectAnimator) valueAnimator;
        String m334KQgRr5e_0 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.m334KQgRr5e_0(typedArray, xmlPullParser, "pathData", 1);
        if (m334KQgRr5e_0 != null) {
            String m334KQgRr5e_02 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.m334KQgRr5e_0(typedArray, xmlPullParser, "propertyXName", 2);
            String m334KQgRr5e_03 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.m334KQgRr5e_0(typedArray, xmlPullParser, "propertyYName", 3);
            if (i != 2) {
            }
            if (m334KQgRr5e_02 == null && m334KQgRr5e_03 == null) {
                throw new InflateException(typedArray.getPositionDescription() + " propertyXName or propertyYName is needed for PathData");
            }
            KQgRr5e_0(X6FRs_4.IMuAHx_6.IFxWkV_5.QxJ9d_1.KQgRr5e_0(m334KQgRr5e_0), objectAnimator, f * 0.5f, m334KQgRr5e_02, m334KQgRr5e_03);
            return;
        }
        objectAnimator.setPropertyName(X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.m334KQgRr5e_0(typedArray, xmlPullParser, "propertyName", 0));
    }

    public static void KQgRr5e_0(Path path, ObjectAnimator objectAnimator, float f, String str, String str2) {
        PathMeasure pathMeasure = new PathMeasure(path, false);
        ArrayList arrayList = new ArrayList();
        float f2 = 0.0f;
        arrayList.add(Float.valueOf(0.0f));
        float f3 = 0.0f;
        do {
            f3 += pathMeasure.getLength();
            arrayList.add(Float.valueOf(f3));
        } while (pathMeasure.nextContour());
        PathMeasure pathMeasure2 = new PathMeasure(path, false);
        int min = Math.min(100, ((int) (f3 / f)) + 1);
        float[] fArr = new float[min];
        float[] fArr2 = new float[min];
        float[] fArr3 = new float[2];
        float f4 = f3 / (min - 1);
        int i = 0;
        int i2 = 0;
        while (true) {
            if (i >= min) {
                break;
            }
            pathMeasure2.getPosTan(f2 - ((Float) arrayList.get(i2)).floatValue(), fArr3, null);
            fArr[i] = fArr3[0];
            fArr2[i] = fArr3[1];
            f2 += f4;
            int i3 = i2 + 1;
            if (i3 < arrayList.size() && f2 > ((Float) arrayList.get(i3)).floatValue()) {
                pathMeasure2.nextContour();
                i2 = i3;
            }
            i++;
        }
        PropertyValuesHolder ofFloat = str != null ? PropertyValuesHolder.ofFloat(str, fArr) : null;
        PropertyValuesHolder ofFloat2 = str2 != null ? PropertyValuesHolder.ofFloat(str2, fArr2) : null;
        if (ofFloat == null) {
            objectAnimator.setValues(ofFloat2);
        } else if (ofFloat2 == null) {
            objectAnimator.setValues(ofFloat);
        } else {
            objectAnimator.setValues(ofFloat, ofFloat2);
        }
    }

    public static Animator KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, float f) throws XmlPullParserException, IOException {
        return KQgRr5e_0(context, resources, theme, xmlPullParser, Xml.asAttributeSet(xmlPullParser), null, 0, f);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:34:0x00ba  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static Animator KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, AttributeSet attributeSet, AnimatorSet animatorSet, int i, float f) throws XmlPullParserException, IOException {
        int i2;
        int depth = xmlPullParser.getDepth();
        ValueAnimator valueAnimator = null;
        ArrayList arrayList = null;
        while (true) {
            int next = xmlPullParser.next();
            i2 = 0;
            if ((next != 3 || xmlPullParser.getDepth() > depth) && next != 1) {
                if (next == 2) {
                    String name = xmlPullParser.getName();
                    if (name.equals("objectAnimator")) {
                        valueAnimator = KQgRr5e_0(context, resources, theme, attributeSet, f, xmlPullParser);
                    } else if (name.equals("animator")) {
                        valueAnimator = KQgRr5e_0(context, resources, theme, attributeSet, null, f, xmlPullParser);
                    } else {
                        if (name.equals("set")) {
                            AnimatorSet animatorSet2 = new AnimatorSet();
                            TypedArray KQgRr5e_02 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(resources, theme, attributeSet, X6FRs_4.NQvZgp_17.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0.f3228FSaI4_7);
                            KQgRr5e_0(context, resources, theme, xmlPullParser, attributeSet, animatorSet2, X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(KQgRr5e_02, xmlPullParser, "ordering", 0, 0), f);
                            KQgRr5e_02.recycle();
                            valueAnimator = animatorSet2;
                        } else if (name.equals("propertyValuesHolder")) {
                            PropertyValuesHolder[] KQgRr5e_03 = KQgRr5e_0(context, resources, theme, xmlPullParser, Xml.asAttributeSet(xmlPullParser));
                            if (KQgRr5e_03 != null && valueAnimator != null && (valueAnimator instanceof ValueAnimator)) {
                                valueAnimator.setValues(KQgRr5e_03);
                            }
                            i2 = 1;
                        } else {
                            throw new RuntimeException("Unknown animator name: " + xmlPullParser.getName());
                        }
                        if (animatorSet != null && i2 == 0) {
                            if (arrayList == null) {
                                arrayList = new ArrayList();
                            }
                            arrayList.add(valueAnimator);
                        }
                    }
                    if (animatorSet != null) {
                        if (arrayList == null) {
                        }
                        arrayList.add(valueAnimator);
                    }
                }
            }
        }
        if (animatorSet != null && arrayList != null) {
            Animator[] animatorArr = new Animator[arrayList.size()];
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                animatorArr[i2] = (Animator) it.next();
                i2++;
            }
            if (i == 0) {
                animatorSet.playTogether(animatorArr);
            } else {
                animatorSet.playSequentially(animatorArr);
            }
        }
        return valueAnimator;
    }

    public static PropertyValuesHolder[] KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, AttributeSet attributeSet) throws XmlPullParserException, IOException {
        int i;
        PropertyValuesHolder[] propertyValuesHolderArr = null;
        ArrayList arrayList = null;
        while (true) {
            int eventType = xmlPullParser.getEventType();
            if (eventType == 3 || eventType == 1) {
                break;
            } else if (eventType != 2) {
                xmlPullParser.next();
            } else {
                if (xmlPullParser.getName().equals("propertyValuesHolder")) {
                    TypedArray KQgRr5e_02 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(resources, theme, attributeSet, X6FRs_4.NQvZgp_17.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0.f3235Xgtqvk_8);
                    String m334KQgRr5e_0 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.m334KQgRr5e_0(KQgRr5e_02, xmlPullParser, "propertyName", 3);
                    int QxJ9d_1 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(KQgRr5e_02, xmlPullParser, "valueType", 2, 4);
                    PropertyValuesHolder KQgRr5e_03 = KQgRr5e_0(context, resources, theme, xmlPullParser, m334KQgRr5e_0, QxJ9d_1);
                    if (KQgRr5e_03 == null) {
                        KQgRr5e_03 = KQgRr5e_0(KQgRr5e_02, QxJ9d_1, 0, 1, m334KQgRr5e_0);
                    }
                    if (KQgRr5e_03 != null) {
                        if (arrayList == null) {
                            arrayList = new ArrayList();
                        }
                        arrayList.add(KQgRr5e_03);
                    }
                    KQgRr5e_02.recycle();
                }
                xmlPullParser.next();
            }
        }
        if (arrayList != null) {
            int size = arrayList.size();
            propertyValuesHolderArr = new PropertyValuesHolder[size];
            for (i = 0; i < size; i++) {
                propertyValuesHolderArr[i] = (PropertyValuesHolder) arrayList.get(i);
            }
        }
        return propertyValuesHolderArr;
    }

    public static int KQgRr5e_0(Resources resources, Resources.Theme theme, AttributeSet attributeSet, XmlPullParser xmlPullParser) {
        TypedArray KQgRr5e_02 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(resources, theme, attributeSet, X6FRs_4.NQvZgp_17.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0.f3236XnFJ5_9);
        int i = 0;
        TypedValue KQgRr5e_03 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(KQgRr5e_02, xmlPullParser, "value", 0);
        if ((KQgRr5e_03 != null) && KQgRr5e_0(KQgRr5e_03.type)) {
            i = 3;
        }
        KQgRr5e_02.recycle();
        return i;
    }

    public static int KQgRr5e_0(TypedArray typedArray, int i, int i2) {
        TypedValue peekValue = typedArray.peekValue(i);
        boolean z = peekValue != null;
        int i3 = z ? peekValue.type : 0;
        TypedValue peekValue2 = typedArray.peekValue(i2);
        boolean z2 = peekValue2 != null;
        return ((z && KQgRr5e_0(i3)) || (z2 && KQgRr5e_0(z2 ? peekValue2.type : 0))) ? 3 : 0;
    }

    public static PropertyValuesHolder KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, String str, int i) throws XmlPullParserException, IOException {
        int size;
        PropertyValuesHolder propertyValuesHolder = null;
        ArrayList arrayList = null;
        while (true) {
            int next = xmlPullParser.next();
            if (next == 3 || next == 1) {
                break;
            } else if (xmlPullParser.getName().equals("keyframe")) {
                if (i == 4) {
                    i = KQgRr5e_0(resources, theme, Xml.asAttributeSet(xmlPullParser), xmlPullParser);
                }
                Keyframe KQgRr5e_02 = KQgRr5e_0(context, resources, theme, Xml.asAttributeSet(xmlPullParser), i, xmlPullParser);
                if (KQgRr5e_02 != null) {
                    if (arrayList == null) {
                        arrayList = new ArrayList();
                    }
                    arrayList.add(KQgRr5e_02);
                }
                xmlPullParser.next();
            }
        }
        if (arrayList != null && (size = arrayList.size()) > 0) {
            Keyframe keyframe = (Keyframe) arrayList.get(0);
            Keyframe keyframe2 = (Keyframe) arrayList.get(size - 1);
            float fraction = keyframe2.getFraction();
            if (fraction < 1.0f) {
                if (fraction < 0.0f) {
                    keyframe2.setFraction(1.0f);
                } else {
                    arrayList.add(arrayList.size(), KQgRr5e_0(keyframe2, 1.0f));
                    size++;
                }
            }
            float fraction2 = keyframe.getFraction();
            if (fraction2 != 0.0f) {
                if (fraction2 < 0.0f) {
                    keyframe.setFraction(0.0f);
                } else {
                    arrayList.add(0, KQgRr5e_0(keyframe, 0.0f));
                    size++;
                }
            }
            Keyframe[] keyframeArr = new Keyframe[size];
            arrayList.toArray(keyframeArr);
            for (int i2 = 0; i2 < size; i2++) {
                Keyframe keyframe3 = keyframeArr[i2];
                if (keyframe3.getFraction() < 0.0f) {
                    if (i2 == 0) {
                        keyframe3.setFraction(0.0f);
                    } else {
                        int i3 = size - 1;
                        if (i2 == i3) {
                            keyframe3.setFraction(1.0f);
                        } else {
                            int i4 = i2;
                            for (int i5 = i2 + 1; i5 < i3 && keyframeArr[i5].getFraction() < 0.0f; i5++) {
                                i4 = i5;
                            }
                            KQgRr5e_0(keyframeArr, keyframeArr[i4 + 1].getFraction() - keyframeArr[i2 - 1].getFraction(), i2, i4);
                        }
                    }
                }
            }
            propertyValuesHolder = PropertyValuesHolder.ofKeyframe(str, keyframeArr);
            if (i == 3) {
                propertyValuesHolder.setEvaluator(IFxWkV_5.KQgRr5e_0());
            }
        }
        return propertyValuesHolder;
    }

    public static Keyframe KQgRr5e_0(Keyframe keyframe, float f) {
        if (keyframe.getType() == Float.TYPE) {
            return Keyframe.ofFloat(f);
        }
        if (keyframe.getType() == Integer.TYPE) {
            return Keyframe.ofInt(f);
        }
        return Keyframe.ofObject(f);
    }

    public static void KQgRr5e_0(Keyframe[] keyframeArr, float f, int i, int i2) {
        float f2 = f / ((i2 - i) + 2);
        while (i <= i2) {
            keyframeArr[i].setFraction(keyframeArr[i - 1].getFraction() + f2);
            i++;
        }
    }

    public static Keyframe KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, int i, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        Keyframe ofInt;
        TypedArray KQgRr5e_02 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(resources, theme, attributeSet, X6FRs_4.NQvZgp_17.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0.f3236XnFJ5_9);
        float KQgRr5e_03 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(KQgRr5e_02, xmlPullParser, "fraction", 3, -1.0f);
        TypedValue KQgRr5e_04 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(KQgRr5e_02, xmlPullParser, "value", 0);
        boolean z = KQgRr5e_04 != null;
        if (i == 4) {
            i = (z && KQgRr5e_0(KQgRr5e_04.type)) ? 3 : 0;
        }
        if (z) {
            if (i != 0) {
                ofInt = (i == 1 || i == 3) ? Keyframe.ofInt(KQgRr5e_03, X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.QxJ9d_1(KQgRr5e_02, xmlPullParser, "value", 0, 0)) : null;
            } else {
                ofInt = Keyframe.ofFloat(KQgRr5e_03, X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(KQgRr5e_02, xmlPullParser, "value", 0, 0.0f));
            }
        } else if (i == 0) {
            ofInt = Keyframe.ofFloat(KQgRr5e_03);
        } else {
            ofInt = Keyframe.ofInt(KQgRr5e_03);
        }
        int PGPF6hQ_2 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.PGPF6hQ_2(KQgRr5e_02, xmlPullParser, "interpolator", 1, 0);
        if (PGPF6hQ_2 > 0) {
            ofInt.setInterpolator(Mqv2r_3.KQgRr5e_0(context, PGPF6hQ_2));
        }
        KQgRr5e_02.recycle();
        return ofInt;
    }

    public static ObjectAnimator KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, float f, XmlPullParser xmlPullParser) throws Resources.NotFoundException {
        ObjectAnimator objectAnimator = new ObjectAnimator();
        KQgRr5e_0(context, resources, theme, attributeSet, objectAnimator, f, xmlPullParser);
        return objectAnimator;
    }

    public static ValueAnimator KQgRr5e_0(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, ValueAnimator valueAnimator, float f, XmlPullParser xmlPullParser) throws Resources.NotFoundException {
        TypedArray KQgRr5e_02 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(resources, theme, attributeSet, X6FRs_4.NQvZgp_17.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0.f3230IMuAHx_6);
        TypedArray KQgRr5e_03 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.KQgRr5e_0(resources, theme, attributeSet, X6FRs_4.NQvZgp_17.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0.f3233Nm6q_10);
        if (valueAnimator == null) {
            valueAnimator = new ValueAnimator();
        }
        KQgRr5e_0(valueAnimator, KQgRr5e_02, KQgRr5e_03, f, xmlPullParser);
        int PGPF6hQ_2 = X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IMuAHx_6.PGPF6hQ_2(KQgRr5e_02, xmlPullParser, "interpolator", 0, 0);
        if (PGPF6hQ_2 > 0) {
            valueAnimator.setInterpolator(Mqv2r_3.KQgRr5e_0(context, PGPF6hQ_2));
        }
        KQgRr5e_02.recycle();
        if (KQgRr5e_03 != null) {
            KQgRr5e_03.recycle();
        }
        return valueAnimator;
    }
}
