package android.support.v4.app;

import android.R;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.os.Parcelable;
import android.support.v4.app.e;
import android.support.v4.app.j;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.ScaleAnimation;
import android.view.animation.Transformation;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/* JADX INFO: compiled from: FragmentManager.java */
/* JADX INFO: loaded from: classes.dex */
final class k extends android.support.v4.app.j implements LayoutInflater.Factory2 {
    static boolean F = false;
    static Field G;
    static final Interpolator H = new DecelerateInterpolator(2.5f);
    static final Interpolator I = new DecelerateInterpolator(1.5f);
    ArrayList<m> C;
    android.support.v4.app.l D;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    ArrayList<l> f542b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    boolean f543c;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    SparseArray<android.support.v4.app.e> f546f;
    ArrayList<android.support.v4.app.c> g;
    ArrayList<android.support.v4.app.e> h;
    ArrayList<android.support.v4.app.c> i;
    ArrayList<Integer> j;
    ArrayList<j.b> k;
    android.support.v4.app.i n;
    android.support.v4.app.g o;
    android.support.v4.app.e p;
    android.support.v4.app.e q;
    boolean r;
    boolean s;
    boolean t;
    boolean u;
    String v;
    boolean w;
    ArrayList<android.support.v4.app.c> x;
    ArrayList<Boolean> y;
    ArrayList<android.support.v4.app.e> z;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    int f544d = 0;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    final ArrayList<android.support.v4.app.e> f545e = new ArrayList<>();
    private final CopyOnWriteArrayList<j> l = new CopyOnWriteArrayList<>();
    int m = 0;
    Bundle A = null;
    SparseArray<Parcelable> B = null;
    Runnable E = new a();

    /* JADX INFO: compiled from: FragmentManager.java */
    class a implements Runnable {
        a() {
        }

        @Override // java.lang.Runnable
        public void run() {
            k.this.a0();
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    class b extends f {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ ViewGroup f548b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        final /* synthetic */ android.support.v4.app.e f549c;

        /* JADX INFO: compiled from: FragmentManager.java */
        class a implements Runnable {
            a() {
            }

            @Override // java.lang.Runnable
            public void run() {
                if (b.this.f549c.j() != null) {
                    b.this.f549c.R0(null);
                    b bVar = b.this;
                    k kVar = k.this;
                    android.support.v4.app.e eVar = bVar.f549c;
                    kVar.C0(eVar, eVar.B(), 0, 0, false);
                }
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(Animation.AnimationListener animationListener, ViewGroup viewGroup, android.support.v4.app.e eVar) {
            super(animationListener);
            this.f548b = viewGroup;
            this.f549c = eVar;
        }

        @Override // android.support.v4.app.k.f, android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            super.onAnimationEnd(animation);
            this.f548b.post(new a());
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    class c extends AnimatorListenerAdapter {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        final /* synthetic */ ViewGroup f552a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ View f553b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        final /* synthetic */ android.support.v4.app.e f554c;

        c(ViewGroup viewGroup, View view, android.support.v4.app.e eVar) {
            this.f552a = viewGroup;
            this.f553b = view;
            this.f554c = eVar;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            this.f552a.endViewTransition(this.f553b);
            Animator animatorK = this.f554c.k();
            this.f554c.S0(null);
            if (animatorK == null || this.f552a.indexOfChild(this.f553b) >= 0) {
                return;
            }
            k kVar = k.this;
            android.support.v4.app.e eVar = this.f554c;
            kVar.C0(eVar, eVar.B(), 0, 0, false);
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    class d extends AnimatorListenerAdapter {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        final /* synthetic */ ViewGroup f556a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ View f557b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        final /* synthetic */ android.support.v4.app.e f558c;

        d(k kVar, ViewGroup viewGroup, View view, android.support.v4.app.e eVar) {
            this.f556a = viewGroup;
            this.f557b = view;
            this.f558c = eVar;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            this.f556a.endViewTransition(this.f557b);
            animator.removeListener(this);
            View view = this.f558c.J;
            if (view != null) {
                view.setVisibility(8);
            }
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    private static class e extends f {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        View f559b;

        /* JADX INFO: compiled from: FragmentManager.java */
        class a implements Runnable {
            a() {
            }

            @Override // java.lang.Runnable
            public void run() {
                e.this.f559b.setLayerType(0, null);
            }
        }

        e(View view, Animation.AnimationListener animationListener) {
            super(animationListener);
            this.f559b = view;
        }

        @Override // android.support.v4.app.k.f, android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            if (a.b.c.g.p.l(this.f559b) || Build.VERSION.SDK_INT >= 24) {
                this.f559b.post(new a());
            } else {
                this.f559b.setLayerType(0, null);
            }
            super.onAnimationEnd(animation);
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    private static class f implements Animation.AnimationListener {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        private final Animation.AnimationListener f561a;

        f(Animation.AnimationListener animationListener) {
            this.f561a = animationListener;
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            Animation.AnimationListener animationListener = this.f561a;
            if (animationListener != null) {
                animationListener.onAnimationEnd(animation);
            }
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationRepeat(Animation animation) {
            Animation.AnimationListener animationListener = this.f561a;
            if (animationListener != null) {
                animationListener.onAnimationRepeat(animation);
            }
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationStart(Animation animation) {
            Animation.AnimationListener animationListener = this.f561a;
            if (animationListener != null) {
                animationListener.onAnimationStart(animation);
            }
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    private static class h extends AnimatorListenerAdapter {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        View f564a;

        h(View view) {
            this.f564a = view;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            this.f564a.setLayerType(0, null);
            animator.removeListener(this);
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationStart(Animator animator) {
            this.f564a.setLayerType(2, null);
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    private static final class j {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        final j.a f570a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final boolean f571b;
    }

    /* JADX INFO: renamed from: android.support.v4.app.k$k, reason: collision with other inner class name */
    /* JADX INFO: compiled from: FragmentManager.java */
    static class C0020k {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        public static final int[] f572a = {R.attr.name, R.attr.id, R.attr.tag};
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    interface l {
        boolean a(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2);
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    static class m implements e.f {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        final boolean f573a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final android.support.v4.app.c f574b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private int f575c;

        m(android.support.v4.app.c cVar, boolean z) {
            this.f573a = z;
            this.f574b = cVar;
        }

        @Override // android.support.v4.app.e.f
        public void a() {
            int i = this.f575c - 1;
            this.f575c = i;
            if (i != 0) {
                return;
            }
            this.f574b.f494a.T0();
        }

        @Override // android.support.v4.app.e.f
        public void b() {
            this.f575c++;
        }

        public void c() {
            android.support.v4.app.c cVar = this.f574b;
            cVar.f494a.n(cVar, this.f573a, false, false);
        }

        public void d() {
            boolean z = this.f575c > 0;
            k kVar = this.f574b.f494a;
            int size = kVar.f545e.size();
            for (int i = 0; i < size; i++) {
                android.support.v4.app.e eVar = kVar.f545e.get(i);
                eVar.Y0(null);
                if (z && eVar.I()) {
                    eVar.a1();
                }
            }
            android.support.v4.app.c cVar = this.f574b;
            cVar.f494a.n(cVar, this.f573a, !z, true);
        }

        public boolean e() {
            return this.f575c == 0;
        }
    }

    static {
        new AccelerateInterpolator(2.5f);
        new AccelerateInterpolator(1.5f);
    }

    k() {
    }

    private boolean F0(String str, int i2, int i3) {
        android.support.v4.app.j jVarS0;
        a0();
        Y(true);
        android.support.v4.app.e eVar = this.q;
        if (eVar != null && i2 < 0 && str == null && (jVarS0 = eVar.s0()) != null && jVarS0.d()) {
            return true;
        }
        boolean zG0 = G0(this.x, this.y, str, i2, i3);
        if (zG0) {
            this.f543c = true;
            try {
                K0(this.x, this.y);
            } finally {
                m();
            }
        }
        W();
        k();
        return zG0;
    }

    private int H0(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2, int i2, int i3, a.b.c.f.b<android.support.v4.app.e> bVar) {
        int i4 = i3;
        for (int i5 = i3 - 1; i5 >= i2; i5--) {
            android.support.v4.app.c cVar = arrayList.get(i5);
            boolean zBooleanValue = arrayList2.get(i5).booleanValue();
            if (cVar.m() && !cVar.k(arrayList, i5 + 1, i3)) {
                if (this.C == null) {
                    this.C = new ArrayList<>();
                }
                m mVar = new m(cVar, zBooleanValue);
                this.C.add(mVar);
                cVar.o(mVar);
                if (zBooleanValue) {
                    cVar.f();
                } else {
                    cVar.g(false);
                }
                i4--;
                if (i5 != i4) {
                    arrayList.remove(i5);
                    arrayList.add(i4, cVar);
                }
                e(bVar);
            }
        }
        return i4;
    }

    private void K0(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2) {
        if (arrayList == null || arrayList.isEmpty()) {
            return;
        }
        if (arrayList2 == null || arrayList.size() != arrayList2.size()) {
            throw new IllegalStateException("Internal error with the back stack records");
        }
        d0(arrayList, arrayList2);
        int size = arrayList.size();
        int i2 = 0;
        int i3 = 0;
        while (i2 < size) {
            if (!arrayList.get(i2).s) {
                if (i3 != i2) {
                    c0(arrayList, arrayList2, i3, i2);
                }
                i3 = i2 + 1;
                if (arrayList2.get(i2).booleanValue()) {
                    while (i3 < size && arrayList2.get(i3).booleanValue() && !arrayList.get(i3).s) {
                        i3++;
                    }
                }
                c0(arrayList, arrayList2, i2, i3);
                i2 = i3 - 1;
            }
            i2++;
        }
        if (i3 != size) {
            c0(arrayList, arrayList2, i3, size);
        }
    }

    public static int O0(int i2) {
        if (i2 == 4097) {
            return 8194;
        }
        if (i2 != 4099) {
            return i2 != 8194 ? 0 : 4097;
        }
        return 4099;
    }

    private void U(int i2) {
        try {
            this.f543c = true;
            A0(i2, false);
            this.f543c = false;
            a0();
        } catch (Throwable th) {
            this.f543c = false;
            throw th;
        }
    }

    private static void V0(View view, g gVar) {
        if (view == null || gVar == null || !Y0(view, gVar)) {
            return;
        }
        Animator animator = gVar.f563b;
        if (animator != null) {
            animator.addListener(new h(view));
            return;
        }
        Animation.AnimationListener animationListenerL0 = l0(gVar.f562a);
        view.setLayerType(2, null);
        gVar.f562a.setAnimationListener(new e(view, animationListenerL0));
    }

    private void X() {
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        int size = sparseArray == null ? 0 : sparseArray.size();
        for (int i2 = 0; i2 < size; i2++) {
            android.support.v4.app.e eVarValueAt = this.f546f.valueAt(i2);
            if (eVarValueAt != null) {
                if (eVarValueAt.j() != null) {
                    int iB = eVarValueAt.B();
                    View viewJ = eVarValueAt.j();
                    Animation animation = viewJ.getAnimation();
                    if (animation != null) {
                        animation.cancel();
                        viewJ.clearAnimation();
                    }
                    eVarValueAt.R0(null);
                    C0(eVarValueAt, iB, 0, 0, false);
                } else if (eVarValueAt.k() != null) {
                    eVarValueAt.k().end();
                }
            }
        }
    }

    private static void X0(android.support.v4.app.l lVar) {
        if (lVar == null) {
            return;
        }
        List<android.support.v4.app.e> listB = lVar.b();
        if (listB != null) {
            Iterator<android.support.v4.app.e> it = listB.iterator();
            while (it.hasNext()) {
                it.next().E = true;
            }
        }
        List<android.support.v4.app.l> listA = lVar.a();
        if (listA != null) {
            Iterator<android.support.v4.app.l> it2 = listA.iterator();
            while (it2.hasNext()) {
                X0(it2.next());
            }
        }
    }

    private void Y(boolean z) {
        if (this.f543c) {
            throw new IllegalStateException("FragmentManager is already executing transactions");
        }
        if (this.n == null) {
            throw new IllegalStateException("Fragment host has been destroyed");
        }
        if (Looper.myLooper() != this.n.g().getLooper()) {
            throw new IllegalStateException("Must be called from main thread of fragment host");
        }
        if (!z) {
            l();
        }
        if (this.x == null) {
            this.x = new ArrayList<>();
            this.y = new ArrayList<>();
        }
        this.f543c = true;
        try {
            d0(null, null);
        } finally {
            this.f543c = false;
        }
    }

    static boolean Y0(View view, g gVar) {
        return view != null && gVar != null && Build.VERSION.SDK_INT >= 19 && view.getLayerType() == 0 && a.b.c.g.p.k(view) && y0(gVar);
    }

    private static void b0(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2, int i2, int i3) {
        while (i2 < i3) {
            android.support.v4.app.c cVar = arrayList.get(i2);
            if (arrayList2.get(i2).booleanValue()) {
                cVar.c(-1);
                cVar.g(i2 == i3 + (-1));
            } else {
                cVar.c(1);
                cVar.f();
            }
            i2++;
        }
    }

    private void b1(RuntimeException runtimeException) {
        Log.e("FragmentManager", runtimeException.getMessage());
        Log.e("FragmentManager", "Activity state:");
        PrintWriter printWriter = new PrintWriter(new a.b.c.f.e("FragmentManager"));
        android.support.v4.app.i iVar = this.n;
        if (iVar != null) {
            try {
                iVar.i("  ", null, printWriter, new String[0]);
                throw runtimeException;
            } catch (Exception e2) {
                Log.e("FragmentManager", "Failed dumping state", e2);
                throw runtimeException;
            }
        }
        try {
            a("  ", null, printWriter, new String[0]);
            throw runtimeException;
        } catch (Exception e3) {
            Log.e("FragmentManager", "Failed dumping state", e3);
            throw runtimeException;
        }
    }

    private void c0(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2, int i2, int i3) {
        int i4;
        int i5;
        int i6 = i2;
        boolean z = arrayList.get(i6).s;
        ArrayList<android.support.v4.app.e> arrayList3 = this.z;
        if (arrayList3 == null) {
            this.z = new ArrayList<>();
        } else {
            arrayList3.clear();
        }
        this.z.addAll(this.f545e);
        android.support.v4.app.e eVarO0 = o0();
        boolean z2 = false;
        for (int i7 = i6; i7 < i3; i7++) {
            android.support.v4.app.c cVar = arrayList.get(i7);
            eVarO0 = !arrayList2.get(i7).booleanValue() ? cVar.h(this.z, eVarO0) : cVar.p(this.z, eVarO0);
            z2 = z2 || cVar.i;
        }
        this.z.clear();
        if (!z) {
            p.C(this, arrayList, arrayList2, i2, i3, false);
        }
        b0(arrayList, arrayList2, i2, i3);
        if (z) {
            a.b.c.f.b<android.support.v4.app.e> bVar = new a.b.c.f.b<>();
            e(bVar);
            int iH0 = H0(arrayList, arrayList2, i2, i3, bVar);
            w0(bVar);
            i4 = iH0;
        } else {
            i4 = i3;
        }
        if (i4 != i6 && z) {
            p.C(this, arrayList, arrayList2, i2, i4, true);
            A0(this.m, true);
        }
        while (i6 < i3) {
            android.support.v4.app.c cVar2 = arrayList.get(i6);
            if (arrayList2.get(i6).booleanValue() && (i5 = cVar2.l) >= 0) {
                j0(i5);
                cVar2.l = -1;
            }
            cVar2.n();
            i6++;
        }
        if (z2) {
            L0();
        }
    }

    public static int c1(int i2, boolean z) {
        if (i2 == 4097) {
            return z ? 1 : 2;
        }
        if (i2 == 4099) {
            return z ? 5 : 6;
        }
        if (i2 != 8194) {
            return -1;
        }
        return z ? 3 : 4;
    }

    private void d0(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2) {
        int iIndexOf;
        int iIndexOf2;
        ArrayList<m> arrayList3 = this.C;
        int size = arrayList3 == null ? 0 : arrayList3.size();
        int i2 = 0;
        while (i2 < size) {
            m mVar = this.C.get(i2);
            if (arrayList != null && !mVar.f573a && (iIndexOf2 = arrayList.indexOf(mVar.f574b)) != -1 && arrayList2.get(iIndexOf2).booleanValue()) {
                mVar.c();
            } else if (mVar.e() || (arrayList != null && mVar.f574b.k(arrayList, 0, arrayList.size()))) {
                this.C.remove(i2);
                i2--;
                size--;
                if (arrayList == null || mVar.f573a || (iIndexOf = arrayList.indexOf(mVar.f574b)) == -1 || !arrayList2.get(iIndexOf).booleanValue()) {
                    mVar.d();
                } else {
                    mVar.c();
                }
            }
            i2++;
        }
    }

    private void e(a.b.c.f.b<android.support.v4.app.e> bVar) {
        int i2 = this.m;
        if (i2 < 1) {
            return;
        }
        int iMin = Math.min(i2, 3);
        int size = this.f545e.size();
        for (int i3 = 0; i3 < size; i3++) {
            android.support.v4.app.e eVar = this.f545e.get(i3);
            if (eVar.f514b < iMin) {
                C0(eVar, iMin, eVar.t(), eVar.u(), false);
                if (eVar.J != null && !eVar.B && eVar.O) {
                    bVar.add(eVar);
                }
            }
        }
    }

    private void h(android.support.v4.app.e eVar, g gVar, int i2) {
        View view = eVar.J;
        ViewGroup viewGroup = eVar.I;
        viewGroup.startViewTransition(view);
        eVar.Z0(i2);
        if (gVar.f562a != null) {
            i iVar = new i(gVar.f562a, viewGroup, view);
            eVar.R0(eVar.J);
            iVar.setAnimationListener(new b(l0(iVar), viewGroup, eVar));
            V0(view, gVar);
            eVar.J.startAnimation(iVar);
            return;
        }
        Animator animator = gVar.f563b;
        eVar.S0(animator);
        animator.addListener(new c(viewGroup, view, eVar));
        animator.setTarget(eVar.J);
        V0(eVar.J, gVar);
        animator.start();
    }

    private android.support.v4.app.e h0(android.support.v4.app.e eVar) {
        ViewGroup viewGroup = eVar.I;
        View view = eVar.J;
        if (viewGroup != null && view != null) {
            for (int iIndexOf = this.f545e.indexOf(eVar) - 1; iIndexOf >= 0; iIndexOf--) {
                android.support.v4.app.e eVar2 = this.f545e.get(iIndexOf);
                if (eVar2.I == viewGroup && eVar2.J != null) {
                    return eVar2;
                }
            }
        }
        return null;
    }

    private void i0() {
        if (this.C != null) {
            while (!this.C.isEmpty()) {
                this.C.remove(0).d();
            }
        }
    }

    private void k() {
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        if (sparseArray != null) {
            for (int size = sparseArray.size() - 1; size >= 0; size--) {
                if (this.f546f.valueAt(size) == null) {
                    SparseArray<android.support.v4.app.e> sparseArray2 = this.f546f;
                    sparseArray2.delete(sparseArray2.keyAt(size));
                }
            }
        }
    }

    private boolean k0(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2) {
        synchronized (this) {
            if (this.f542b != null && this.f542b.size() != 0) {
                int size = this.f542b.size();
                boolean zA = false;
                for (int i2 = 0; i2 < size; i2++) {
                    zA |= this.f542b.get(i2).a(arrayList, arrayList2);
                }
                this.f542b.clear();
                this.n.g().removeCallbacks(this.E);
                return zA;
            }
            return false;
        }
    }

    private void l() {
        if (c()) {
            throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
        }
        if (this.v == null) {
            return;
        }
        throw new IllegalStateException("Can not perform this action inside of " + this.v);
    }

    private static Animation.AnimationListener l0(Animation animation) {
        try {
            if (G == null) {
                Field declaredField = Animation.class.getDeclaredField("mListener");
                G = declaredField;
                declaredField.setAccessible(true);
            }
            return (Animation.AnimationListener) G.get(animation);
        } catch (IllegalAccessException e2) {
            Log.e("FragmentManager", "Cannot access Animation's mListener field", e2);
            return null;
        } catch (NoSuchFieldException e3) {
            Log.e("FragmentManager", "No field with the name mListener is found in Animation class", e3);
            return null;
        }
    }

    private void m() {
        this.f543c = false;
        this.y.clear();
        this.x.clear();
    }

    static g t0(Context context, float f2, float f3) {
        AlphaAnimation alphaAnimation = new AlphaAnimation(f2, f3);
        alphaAnimation.setInterpolator(I);
        alphaAnimation.setDuration(220L);
        return new g(alphaAnimation);
    }

    static g v0(Context context, float f2, float f3, float f4, float f5) {
        AnimationSet animationSet = new AnimationSet(false);
        ScaleAnimation scaleAnimation = new ScaleAnimation(f2, f3, f2, f3, 1, 0.5f, 1, 0.5f);
        scaleAnimation.setInterpolator(H);
        scaleAnimation.setDuration(220L);
        animationSet.addAnimation(scaleAnimation);
        AlphaAnimation alphaAnimation = new AlphaAnimation(f4, f5);
        alphaAnimation.setInterpolator(I);
        alphaAnimation.setDuration(220L);
        animationSet.addAnimation(alphaAnimation);
        return new g(animationSet);
    }

    private void w0(a.b.c.f.b<android.support.v4.app.e> bVar) {
        int size = bVar.size();
        for (int i2 = 0; i2 < size; i2++) {
            android.support.v4.app.e eVarH = bVar.h(i2);
            if (!eVarH.l) {
                View viewC = eVarH.C();
                eVarH.Q = viewC.getAlpha();
                viewC.setAlpha(0.0f);
            }
        }
    }

    static boolean x0(Animator animator) {
        if (animator == null) {
            return false;
        }
        if (animator instanceof ValueAnimator) {
            for (PropertyValuesHolder propertyValuesHolder : ((ValueAnimator) animator).getValues()) {
                if ("alpha".equals(propertyValuesHolder.getPropertyName())) {
                    return true;
                }
            }
        } else if (animator instanceof AnimatorSet) {
            ArrayList<Animator> childAnimations = ((AnimatorSet) animator).getChildAnimations();
            for (int i2 = 0; i2 < childAnimations.size(); i2++) {
                if (x0(childAnimations.get(i2))) {
                    return true;
                }
            }
        }
        return false;
    }

    static boolean y0(g gVar) {
        Animation animation = gVar.f562a;
        if (animation instanceof AlphaAnimation) {
            return true;
        }
        if (!(animation instanceof AnimationSet)) {
            return x0(gVar.f563b);
        }
        List<Animation> animations = ((AnimationSet) animation).getAnimations();
        for (int i2 = 0; i2 < animations.size(); i2++) {
            if (animations.get(i2) instanceof AlphaAnimation) {
                return true;
            }
        }
        return false;
    }

    void A(android.support.v4.app.e eVar, Context context, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).A(eVar, context, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.b(this, eVar, context);
            }
        }
    }

    void A0(int i2, boolean z) {
        android.support.v4.app.i iVar;
        if (this.n == null && i2 != 0) {
            throw new IllegalStateException("No activity");
        }
        if (z || i2 != this.m) {
            this.m = i2;
            if (this.f546f != null) {
                int size = this.f545e.size();
                for (int i3 = 0; i3 < size; i3++) {
                    z0(this.f545e.get(i3));
                }
                int size2 = this.f546f.size();
                for (int i4 = 0; i4 < size2; i4++) {
                    android.support.v4.app.e eVarValueAt = this.f546f.valueAt(i4);
                    if (eVarValueAt != null && ((eVarValueAt.m || eVarValueAt.C) && !eVarValueAt.O)) {
                        z0(eVarValueAt);
                    }
                }
                a1();
                if (this.r && (iVar = this.n) != null && this.m == 4) {
                    iVar.n();
                    this.r = false;
                }
            }
        }
    }

    void B(android.support.v4.app.e eVar, Bundle bundle, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).B(eVar, bundle, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.c(this, eVar, bundle);
            }
        }
    }

    void B0(android.support.v4.app.e eVar) {
        C0(eVar, this.m, 0, 0, false);
    }

    void C(android.support.v4.app.e eVar, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).C(eVar, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.d(this, eVar);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:134:0x0292  */
    /* JADX WARN: Removed duplicated region for block: B:139:0x02b2  */
    /* JADX WARN: Removed duplicated region for block: B:191:0x03a6  */
    /* JADX WARN: Removed duplicated region for block: B:221:0x041d  */
    /* JADX WARN: Removed duplicated region for block: B:225:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    void C0(android.support.v4.app.e r17, int r18, int r19, int r20, boolean r21) {
        /*
            Method dump skipped, instruction units count: 1099
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: android.support.v4.app.k.C0(android.support.v4.app.e, int, int, int, boolean):void");
    }

    void D(android.support.v4.app.e eVar, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).D(eVar, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.e(this, eVar);
            }
        }
    }

    public void D0() {
        this.D = null;
        this.s = false;
        this.t = false;
        int size = this.f545e.size();
        for (int i2 = 0; i2 < size; i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null) {
                eVar.L();
            }
        }
    }

    void E(android.support.v4.app.e eVar, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).E(eVar, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.f(this, eVar);
            }
        }
    }

    public void E0(android.support.v4.app.e eVar) {
        if (eVar.L) {
            if (this.f543c) {
                this.w = true;
            } else {
                eVar.L = false;
                C0(eVar, this.m, 0, 0, false);
            }
        }
    }

    void F(android.support.v4.app.e eVar, Context context, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).F(eVar, context, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.g(this, eVar, context);
            }
        }
    }

    void G(android.support.v4.app.e eVar, Bundle bundle, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).G(eVar, bundle, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.h(this, eVar, bundle);
            }
        }
    }

    boolean G0(ArrayList<android.support.v4.app.c> arrayList, ArrayList<Boolean> arrayList2, String str, int i2, int i3) {
        int i4;
        ArrayList<android.support.v4.app.c> arrayList3 = this.g;
        if (arrayList3 == null) {
            return false;
        }
        if (str == null && i2 < 0 && (i3 & 1) == 0) {
            int size = arrayList3.size() - 1;
            if (size < 0) {
                return false;
            }
            arrayList.add(this.g.remove(size));
            arrayList2.add(Boolean.TRUE);
        } else {
            if (str != null || i2 >= 0) {
                int size2 = this.g.size() - 1;
                while (size2 >= 0) {
                    android.support.v4.app.c cVar = this.g.get(size2);
                    if ((str != null && str.equals(cVar.i())) || (i2 >= 0 && i2 == cVar.l)) {
                        break;
                    }
                    size2--;
                }
                if (size2 < 0) {
                    return false;
                }
                if ((i3 & 1) != 0) {
                    while (true) {
                        size2--;
                        if (size2 < 0) {
                            break;
                        }
                        android.support.v4.app.c cVar2 = this.g.get(size2);
                        if (str == null || !str.equals(cVar2.i())) {
                            if (i2 < 0 || i2 != cVar2.l) {
                                break;
                            }
                        }
                    }
                }
                i4 = size2;
            } else {
                i4 = -1;
            }
            if (i4 == this.g.size() - 1) {
                return false;
            }
            for (int size3 = this.g.size() - 1; size3 > i4; size3--) {
                arrayList.add(this.g.remove(size3));
                arrayList2.add(Boolean.TRUE);
            }
        }
        return true;
    }

    void H(android.support.v4.app.e eVar, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).H(eVar, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.i(this, eVar);
            }
        }
    }

    void I(android.support.v4.app.e eVar, Bundle bundle, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).I(eVar, bundle, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.j(this, eVar, bundle);
            }
        }
    }

    public void I0(Bundle bundle, String str, android.support.v4.app.e eVar) {
        int i2 = eVar.f518f;
        if (i2 >= 0) {
            bundle.putInt(str, i2);
            return;
        }
        b1(new IllegalStateException("Fragment " + eVar + " is not currently in the FragmentManager"));
        throw null;
    }

    void J(android.support.v4.app.e eVar, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).J(eVar, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.k(this, eVar);
            }
        }
    }

    public void J0(android.support.v4.app.e eVar) {
        if (F) {
            Log.v("FragmentManager", "remove: " + eVar + " nesting=" + eVar.r);
        }
        boolean z = !eVar.H();
        if (!eVar.C || z) {
            synchronized (this.f545e) {
                this.f545e.remove(eVar);
            }
            if (eVar.F && eVar.G) {
                this.r = true;
            }
            eVar.l = false;
            eVar.m = true;
        }
    }

    void K(android.support.v4.app.e eVar, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).K(eVar, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.l(this, eVar);
            }
        }
    }

    void L(android.support.v4.app.e eVar, View view, Bundle bundle, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).L(eVar, view, bundle, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.m(this, eVar, view, bundle);
            }
        }
    }

    void L0() {
        if (this.k != null) {
            for (int i2 = 0; i2 < this.k.size(); i2++) {
                this.k.get(i2).a();
            }
        }
    }

    void M(android.support.v4.app.e eVar, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).M(eVar, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.n(this, eVar);
            }
        }
    }

    void M0(Parcelable parcelable, android.support.v4.app.l lVar) {
        List<android.support.v4.app.l> listA;
        List<android.arch.lifecycle.p> listC;
        if (parcelable == null) {
            return;
        }
        android.support.v4.app.m mVar = (android.support.v4.app.m) parcelable;
        if (mVar.f579b == null) {
            return;
        }
        if (lVar != null) {
            List<android.support.v4.app.e> listB = lVar.b();
            listA = lVar.a();
            listC = lVar.c();
            int size = listB != null ? listB.size() : 0;
            for (int i2 = 0; i2 < size; i2++) {
                android.support.v4.app.e eVar = listB.get(i2);
                if (F) {
                    Log.v("FragmentManager", "restoreAllState: re-attaching retained " + eVar);
                }
                int i3 = 0;
                while (true) {
                    n[] nVarArr = mVar.f579b;
                    if (i3 >= nVarArr.length || nVarArr[i3].f585c == eVar.f518f) {
                        break;
                    } else {
                        i3++;
                    }
                }
                n[] nVarArr2 = mVar.f579b;
                if (i3 == nVarArr2.length) {
                    b1(new IllegalStateException("Could not find active fragment with index " + eVar.f518f));
                    throw null;
                }
                n nVar = nVarArr2[i3];
                nVar.m = eVar;
                eVar.f516d = null;
                eVar.r = 0;
                eVar.o = false;
                eVar.l = false;
                eVar.i = null;
                Bundle bundle = nVar.l;
                if (bundle != null) {
                    bundle.setClassLoader(this.n.e().getClassLoader());
                    eVar.f516d = nVar.l.getSparseParcelableArray("android:view_state");
                    eVar.f515c = nVar.l;
                }
            }
        } else {
            listA = null;
            listC = null;
        }
        this.f546f = new SparseArray<>(mVar.f579b.length);
        int i4 = 0;
        while (true) {
            n[] nVarArr3 = mVar.f579b;
            if (i4 >= nVarArr3.length) {
                break;
            }
            n nVar2 = nVarArr3[i4];
            if (nVar2 != null) {
                android.support.v4.app.e eVarA = nVar2.a(this.n, this.o, this.p, (listA == null || i4 >= listA.size()) ? null : listA.get(i4), (listC == null || i4 >= listC.size()) ? null : listC.get(i4));
                if (F) {
                    Log.v("FragmentManager", "restoreAllState: active #" + i4 + ": " + eVarA);
                }
                this.f546f.put(eVarA.f518f, eVarA);
                nVar2.m = null;
            }
            i4++;
        }
        if (lVar != null) {
            List<android.support.v4.app.e> listB2 = lVar.b();
            int size2 = listB2 != null ? listB2.size() : 0;
            for (int i5 = 0; i5 < size2; i5++) {
                android.support.v4.app.e eVar2 = listB2.get(i5);
                int i6 = eVar2.j;
                if (i6 >= 0) {
                    android.support.v4.app.e eVar3 = this.f546f.get(i6);
                    eVar2.i = eVar3;
                    if (eVar3 == null) {
                        Log.w("FragmentManager", "Re-attaching retained fragment " + eVar2 + " target no longer exists: " + eVar2.j);
                    }
                }
            }
        }
        this.f545e.clear();
        if (mVar.f580c != null) {
            int i7 = 0;
            while (true) {
                int[] iArr = mVar.f580c;
                if (i7 >= iArr.length) {
                    break;
                }
                android.support.v4.app.e eVar4 = this.f546f.get(iArr[i7]);
                if (eVar4 == null) {
                    b1(new IllegalStateException("No instantiated fragment for index #" + mVar.f580c[i7]));
                    throw null;
                }
                eVar4.l = true;
                if (F) {
                    Log.v("FragmentManager", "restoreAllState: added #" + i7 + ": " + eVar4);
                }
                if (this.f545e.contains(eVar4)) {
                    throw new IllegalStateException("Already added!");
                }
                synchronized (this.f545e) {
                    this.f545e.add(eVar4);
                }
                i7++;
            }
        }
        if (mVar.f581d != null) {
            this.g = new ArrayList<>(mVar.f581d.length);
            int i8 = 0;
            while (true) {
                android.support.v4.app.d[] dVarArr = mVar.f581d;
                if (i8 >= dVarArr.length) {
                    break;
                }
                android.support.v4.app.c cVarA = dVarArr[i8].a(this);
                if (F) {
                    Log.v("FragmentManager", "restoreAllState: back stack #" + i8 + " (index " + cVarA.l + "): " + cVarA);
                    PrintWriter printWriter = new PrintWriter(new a.b.c.f.e("FragmentManager"));
                    cVarA.e("  ", printWriter, false);
                    printWriter.close();
                }
                this.g.add(cVarA);
                int i9 = cVarA.l;
                if (i9 >= 0) {
                    U0(i9, cVarA);
                }
                i8++;
            }
        } else {
            this.g = null;
        }
        int i10 = mVar.f582e;
        if (i10 >= 0) {
            this.q = this.f546f.get(i10);
        }
        this.f544d = mVar.f583f;
    }

    public boolean N(MenuItem menuItem) {
        if (this.m < 1) {
            return false;
        }
        for (int i2 = 0; i2 < this.f545e.size(); i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null && eVar.F0(menuItem)) {
                return true;
            }
        }
        return false;
    }

    android.support.v4.app.l N0() {
        X0(this.D);
        return this.D;
    }

    public void O(Menu menu) {
        if (this.m < 1) {
            return;
        }
        for (int i2 = 0; i2 < this.f545e.size(); i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null) {
                eVar.G0(menu);
            }
        }
    }

    public void P() {
        U(3);
    }

    Parcelable P0() {
        int[] iArr;
        int size;
        i0();
        X();
        a0();
        this.s = true;
        android.support.v4.app.d[] dVarArr = null;
        this.D = null;
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        if (sparseArray == null || sparseArray.size() <= 0) {
            return null;
        }
        int size2 = this.f546f.size();
        n[] nVarArr = new n[size2];
        boolean z = false;
        for (int i2 = 0; i2 < size2; i2++) {
            android.support.v4.app.e eVarValueAt = this.f546f.valueAt(i2);
            if (eVarValueAt != null) {
                if (eVarValueAt.f518f < 0) {
                    b1(new IllegalStateException("Failure saving state: active " + eVarValueAt + " has cleared index: " + eVarValueAt.f518f));
                    throw null;
                }
                n nVar = new n(eVarValueAt);
                nVarArr[i2] = nVar;
                if (eVarValueAt.f514b <= 0 || nVar.l != null) {
                    nVar.l = eVarValueAt.f515c;
                } else {
                    Bundle bundleQ0 = Q0(eVarValueAt);
                    nVar.l = bundleQ0;
                    android.support.v4.app.e eVar = eVarValueAt.i;
                    if (eVar != null) {
                        if (eVar.f518f < 0) {
                            b1(new IllegalStateException("Failure saving state: " + eVarValueAt + " has target not in fragment manager: " + eVarValueAt.i));
                            throw null;
                        }
                        if (bundleQ0 == null) {
                            nVar.l = new Bundle();
                        }
                        I0(nVar.l, "android:target_state", eVarValueAt.i);
                        int i3 = eVarValueAt.k;
                        if (i3 != 0) {
                            nVar.l.putInt("android:target_req_state", i3);
                        }
                    }
                }
                if (F) {
                    Log.v("FragmentManager", "Saved state of " + eVarValueAt + ": " + nVar.l);
                }
                z = true;
            }
        }
        if (!z) {
            if (F) {
                Log.v("FragmentManager", "saveAllState: no fragments!");
            }
            return null;
        }
        int size3 = this.f545e.size();
        if (size3 > 0) {
            iArr = new int[size3];
            for (int i4 = 0; i4 < size3; i4++) {
                iArr[i4] = this.f545e.get(i4).f518f;
                if (iArr[i4] < 0) {
                    b1(new IllegalStateException("Failure saving state: active " + this.f545e.get(i4) + " has cleared index: " + iArr[i4]));
                    throw null;
                }
                if (F) {
                    Log.v("FragmentManager", "saveAllState: adding fragment #" + i4 + ": " + this.f545e.get(i4));
                }
            }
        } else {
            iArr = null;
        }
        ArrayList<android.support.v4.app.c> arrayList = this.g;
        if (arrayList != null && (size = arrayList.size()) > 0) {
            dVarArr = new android.support.v4.app.d[size];
            for (int i5 = 0; i5 < size; i5++) {
                dVarArr[i5] = new android.support.v4.app.d(this.g.get(i5));
                if (F) {
                    Log.v("FragmentManager", "saveAllState: adding back stack #" + i5 + ": " + this.g.get(i5));
                }
            }
        }
        android.support.v4.app.m mVar = new android.support.v4.app.m();
        mVar.f579b = nVarArr;
        mVar.f580c = iArr;
        mVar.f581d = dVarArr;
        android.support.v4.app.e eVar2 = this.q;
        if (eVar2 != null) {
            mVar.f582e = eVar2.f518f;
        }
        mVar.f583f = this.f544d;
        S0();
        return mVar;
    }

    public void Q(boolean z) {
        int size = this.f545e.size();
        while (true) {
            size--;
            if (size < 0) {
                return;
            }
            android.support.v4.app.e eVar = this.f545e.get(size);
            if (eVar != null) {
                eVar.I0(z);
            }
        }
    }

    Bundle Q0(android.support.v4.app.e eVar) {
        if (this.A == null) {
            this.A = new Bundle();
        }
        eVar.L0(this.A);
        I(eVar, this.A, false);
        Bundle bundle = null;
        if (!this.A.isEmpty()) {
            Bundle bundle2 = this.A;
            this.A = null;
            bundle = bundle2;
        }
        if (eVar.J != null) {
            R0(eVar);
        }
        if (eVar.f516d != null) {
            if (bundle == null) {
                bundle = new Bundle();
            }
            bundle.putSparseParcelableArray("android:view_state", eVar.f516d);
        }
        if (!eVar.M) {
            if (bundle == null) {
                bundle = new Bundle();
            }
            bundle.putBoolean("android:user_visible_hint", eVar.M);
        }
        return bundle;
    }

    public boolean R(Menu menu) {
        if (this.m < 1) {
            return false;
        }
        boolean z = false;
        for (int i2 = 0; i2 < this.f545e.size(); i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null && eVar.J0(menu)) {
                z = true;
            }
        }
        return z;
    }

    void R0(android.support.v4.app.e eVar) {
        if (eVar.K == null) {
            return;
        }
        SparseArray<Parcelable> sparseArray = this.B;
        if (sparseArray == null) {
            this.B = new SparseArray<>();
        } else {
            sparseArray.clear();
        }
        eVar.K.saveHierarchyState(this.B);
        if (this.B.size() > 0) {
            eVar.f516d = this.B;
            this.B = null;
        }
    }

    public void S() {
        this.s = false;
        this.t = false;
        U(4);
    }

    void S0() {
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        android.support.v4.app.l lVar;
        if (this.f546f != null) {
            arrayList = null;
            arrayList2 = null;
            arrayList3 = null;
            for (int i2 = 0; i2 < this.f546f.size(); i2++) {
                android.support.v4.app.e eVarValueAt = this.f546f.valueAt(i2);
                if (eVarValueAt != null) {
                    if (eVarValueAt.D) {
                        if (arrayList == null) {
                            arrayList = new ArrayList();
                        }
                        arrayList.add(eVarValueAt);
                        android.support.v4.app.e eVar = eVarValueAt.i;
                        eVarValueAt.j = eVar != null ? eVar.f518f : -1;
                        if (F) {
                            Log.v("FragmentManager", "retainNonConfig: keeping retained " + eVarValueAt);
                        }
                    }
                    k kVar = eVarValueAt.u;
                    if (kVar != null) {
                        kVar.S0();
                        lVar = eVarValueAt.u.D;
                    } else {
                        lVar = eVarValueAt.v;
                    }
                    if (arrayList2 == null && lVar != null) {
                        arrayList2 = new ArrayList(this.f546f.size());
                        for (int i3 = 0; i3 < i2; i3++) {
                            arrayList2.add(null);
                        }
                    }
                    if (arrayList2 != null) {
                        arrayList2.add(lVar);
                    }
                    if (arrayList3 == null && eVarValueAt.w != null) {
                        arrayList3 = new ArrayList(this.f546f.size());
                        for (int i4 = 0; i4 < i2; i4++) {
                            arrayList3.add(null);
                        }
                    }
                    if (arrayList3 != null) {
                        arrayList3.add(eVarValueAt.w);
                    }
                }
            }
        } else {
            arrayList = null;
            arrayList2 = null;
            arrayList3 = null;
        }
        if (arrayList == null && arrayList2 == null && arrayList3 == null) {
            this.D = null;
        } else {
            this.D = new android.support.v4.app.l(arrayList, arrayList2, arrayList3);
        }
    }

    public void T() {
        this.s = false;
        this.t = false;
        U(3);
    }

    void T0() {
        synchronized (this) {
            boolean z = false;
            boolean z2 = (this.C == null || this.C.isEmpty()) ? false : true;
            if (this.f542b != null && this.f542b.size() == 1) {
                z = true;
            }
            if (z2 || z) {
                this.n.g().removeCallbacks(this.E);
                this.n.g().post(this.E);
            }
        }
    }

    public void U0(int i2, android.support.v4.app.c cVar) {
        synchronized (this) {
            if (this.i == null) {
                this.i = new ArrayList<>();
            }
            int size = this.i.size();
            if (i2 < size) {
                if (F) {
                    Log.v("FragmentManager", "Setting back stack index " + i2 + " to " + cVar);
                }
                this.i.set(i2, cVar);
            } else {
                while (size < i2) {
                    this.i.add(null);
                    if (this.j == null) {
                        this.j = new ArrayList<>();
                    }
                    if (F) {
                        Log.v("FragmentManager", "Adding available back stack index " + size);
                    }
                    this.j.add(Integer.valueOf(size));
                    size++;
                }
                if (F) {
                    Log.v("FragmentManager", "Adding back stack index " + i2 + " with " + cVar);
                }
                this.i.add(cVar);
            }
        }
    }

    public void V() {
        this.t = true;
        U(2);
    }

    void W() {
        if (this.w) {
            this.w = false;
            a1();
        }
    }

    public void W0(android.support.v4.app.e eVar) {
        if (eVar == null || (this.f546f.get(eVar.f518f) == eVar && (eVar.t == null || eVar.r() == this))) {
            this.q = eVar;
            return;
        }
        throw new IllegalArgumentException("Fragment " + eVar + " is not an active fragment of FragmentManager " + this);
    }

    void Z(android.support.v4.app.e eVar) {
        if (!eVar.n || eVar.q) {
            return;
        }
        eVar.y0(eVar.C0(eVar.f515c), null, eVar.f515c);
        View view = eVar.J;
        if (view == null) {
            eVar.K = null;
            return;
        }
        eVar.K = view;
        view.setSaveFromParentEnabled(false);
        if (eVar.B) {
            eVar.J.setVisibility(8);
        }
        eVar.q0(eVar.J, eVar.f515c);
        L(eVar, eVar.J, eVar.f515c, false);
    }

    public void Z0(android.support.v4.app.e eVar) {
        if (F) {
            Log.v("FragmentManager", "show: " + eVar);
        }
        if (eVar.B) {
            eVar.B = false;
            eVar.P = !eVar.P;
        }
    }

    @Override // android.support.v4.app.j
    public void a(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
        int size;
        int size2;
        int size3;
        int size4;
        int size5;
        String str2 = str + "    ";
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        if (sparseArray != null && (size5 = sparseArray.size()) > 0) {
            printWriter.print(str);
            printWriter.print("Active Fragments in ");
            printWriter.print(Integer.toHexString(System.identityHashCode(this)));
            printWriter.println(":");
            for (int i2 = 0; i2 < size5; i2++) {
                android.support.v4.app.e eVarValueAt = this.f546f.valueAt(i2);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i2);
                printWriter.print(": ");
                printWriter.println(eVarValueAt);
                if (eVarValueAt != null) {
                    eVarValueAt.c(str2, fileDescriptor, printWriter, strArr);
                }
            }
        }
        int size6 = this.f545e.size();
        if (size6 > 0) {
            printWriter.print(str);
            printWriter.println("Added Fragments:");
            for (int i3 = 0; i3 < size6; i3++) {
                android.support.v4.app.e eVar = this.f545e.get(i3);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i3);
                printWriter.print(": ");
                printWriter.println(eVar.toString());
            }
        }
        ArrayList<android.support.v4.app.e> arrayList = this.h;
        if (arrayList != null && (size4 = arrayList.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Fragments Created Menus:");
            for (int i4 = 0; i4 < size4; i4++) {
                android.support.v4.app.e eVar2 = this.h.get(i4);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i4);
                printWriter.print(": ");
                printWriter.println(eVar2.toString());
            }
        }
        ArrayList<android.support.v4.app.c> arrayList2 = this.g;
        if (arrayList2 != null && (size3 = arrayList2.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Back Stack:");
            for (int i5 = 0; i5 < size3; i5++) {
                android.support.v4.app.c cVar = this.g.get(i5);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i5);
                printWriter.print(": ");
                printWriter.println(cVar.toString());
                cVar.d(str2, fileDescriptor, printWriter, strArr);
            }
        }
        synchronized (this) {
            if (this.i != null && (size2 = this.i.size()) > 0) {
                printWriter.print(str);
                printWriter.println("Back Stack Indices:");
                for (int i6 = 0; i6 < size2; i6++) {
                    Object obj = (android.support.v4.app.c) this.i.get(i6);
                    printWriter.print(str);
                    printWriter.print("  #");
                    printWriter.print(i6);
                    printWriter.print(": ");
                    printWriter.println(obj);
                }
            }
            if (this.j != null && this.j.size() > 0) {
                printWriter.print(str);
                printWriter.print("mAvailBackStackIndices: ");
                printWriter.println(Arrays.toString(this.j.toArray()));
            }
        }
        ArrayList<l> arrayList3 = this.f542b;
        if (arrayList3 != null && (size = arrayList3.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Pending Actions:");
            for (int i7 = 0; i7 < size; i7++) {
                Object obj2 = (l) this.f542b.get(i7);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i7);
                printWriter.print(": ");
                printWriter.println(obj2);
            }
        }
        printWriter.print(str);
        printWriter.println("FragmentManager misc state:");
        printWriter.print(str);
        printWriter.print("  mHost=");
        printWriter.println(this.n);
        printWriter.print(str);
        printWriter.print("  mContainer=");
        printWriter.println(this.o);
        if (this.p != null) {
            printWriter.print(str);
            printWriter.print("  mParent=");
            printWriter.println(this.p);
        }
        printWriter.print(str);
        printWriter.print("  mCurState=");
        printWriter.print(this.m);
        printWriter.print(" mStateSaved=");
        printWriter.print(this.s);
        printWriter.print(" mStopped=");
        printWriter.print(this.t);
        printWriter.print(" mDestroyed=");
        printWriter.println(this.u);
        if (this.r) {
            printWriter.print(str);
            printWriter.print("  mNeedMenuInvalidate=");
            printWriter.println(this.r);
        }
        if (this.v != null) {
            printWriter.print(str);
            printWriter.print("  mNoTransactionsBecause=");
            printWriter.println(this.v);
        }
    }

    public boolean a0() {
        Y(true);
        boolean z = false;
        while (k0(this.x, this.y)) {
            this.f543c = true;
            try {
                K0(this.x, this.y);
                m();
                z = true;
            } catch (Throwable th) {
                m();
                throw th;
            }
        }
        W();
        k();
        return z;
    }

    void a1() {
        if (this.f546f == null) {
            return;
        }
        for (int i2 = 0; i2 < this.f546f.size(); i2++) {
            android.support.v4.app.e eVarValueAt = this.f546f.valueAt(i2);
            if (eVarValueAt != null) {
                E0(eVarValueAt);
            }
        }
    }

    @Override // android.support.v4.app.j
    public List<android.support.v4.app.e> b() {
        List<android.support.v4.app.e> list;
        if (this.f545e.isEmpty()) {
            return Collections.emptyList();
        }
        synchronized (this.f545e) {
            list = (List) this.f545e.clone();
        }
        return list;
    }

    @Override // android.support.v4.app.j
    public boolean c() {
        return this.s || this.t;
    }

    @Override // android.support.v4.app.j
    public boolean d() {
        l();
        return F0(null, -1, 0);
    }

    public android.support.v4.app.e e0(int i2) {
        for (int size = this.f545e.size() - 1; size >= 0; size--) {
            android.support.v4.app.e eVar = this.f545e.get(size);
            if (eVar != null && eVar.y == i2) {
                return eVar;
            }
        }
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        if (sparseArray == null) {
            return null;
        }
        for (int size2 = sparseArray.size() - 1; size2 >= 0; size2--) {
            android.support.v4.app.e eVarValueAt = this.f546f.valueAt(size2);
            if (eVarValueAt != null && eVarValueAt.y == i2) {
                return eVarValueAt;
            }
        }
        return null;
    }

    void f(android.support.v4.app.c cVar) {
        if (this.g == null) {
            this.g = new ArrayList<>();
        }
        this.g.add(cVar);
    }

    public android.support.v4.app.e f0(String str) {
        if (str != null) {
            for (int size = this.f545e.size() - 1; size >= 0; size--) {
                android.support.v4.app.e eVar = this.f545e.get(size);
                if (eVar != null && str.equals(eVar.A)) {
                    return eVar;
                }
            }
        }
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        if (sparseArray == null || str == null) {
            return null;
        }
        for (int size2 = sparseArray.size() - 1; size2 >= 0; size2--) {
            android.support.v4.app.e eVarValueAt = this.f546f.valueAt(size2);
            if (eVarValueAt != null && str.equals(eVarValueAt.A)) {
                return eVarValueAt;
            }
        }
        return null;
    }

    public void g(android.support.v4.app.e eVar, boolean z) {
        if (F) {
            Log.v("FragmentManager", "add: " + eVar);
        }
        s0(eVar);
        if (eVar.C) {
            return;
        }
        if (this.f545e.contains(eVar)) {
            throw new IllegalStateException("Fragment already added: " + eVar);
        }
        synchronized (this.f545e) {
            this.f545e.add(eVar);
        }
        eVar.l = true;
        eVar.m = false;
        if (eVar.J == null) {
            eVar.P = false;
        }
        if (eVar.F && eVar.G) {
            this.r = true;
        }
        if (z) {
            B0(eVar);
        }
    }

    public android.support.v4.app.e g0(String str) {
        android.support.v4.app.e eVarE;
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        if (sparseArray == null || str == null) {
            return null;
        }
        int size = sparseArray.size();
        while (true) {
            size--;
            if (size < 0) {
                return null;
            }
            android.support.v4.app.e eVarValueAt = this.f546f.valueAt(size);
            if (eVarValueAt != null && (eVarE = eVarValueAt.e(str)) != null) {
                return eVarE;
            }
        }
    }

    public void i(android.support.v4.app.i iVar, android.support.v4.app.g gVar, android.support.v4.app.e eVar) {
        if (this.n != null) {
            throw new IllegalStateException("Already attached");
        }
        this.n = iVar;
        this.o = gVar;
        this.p = eVar;
    }

    public void j(android.support.v4.app.e eVar) {
        if (F) {
            Log.v("FragmentManager", "attach: " + eVar);
        }
        if (eVar.C) {
            eVar.C = false;
            if (eVar.l) {
                return;
            }
            if (this.f545e.contains(eVar)) {
                throw new IllegalStateException("Fragment already added: " + eVar);
            }
            if (F) {
                Log.v("FragmentManager", "add from attach: " + eVar);
            }
            synchronized (this.f545e) {
                this.f545e.add(eVar);
            }
            eVar.l = true;
            if (eVar.F && eVar.G) {
                this.r = true;
            }
        }
    }

    public void j0(int i2) {
        synchronized (this) {
            this.i.set(i2, null);
            if (this.j == null) {
                this.j = new ArrayList<>();
            }
            if (F) {
                Log.v("FragmentManager", "Freeing back stack index " + i2);
            }
            this.j.add(Integer.valueOf(i2));
        }
    }

    public android.support.v4.app.e m0(Bundle bundle, String str) {
        int i2 = bundle.getInt(str, -1);
        if (i2 == -1) {
            return null;
        }
        android.support.v4.app.e eVar = this.f546f.get(i2);
        if (eVar != null) {
            return eVar;
        }
        b1(new IllegalStateException("Fragment no longer exists for key " + str + ": index " + i2));
        throw null;
    }

    void n(android.support.v4.app.c cVar, boolean z, boolean z2, boolean z3) {
        if (z) {
            cVar.g(z3);
        } else {
            cVar.f();
        }
        ArrayList arrayList = new ArrayList(1);
        ArrayList arrayList2 = new ArrayList(1);
        arrayList.add(cVar);
        arrayList2.add(Boolean.valueOf(z));
        if (z2) {
            p.C(this, arrayList, arrayList2, 0, 1, true);
        }
        if (z3) {
            A0(this.m, true);
        }
        SparseArray<android.support.v4.app.e> sparseArray = this.f546f;
        if (sparseArray != null) {
            int size = sparseArray.size();
            for (int i2 = 0; i2 < size; i2++) {
                android.support.v4.app.e eVarValueAt = this.f546f.valueAt(i2);
                if (eVarValueAt != null && eVarValueAt.J != null && eVarValueAt.O && cVar.j(eVarValueAt.z)) {
                    float f2 = eVarValueAt.Q;
                    if (f2 > 0.0f) {
                        eVarValueAt.J.setAlpha(f2);
                    }
                    if (z3) {
                        eVarValueAt.Q = 0.0f;
                    } else {
                        eVarValueAt.Q = -1.0f;
                        eVarValueAt.O = false;
                    }
                }
            }
        }
    }

    LayoutInflater.Factory2 n0() {
        return this;
    }

    void o(android.support.v4.app.e eVar) {
        Animator animator;
        if (eVar.J != null) {
            g gVarR0 = r0(eVar, eVar.u(), !eVar.B, eVar.v());
            if (gVarR0 == null || (animator = gVarR0.f563b) == null) {
                if (gVarR0 != null) {
                    V0(eVar.J, gVarR0);
                    eVar.J.startAnimation(gVarR0.f562a);
                    gVarR0.f562a.start();
                }
                eVar.J.setVisibility((!eVar.B || eVar.G()) ? 0 : 8);
                if (eVar.G()) {
                    eVar.U0(false);
                }
            } else {
                animator.setTarget(eVar.J);
                if (!eVar.B) {
                    eVar.J.setVisibility(0);
                } else if (eVar.G()) {
                    eVar.U0(false);
                } else {
                    ViewGroup viewGroup = eVar.I;
                    View view = eVar.J;
                    viewGroup.startViewTransition(view);
                    gVarR0.f563b.addListener(new d(this, viewGroup, view, eVar));
                }
                V0(eVar.J, gVarR0);
                gVarR0.f563b.start();
            }
        }
        if (eVar.l && eVar.F && eVar.G) {
            this.r = true;
        }
        eVar.P = false;
        eVar.c0(eVar.B);
    }

    public android.support.v4.app.e o0() {
        return this.q;
    }

    @Override // android.view.LayoutInflater.Factory2
    public View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
        if (!"fragment".equals(str)) {
            return null;
        }
        String attributeValue = attributeSet.getAttributeValue(null, "class");
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C0020k.f572a);
        if (attributeValue == null) {
            attributeValue = typedArrayObtainStyledAttributes.getString(0);
        }
        String str2 = attributeValue;
        int resourceId = typedArrayObtainStyledAttributes.getResourceId(1, -1);
        String string = typedArrayObtainStyledAttributes.getString(2);
        typedArrayObtainStyledAttributes.recycle();
        if (!android.support.v4.app.e.K(this.n.e(), str2)) {
            return null;
        }
        int id = view != null ? view.getId() : 0;
        if (id == -1 && resourceId == -1 && string == null) {
            throw new IllegalArgumentException(attributeSet.getPositionDescription() + ": Must specify unique android:id, android:tag, or have a parent with an id for " + str2);
        }
        android.support.v4.app.e eVarE0 = resourceId != -1 ? e0(resourceId) : null;
        if (eVarE0 == null && string != null) {
            eVarE0 = f0(string);
        }
        if (eVarE0 == null && id != -1) {
            eVarE0 = e0(id);
        }
        if (F) {
            Log.v("FragmentManager", "onCreateView: id=0x" + Integer.toHexString(resourceId) + " fname=" + str2 + " existing=" + eVarE0);
        }
        if (eVarE0 == null) {
            eVarE0 = this.o.a(context, str2, null);
            eVarE0.n = true;
            eVarE0.y = resourceId != 0 ? resourceId : id;
            eVarE0.z = id;
            eVarE0.A = string;
            eVarE0.o = true;
            eVarE0.s = this;
            android.support.v4.app.i iVar = this.n;
            eVarE0.t = iVar;
            eVarE0.e0(iVar.e(), attributeSet, eVarE0.f515c);
            g(eVarE0, true);
        } else {
            if (eVarE0.o) {
                throw new IllegalArgumentException(attributeSet.getPositionDescription() + ": Duplicate id 0x" + Integer.toHexString(resourceId) + ", tag " + string + ", or parent id 0x" + Integer.toHexString(id) + " with another fragment for " + str2);
            }
            eVarE0.o = true;
            android.support.v4.app.i iVar2 = this.n;
            eVarE0.t = iVar2;
            if (!eVarE0.E) {
                eVarE0.e0(iVar2.e(), attributeSet, eVarE0.f515c);
            }
        }
        android.support.v4.app.e eVar = eVarE0;
        if (this.m >= 1 || !eVar.n) {
            B0(eVar);
        } else {
            C0(eVar, 1, 0, 0, false);
        }
        View view2 = eVar.J;
        if (view2 != null) {
            if (resourceId != 0) {
                view2.setId(resourceId);
            }
            if (eVar.J.getTag() == null) {
                eVar.J.setTag(string);
            }
            return eVar.J;
        }
        throw new IllegalStateException("Fragment " + str2 + " did not create a view.");
    }

    public void p(android.support.v4.app.e eVar) {
        if (F) {
            Log.v("FragmentManager", "detach: " + eVar);
        }
        if (eVar.C) {
            return;
        }
        eVar.C = true;
        if (eVar.l) {
            if (F) {
                Log.v("FragmentManager", "remove from detach: " + eVar);
            }
            synchronized (this.f545e) {
                this.f545e.remove(eVar);
            }
            if (eVar.F && eVar.G) {
                this.r = true;
            }
            eVar.l = false;
        }
    }

    public void p0(android.support.v4.app.e eVar) {
        if (F) {
            Log.v("FragmentManager", "hide: " + eVar);
        }
        if (eVar.B) {
            return;
        }
        eVar.B = true;
        eVar.P = true ^ eVar.P;
    }

    public void q() {
        this.s = false;
        this.t = false;
        U(2);
    }

    boolean q0(int i2) {
        return this.m >= i2;
    }

    public void r(Configuration configuration) {
        for (int i2 = 0; i2 < this.f545e.size(); i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null) {
                eVar.u0(configuration);
            }
        }
    }

    g r0(android.support.v4.app.e eVar, int i2, boolean z, int i3) {
        int iC1;
        int iT = eVar.t();
        Animation animationT = eVar.T(i2, z, iT);
        if (animationT != null) {
            return new g(animationT);
        }
        Animator animatorU = eVar.U(i2, z, iT);
        if (animatorU != null) {
            return new g(animatorU);
        }
        if (iT != 0) {
            boolean zEquals = "anim".equals(this.n.e().getResources().getResourceTypeName(iT));
            boolean z2 = false;
            if (zEquals) {
                try {
                    Animation animationLoadAnimation = AnimationUtils.loadAnimation(this.n.e(), iT);
                    if (animationLoadAnimation != null) {
                        return new g(animationLoadAnimation);
                    }
                    z2 = true;
                } catch (Resources.NotFoundException e2) {
                    throw e2;
                } catch (RuntimeException unused) {
                }
            }
            if (!z2) {
                try {
                    Animator animatorLoadAnimator = AnimatorInflater.loadAnimator(this.n.e(), iT);
                    if (animatorLoadAnimator != null) {
                        return new g(animatorLoadAnimator);
                    }
                } catch (RuntimeException e3) {
                    if (zEquals) {
                        throw e3;
                    }
                    Animation animationLoadAnimation2 = AnimationUtils.loadAnimation(this.n.e(), iT);
                    if (animationLoadAnimation2 != null) {
                        return new g(animationLoadAnimation2);
                    }
                }
            }
        }
        if (i2 == 0 || (iC1 = c1(i2, z)) < 0) {
            return null;
        }
        switch (iC1) {
            case 1:
                return v0(this.n.e(), 1.125f, 1.0f, 0.0f, 1.0f);
            case 2:
                return v0(this.n.e(), 1.0f, 0.975f, 1.0f, 0.0f);
            case 3:
                return v0(this.n.e(), 0.975f, 1.0f, 0.0f, 1.0f);
            case 4:
                return v0(this.n.e(), 1.0f, 1.075f, 1.0f, 0.0f);
            case 5:
                return t0(this.n.e(), 0.0f, 1.0f);
            case 6:
                return t0(this.n.e(), 1.0f, 0.0f);
            default:
                if (i3 == 0 && this.n.l()) {
                    i3 = this.n.k();
                }
                if (i3 == 0) {
                }
                return null;
        }
    }

    public boolean s(MenuItem menuItem) {
        if (this.m < 1) {
            return false;
        }
        for (int i2 = 0; i2 < this.f545e.size(); i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null && eVar.v0(menuItem)) {
                return true;
            }
        }
        return false;
    }

    void s0(android.support.v4.app.e eVar) {
        if (eVar.f518f >= 0) {
            return;
        }
        int i2 = this.f544d;
        this.f544d = i2 + 1;
        eVar.V0(i2, this.p);
        if (this.f546f == null) {
            this.f546f = new SparseArray<>();
        }
        this.f546f.put(eVar.f518f, eVar);
        if (F) {
            Log.v("FragmentManager", "Allocated fragment index " + eVar);
        }
    }

    public void t() {
        this.s = false;
        this.t = false;
        U(1);
    }

    public String toString() {
        StringBuilder sb = new StringBuilder(128);
        sb.append("FragmentManager{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(" in ");
        android.support.v4.app.e eVar = this.p;
        if (eVar != null) {
            a.b.c.f.d.a(eVar, sb);
        } else {
            a.b.c.f.d.a(this.n, sb);
        }
        sb.append("}}");
        return sb.toString();
    }

    public boolean u(Menu menu, MenuInflater menuInflater) {
        if (this.m < 1) {
            return false;
        }
        ArrayList<android.support.v4.app.e> arrayList = null;
        boolean z = false;
        for (int i2 = 0; i2 < this.f545e.size(); i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null && eVar.x0(menu, menuInflater)) {
                if (arrayList == null) {
                    arrayList = new ArrayList<>();
                }
                arrayList.add(eVar);
                z = true;
            }
        }
        if (this.h != null) {
            for (int i3 = 0; i3 < this.h.size(); i3++) {
                android.support.v4.app.e eVar2 = this.h.get(i3);
                if (arrayList == null || !arrayList.contains(eVar2)) {
                    eVar2.Y();
                }
            }
        }
        this.h = arrayList;
        return z;
    }

    void u0(android.support.v4.app.e eVar) {
        if (eVar.f518f < 0) {
            return;
        }
        if (F) {
            Log.v("FragmentManager", "Freeing fragment index " + eVar);
        }
        this.f546f.put(eVar.f518f, null);
        eVar.D();
    }

    public void v() {
        this.u = true;
        a0();
        U(0);
        this.n = null;
        this.o = null;
        this.p = null;
    }

    public void w() {
        U(1);
    }

    public void x() {
        for (int i2 = 0; i2 < this.f545e.size(); i2++) {
            android.support.v4.app.e eVar = this.f545e.get(i2);
            if (eVar != null) {
                eVar.D0();
            }
        }
    }

    public void y(boolean z) {
        int size = this.f545e.size();
        while (true) {
            size--;
            if (size < 0) {
                return;
            }
            android.support.v4.app.e eVar = this.f545e.get(size);
            if (eVar != null) {
                eVar.E0(z);
            }
        }
    }

    void z(android.support.v4.app.e eVar, Bundle bundle, boolean z) {
        android.support.v4.app.e eVar2 = this.p;
        if (eVar2 != null) {
            android.support.v4.app.j jVarR = eVar2.r();
            if (jVarR instanceof k) {
                ((k) jVarR).z(eVar, bundle, true);
            }
        }
        for (j jVar : this.l) {
            if (!z || jVar.f571b) {
                jVar.f570a.a(this, eVar, bundle);
            }
        }
    }

    void z0(android.support.v4.app.e eVar) {
        if (eVar == null) {
            return;
        }
        int iMin = this.m;
        if (eVar.m) {
            iMin = eVar.H() ? Math.min(iMin, 1) : Math.min(iMin, 0);
        }
        C0(eVar, iMin, eVar.u(), eVar.v(), false);
        if (eVar.J != null) {
            android.support.v4.app.e eVarH0 = h0(eVar);
            if (eVarH0 != null) {
                View view = eVarH0.J;
                ViewGroup viewGroup = eVar.I;
                int iIndexOfChild = viewGroup.indexOfChild(view);
                int iIndexOfChild2 = viewGroup.indexOfChild(eVar.J);
                if (iIndexOfChild2 < iIndexOfChild) {
                    viewGroup.removeViewAt(iIndexOfChild2);
                    viewGroup.addView(eVar.J, iIndexOfChild);
                }
            }
            if (eVar.O && eVar.I != null) {
                float f2 = eVar.Q;
                if (f2 > 0.0f) {
                    eVar.J.setAlpha(f2);
                }
                eVar.Q = 0.0f;
                eVar.O = false;
                g gVarR0 = r0(eVar, eVar.u(), true, eVar.v());
                if (gVarR0 != null) {
                    V0(eVar.J, gVarR0);
                    Animation animation = gVarR0.f562a;
                    if (animation != null) {
                        eVar.J.startAnimation(animation);
                    } else {
                        gVarR0.f563b.setTarget(eVar.J);
                        gVarR0.f563b.start();
                    }
                }
            }
        }
        if (eVar.P) {
            o(eVar);
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    private static class g {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        public final Animation f562a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final Animator f563b;

        g(Animation animation) {
            this.f562a = animation;
            this.f563b = null;
            if (animation == null) {
                throw new IllegalStateException("Animation cannot be null");
            }
        }

        g(Animator animator) {
            this.f562a = null;
            this.f563b = animator;
            if (animator == null) {
                throw new IllegalStateException("Animator cannot be null");
            }
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    private static class i extends AnimationSet implements Runnable {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private final ViewGroup f565b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private final View f566c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        private boolean f567d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        private boolean f568e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        private boolean f569f;

        i(Animation animation, ViewGroup viewGroup, View view) {
            super(false);
            this.f569f = true;
            this.f565b = viewGroup;
            this.f566c = view;
            addAnimation(animation);
            this.f565b.post(this);
        }

        @Override // android.view.animation.AnimationSet, android.view.animation.Animation
        public boolean getTransformation(long j, Transformation transformation) {
            this.f569f = true;
            if (this.f567d) {
                return !this.f568e;
            }
            if (!super.getTransformation(j, transformation)) {
                this.f567d = true;
                y.a(this.f565b, this);
            }
            return true;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (this.f567d || !this.f569f) {
                this.f565b.endViewTransition(this.f566c);
                this.f568e = true;
            } else {
                this.f569f = false;
                this.f565b.post(this);
            }
        }

        @Override // android.view.animation.Animation
        public boolean getTransformation(long j, Transformation transformation, float f2) {
            this.f569f = true;
            if (this.f567d) {
                return !this.f568e;
            }
            if (!super.getTransformation(j, transformation, f2)) {
                this.f567d = true;
                y.a(this.f565b, this);
            }
            return true;
        }
    }

    @Override // android.view.LayoutInflater.Factory
    public View onCreateView(String str, Context context, AttributeSet attributeSet) {
        return onCreateView(null, str, context, attributeSet);
    }
}
