package g.h.a;

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.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 com.cvte.vman.instance.InvokeCmd;
import g.h.a.c;
import g.h.a.h;
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 i extends g.h.a.h implements LayoutInflater.Factory2 {
    static boolean G = false;
    static Field H;
    static final Interpolator I = new DecelerateInterpolator(2.5f);
    static final Interpolator J = new DecelerateInterpolator(1.5f);
    ArrayList<g.h.a.c> A;
    ArrayList<m> D;
    g.h.a.j E;
    ArrayList<l> b;
    boolean d;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    SparseArray<g.h.a.c> f548g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    ArrayList<g.h.a.a> f549h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    ArrayList<g.h.a.c> f550i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    ArrayList<g.h.a.a> f551j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    ArrayList<Integer> f552k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    ArrayList<h.b> f553l;
    g.h.a.g o;
    g.h.a.e p;
    g.h.a.c q;
    g.h.a.c r;
    boolean s;
    boolean t;
    boolean u;
    boolean v;
    String w;
    boolean x;
    ArrayList<g.h.a.a> y;
    ArrayList<Boolean> z;
    int e = 0;
    final ArrayList<g.h.a.c> f = new ArrayList<>();

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    private final CopyOnWriteArrayList<j> f554m = new CopyOnWriteArrayList<>();
    int n = 0;
    Bundle B = null;
    SparseArray<Parcelable> C = null;
    Runnable F = new a();

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

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

    /* JADX INFO: compiled from: FragmentManager.java */
    class b extends f {
        final /* synthetic */ ViewGroup b;
        final /* synthetic */ g.h.a.c c;

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

            @Override // java.lang.Runnable
            public void run() {
                if (b.this.c.L() != null) {
                    b.this.c.w1(null);
                    b bVar = b.this;
                    i iVar = i.this;
                    g.h.a.c cVar = bVar.c;
                    iVar.C0(cVar, cVar.e0(), 0, 0, false);
                }
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(Animation.AnimationListener animationListener, ViewGroup viewGroup, g.h.a.c cVar) {
            super(animationListener);
            this.b = viewGroup;
            this.c = cVar;
        }

        @Override // g.h.a.i.f, android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            super.onAnimationEnd(animation);
            this.b.post(new a());
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    class c extends AnimatorListenerAdapter {
        final /* synthetic */ ViewGroup a;
        final /* synthetic */ View b;
        final /* synthetic */ g.h.a.c c;

        c(ViewGroup viewGroup, View view, g.h.a.c cVar) {
            this.a = viewGroup;
            this.b = view;
            this.c = cVar;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            this.a.endViewTransition(this.b);
            Animator animatorM = this.c.M();
            this.c.x1(null);
            if (animatorM == null || this.a.indexOfChild(this.b) >= 0) {
                return;
            }
            i iVar = i.this;
            g.h.a.c cVar = this.c;
            iVar.C0(cVar, cVar.e0(), 0, 0, false);
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    class d extends AnimatorListenerAdapter {
        final /* synthetic */ ViewGroup a;
        final /* synthetic */ View b;
        final /* synthetic */ g.h.a.c c;

        d(i iVar, ViewGroup viewGroup, View view, g.h.a.c cVar) {
            this.a = viewGroup;
            this.b = view;
            this.c = cVar;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            this.a.endViewTransition(this.b);
            animator.removeListener(this);
            View view = this.c.K;
            if (view != null) {
                view.setVisibility(8);
            }
        }
    }

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

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

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

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

        @Override // g.h.a.i.f, android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            if (g.e.j.o.l(this.b) || Build.VERSION.SDK_INT >= 24) {
                this.b.post(new a());
            } else {
                this.b.setLayerType(0, null);
            }
            super.onAnimationEnd(animation);
        }
    }

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

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

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

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

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

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

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

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

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

    /* JADX INFO: compiled from: FragmentManager.java */
    private static final class j {
        final h.a a;
        final boolean b;
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    static class k {
        public static final int[] a = {R.attr.name, R.attr.id, R.attr.tag};
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    interface l {
        boolean a(ArrayList<g.h.a.a> arrayList, ArrayList<Boolean> arrayList2);
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    static class m implements c.f {
        final boolean a;
        final g.h.a.a b;
        private int c;

        m(g.h.a.a aVar, boolean z) {
            this.a = z;
            this.b = aVar;
        }

        @Override // g.h.a.c.f
        public void a() {
            int i2 = this.c - 1;
            this.c = i2;
            if (i2 != 0) {
                return;
            }
            this.b.a.T0();
        }

        @Override // g.h.a.c.f
        public void b() {
            this.c++;
        }

        public void c() {
            g.h.a.a aVar = this.b;
            aVar.a.n(aVar, this.a, false, false);
        }

        public void d() {
            boolean z = this.c > 0;
            i iVar = this.b.a;
            int size = iVar.f.size();
            for (int i2 = 0; i2 < size; i2++) {
                g.h.a.c cVar = iVar.f.get(i2);
                cVar.D1(null);
                if (z && cVar.n0()) {
                    cVar.F1();
                }
            }
            g.h.a.a aVar = this.b;
            aVar.a.n(aVar, this.a, !z, true);
        }

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

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

    i() {
    }

    private boolean F0(String str, int i2, int i3) {
        g.h.a.h hVarX0;
        a0();
        Y(true);
        g.h.a.c cVar = this.r;
        if (cVar != null && i2 < 0 && str == null && (hVarX0 = cVar.X0()) != null && hVarX0.d()) {
            return true;
        }
        boolean zG0 = G0(this.y, this.z, str, i2, i3);
        if (zG0) {
            this.d = true;
            try {
                K0(this.y, this.z);
            } finally {
                m();
            }
        }
        W();
        k();
        return zG0;
    }

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

    private void K0(ArrayList<g.h.a.a> 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 InvokeCmd.CMD_TOUCH_GET_MOUSE_FADE_STATE;
        }
        if (i2 != 4099) {
            return i2 != 8194 ? 0 : 4097;
        }
        return 4099;
    }

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

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

    private void X() {
        SparseArray<g.h.a.c> sparseArray = this.f548g;
        int size = sparseArray == null ? 0 : sparseArray.size();
        for (int i2 = 0; i2 < size; i2++) {
            g.h.a.c cVarValueAt = this.f548g.valueAt(i2);
            if (cVarValueAt != null) {
                if (cVarValueAt.L() != null) {
                    int iE0 = cVarValueAt.e0();
                    View viewL = cVarValueAt.L();
                    Animation animation = viewL.getAnimation();
                    if (animation != null) {
                        animation.cancel();
                        viewL.clearAnimation();
                    }
                    cVarValueAt.w1(null);
                    C0(cVarValueAt, iE0, 0, 0, false);
                } else if (cVarValueAt.M() != null) {
                    cVarValueAt.M().end();
                }
            }
        }
    }

    private static void X0(g.h.a.j jVar) {
        if (jVar == null) {
            return;
        }
        List<g.h.a.c> listB = jVar.b();
        if (listB != null) {
            Iterator<g.h.a.c> it = listB.iterator();
            while (it.hasNext()) {
                it.next().F = true;
            }
        }
        List<g.h.a.j> listA = jVar.a();
        if (listA != null) {
            Iterator<g.h.a.j> it2 = listA.iterator();
            while (it2.hasNext()) {
                X0(it2.next());
            }
        }
    }

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

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

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

    private void b1(RuntimeException runtimeException) {
        Log.e("FragmentManager", runtimeException.getMessage());
        Log.e("FragmentManager", "Activity state:");
        PrintWriter printWriter = new PrintWriter(new g.e.i.b("FragmentManager"));
        g.h.a.g gVar = this.o;
        if (gVar != null) {
            try {
                gVar.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<g.h.a.a> arrayList, ArrayList<Boolean> arrayList2, int i2, int i3) {
        int i4;
        int i5;
        int i6 = i2;
        boolean z = arrayList.get(i6).s;
        ArrayList<g.h.a.c> arrayList3 = this.A;
        if (arrayList3 == null) {
            this.A = new ArrayList<>();
        } else {
            arrayList3.clear();
        }
        this.A.addAll(this.f);
        g.h.a.c cVarO0 = o0();
        boolean z2 = false;
        for (int i7 = i6; i7 < i3; i7++) {
            g.h.a.a aVar = arrayList.get(i7);
            cVarO0 = !arrayList2.get(i7).booleanValue() ? aVar.h(this.A, cVarO0) : aVar.p(this.A, cVarO0);
            z2 = z2 || aVar.f515i;
        }
        this.A.clear();
        if (!z) {
            n.C(this, arrayList, arrayList2, i2, i3, false);
        }
        b0(arrayList, arrayList2, i2, i3);
        if (z) {
            g.c.b<g.h.a.c> bVar = new g.c.b<>();
            e(bVar);
            int iH0 = H0(arrayList, arrayList2, i2, i3, bVar);
            w0(bVar);
            i4 = iH0;
        } else {
            i4 = i3;
        }
        if (i4 != i6 && z) {
            n.C(this, arrayList, arrayList2, i2, i4, true);
            A0(this.n, true);
        }
        while (i6 < i3) {
            g.h.a.a aVar2 = arrayList.get(i6);
            if (arrayList2.get(i6).booleanValue() && (i5 = aVar2.f518l) >= 0) {
                j0(i5);
                aVar2.f518l = -1;
            }
            aVar2.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<g.h.a.a> arrayList, ArrayList<Boolean> arrayList2) {
        int iIndexOf;
        int iIndexOf2;
        ArrayList<m> arrayList3 = this.D;
        int size = arrayList3 == null ? 0 : arrayList3.size();
        int i2 = 0;
        while (i2 < size) {
            m mVar = this.D.get(i2);
            if (arrayList != null && !mVar.a && (iIndexOf2 = arrayList.indexOf(mVar.b)) != -1 && arrayList2.get(iIndexOf2).booleanValue()) {
                mVar.c();
            } else if (mVar.e() || (arrayList != null && mVar.b.k(arrayList, 0, arrayList.size()))) {
                this.D.remove(i2);
                i2--;
                size--;
                if (arrayList == null || mVar.a || (iIndexOf = arrayList.indexOf(mVar.b)) == -1 || !arrayList2.get(iIndexOf).booleanValue()) {
                    mVar.d();
                } else {
                    mVar.c();
                }
            }
            i2++;
        }
    }

    private void e(g.c.b<g.h.a.c> bVar) {
        int i2 = this.n;
        if (i2 < 1) {
            return;
        }
        int iMin = Math.min(i2, 3);
        int size = this.f.size();
        for (int i3 = 0; i3 < size; i3++) {
            g.h.a.c cVar = this.f.get(i3);
            if (cVar.b < iMin) {
                C0(cVar, iMin, cVar.W(), cVar.X(), false);
                if (cVar.K != null && !cVar.C && cVar.P) {
                    bVar.add(cVar);
                }
            }
        }
    }

    private void h(g.h.a.c cVar, g gVar, int i2) {
        View view = cVar.K;
        ViewGroup viewGroup = cVar.J;
        viewGroup.startViewTransition(view);
        cVar.E1(i2);
        if (gVar.a != null) {
            RunnableC0033i runnableC0033i = new RunnableC0033i(gVar.a, viewGroup, view);
            cVar.w1(cVar.K);
            runnableC0033i.setAnimationListener(new b(l0(runnableC0033i), viewGroup, cVar));
            V0(view, gVar);
            cVar.K.startAnimation(runnableC0033i);
            return;
        }
        Animator animator = gVar.b;
        cVar.x1(animator);
        animator.addListener(new c(viewGroup, view, cVar));
        animator.setTarget(cVar.K);
        V0(cVar.K, gVar);
        animator.start();
    }

    private g.h.a.c h0(g.h.a.c cVar) {
        ViewGroup viewGroup = cVar.J;
        View view = cVar.K;
        if (viewGroup != null && view != null) {
            for (int iIndexOf = this.f.indexOf(cVar) - 1; iIndexOf >= 0; iIndexOf--) {
                g.h.a.c cVar2 = this.f.get(iIndexOf);
                if (cVar2.J == viewGroup && cVar2.K != null) {
                    return cVar2;
                }
            }
        }
        return null;
    }

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

    private void k() {
        SparseArray<g.h.a.c> sparseArray = this.f548g;
        if (sparseArray != null) {
            for (int size = sparseArray.size() - 1; size >= 0; size--) {
                if (this.f548g.valueAt(size) == null) {
                    SparseArray<g.h.a.c> sparseArray2 = this.f548g;
                    sparseArray2.delete(sparseArray2.keyAt(size));
                }
            }
        }
    }

    private boolean k0(ArrayList<g.h.a.a> arrayList, ArrayList<Boolean> arrayList2) {
        synchronized (this) {
            if (this.b != null && this.b.size() != 0) {
                int size = this.b.size();
                boolean zA = false;
                for (int i2 = 0; i2 < size; i2++) {
                    zA |= this.b.get(i2).a(arrayList, arrayList2);
                }
                this.b.clear();
                this.o.g().removeCallbacks(this.F);
                return zA;
            }
            return false;
        }
    }

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

    private static Animation.AnimationListener l0(Animation animation) {
        try {
            if (H == null) {
                Field declaredField = Animation.class.getDeclaredField("mListener");
                H = declaredField;
                declaredField.setAccessible(true);
            }
            return (Animation.AnimationListener) H.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.d = false;
        this.z.clear();
        this.y.clear();
    }

    static g t0(Context context, float f2, float f3) {
        AlphaAnimation alphaAnimation = new AlphaAnimation(f2, f3);
        alphaAnimation.setInterpolator(J);
        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(I);
        scaleAnimation.setDuration(220L);
        animationSet.addAnimation(scaleAnimation);
        AlphaAnimation alphaAnimation = new AlphaAnimation(f4, f5);
        alphaAnimation.setInterpolator(J);
        alphaAnimation.setDuration(220L);
        animationSet.addAnimation(alphaAnimation);
        return new g(animationSet);
    }

    private void w0(g.c.b<g.h.a.c> bVar) {
        int size = bVar.size();
        for (int i2 = 0; i2 < size; i2++) {
            g.h.a.c cVarH = bVar.h(i2);
            if (!cVarH.f533m) {
                View viewH0 = cVarH.h0();
                cVarH.R = viewH0.getAlpha();
                viewH0.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.a;
        if (animation instanceof AlphaAnimation) {
            return true;
        }
        if (!(animation instanceof AnimationSet)) {
            return x0(gVar.b);
        }
        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(g.h.a.c cVar, Context context, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).A(cVar, context, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.b(this, cVar, context);
            }
        }
    }

    void A0(int i2, boolean z) {
        g.h.a.g gVar;
        if (this.o == null && i2 != 0) {
            throw new IllegalStateException("No activity");
        }
        if (z || i2 != this.n) {
            this.n = i2;
            if (this.f548g != null) {
                int size = this.f.size();
                for (int i3 = 0; i3 < size; i3++) {
                    z0(this.f.get(i3));
                }
                int size2 = this.f548g.size();
                for (int i4 = 0; i4 < size2; i4++) {
                    g.h.a.c cVarValueAt = this.f548g.valueAt(i4);
                    if (cVarValueAt != null && ((cVarValueAt.n || cVarValueAt.D) && !cVarValueAt.P)) {
                        z0(cVarValueAt);
                    }
                }
                a1();
                if (this.s && (gVar = this.o) != null && this.n == 4) {
                    gVar.n();
                    this.s = false;
                }
            }
        }
    }

    void B(g.h.a.c cVar, Bundle bundle, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).B(cVar, bundle, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.c(this, cVar, bundle);
            }
        }
    }

    void B0(g.h.a.c cVar) {
        C0(cVar, this.n, 0, 0, false);
    }

    void C(g.h.a.c cVar, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).C(cVar, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.d(this, cVar);
            }
        }
    }

    /* 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(g.h.a.c 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: g.h.a.i.C0(g.h.a.c, int, int, int, boolean):void");
    }

    void D(g.h.a.c cVar, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).D(cVar, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.e(this, cVar);
            }
        }
    }

    public void D0() {
        this.E = null;
        this.t = false;
        this.u = false;
        int size = this.f.size();
        for (int i2 = 0; i2 < size; i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null) {
                cVar.q0();
            }
        }
    }

    void E(g.h.a.c cVar, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).E(cVar, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.f(this, cVar);
            }
        }
    }

    public void E0(g.h.a.c cVar) {
        if (cVar.M) {
            if (this.d) {
                this.x = true;
            } else {
                cVar.M = false;
                C0(cVar, this.n, 0, 0, false);
            }
        }
    }

    void F(g.h.a.c cVar, Context context, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).F(cVar, context, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.g(this, cVar, context);
            }
        }
    }

    void G(g.h.a.c cVar, Bundle bundle, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).G(cVar, bundle, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.h(this, cVar, bundle);
            }
        }
    }

    boolean G0(ArrayList<g.h.a.a> arrayList, ArrayList<Boolean> arrayList2, String str, int i2, int i3) {
        int i4;
        ArrayList<g.h.a.a> arrayList3 = this.f549h;
        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.f549h.remove(size));
            arrayList2.add(Boolean.TRUE);
        } else {
            if (str != null || i2 >= 0) {
                int size2 = this.f549h.size() - 1;
                while (size2 >= 0) {
                    g.h.a.a aVar = this.f549h.get(size2);
                    if ((str != null && str.equals(aVar.i())) || (i2 >= 0 && i2 == aVar.f518l)) {
                        break;
                    }
                    size2--;
                }
                if (size2 < 0) {
                    return false;
                }
                if ((i3 & 1) != 0) {
                    while (true) {
                        size2--;
                        if (size2 < 0) {
                            break;
                        }
                        g.h.a.a aVar2 = this.f549h.get(size2);
                        if (str == null || !str.equals(aVar2.i())) {
                            if (i2 < 0 || i2 != aVar2.f518l) {
                                break;
                            }
                        }
                    }
                }
                i4 = size2;
            } else {
                i4 = -1;
            }
            if (i4 == this.f549h.size() - 1) {
                return false;
            }
            for (int size3 = this.f549h.size() - 1; size3 > i4; size3--) {
                arrayList.add(this.f549h.remove(size3));
                arrayList2.add(Boolean.TRUE);
            }
        }
        return true;
    }

    void H(g.h.a.c cVar, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).H(cVar, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.i(this, cVar);
            }
        }
    }

    void I(g.h.a.c cVar, Bundle bundle, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).I(cVar, bundle, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.j(this, cVar, bundle);
            }
        }
    }

    public void I0(Bundle bundle, String str, g.h.a.c cVar) {
        int i2 = cVar.f527g;
        if (i2 >= 0) {
            bundle.putInt(str, i2);
            return;
        }
        b1(new IllegalStateException("Fragment " + cVar + " is not currently in the FragmentManager"));
        throw null;
    }

    void J(g.h.a.c cVar, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).J(cVar, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.k(this, cVar);
            }
        }
    }

    public void J0(g.h.a.c cVar) {
        if (G) {
            Log.v("FragmentManager", "remove: " + cVar + " nesting=" + cVar.s);
        }
        boolean z = !cVar.m0();
        if (!cVar.D || z) {
            synchronized (this.f) {
                this.f.remove(cVar);
            }
            if (cVar.G && cVar.H) {
                this.s = true;
            }
            cVar.f533m = false;
            cVar.n = true;
        }
    }

    void K(g.h.a.c cVar, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).K(cVar, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.l(this, cVar);
            }
        }
    }

    void L(g.h.a.c cVar, View view, Bundle bundle, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).L(cVar, view, bundle, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.m(this, cVar, view, bundle);
            }
        }
    }

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

    void M(g.h.a.c cVar, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).M(cVar, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.n(this, cVar);
            }
        }
    }

    void M0(Parcelable parcelable, g.h.a.j jVar) {
        List<g.h.a.j> listA;
        List<androidx.lifecycle.r> listC;
        if (parcelable == null) {
            return;
        }
        g.h.a.k kVar = (g.h.a.k) parcelable;
        if (kVar.b == null) {
            return;
        }
        if (jVar != null) {
            List<g.h.a.c> listB = jVar.b();
            listA = jVar.a();
            listC = jVar.c();
            int size = listB != null ? listB.size() : 0;
            for (int i2 = 0; i2 < size; i2++) {
                g.h.a.c cVar = listB.get(i2);
                if (G) {
                    Log.v("FragmentManager", "restoreAllState: re-attaching retained " + cVar);
                }
                int i3 = 0;
                while (true) {
                    g.h.a.l[] lVarArr = kVar.b;
                    if (i3 >= lVarArr.length || lVarArr[i3].d == cVar.f527g) {
                        break;
                    } else {
                        i3++;
                    }
                }
                g.h.a.l[] lVarArr2 = kVar.b;
                if (i3 == lVarArr2.length) {
                    b1(new IllegalStateException("Could not find active fragment with index " + cVar.f527g));
                    throw null;
                }
                g.h.a.l lVar = lVarArr2[i3];
                lVar.n = cVar;
                cVar.e = null;
                cVar.s = 0;
                cVar.p = false;
                cVar.f533m = false;
                cVar.f530j = null;
                Bundle bundle = lVar.f563m;
                if (bundle != null) {
                    bundle.setClassLoader(this.o.e().getClassLoader());
                    cVar.e = lVar.f563m.getSparseParcelableArray("android:view_state");
                    cVar.d = lVar.f563m;
                }
            }
        } else {
            listA = null;
            listC = null;
        }
        this.f548g = new SparseArray<>(kVar.b.length);
        int i4 = 0;
        while (true) {
            g.h.a.l[] lVarArr3 = kVar.b;
            if (i4 >= lVarArr3.length) {
                break;
            }
            g.h.a.l lVar2 = lVarArr3[i4];
            if (lVar2 != null) {
                g.h.a.c cVarA = lVar2.a(this.o, this.p, this.q, (listA == null || i4 >= listA.size()) ? null : listA.get(i4), (listC == null || i4 >= listC.size()) ? null : listC.get(i4));
                if (G) {
                    Log.v("FragmentManager", "restoreAllState: active #" + i4 + ": " + cVarA);
                }
                this.f548g.put(cVarA.f527g, cVarA);
                lVar2.n = null;
            }
            i4++;
        }
        if (jVar != null) {
            List<g.h.a.c> listB2 = jVar.b();
            int size2 = listB2 != null ? listB2.size() : 0;
            for (int i5 = 0; i5 < size2; i5++) {
                g.h.a.c cVar2 = listB2.get(i5);
                int i6 = cVar2.f531k;
                if (i6 >= 0) {
                    g.h.a.c cVar3 = this.f548g.get(i6);
                    cVar2.f530j = cVar3;
                    if (cVar3 == null) {
                        Log.w("FragmentManager", "Re-attaching retained fragment " + cVar2 + " target no longer exists: " + cVar2.f531k);
                    }
                }
            }
        }
        this.f.clear();
        if (kVar.d != null) {
            int i7 = 0;
            while (true) {
                int[] iArr = kVar.d;
                if (i7 >= iArr.length) {
                    break;
                }
                g.h.a.c cVar4 = this.f548g.get(iArr[i7]);
                if (cVar4 == null) {
                    b1(new IllegalStateException("No instantiated fragment for index #" + kVar.d[i7]));
                    throw null;
                }
                cVar4.f533m = true;
                if (G) {
                    Log.v("FragmentManager", "restoreAllState: added #" + i7 + ": " + cVar4);
                }
                if (this.f.contains(cVar4)) {
                    throw new IllegalStateException("Already added!");
                }
                synchronized (this.f) {
                    this.f.add(cVar4);
                }
                i7++;
            }
        }
        if (kVar.e != null) {
            this.f549h = new ArrayList<>(kVar.e.length);
            int i8 = 0;
            while (true) {
                g.h.a.b[] bVarArr = kVar.e;
                if (i8 >= bVarArr.length) {
                    break;
                }
                g.h.a.a aVarA = bVarArr[i8].a(this);
                if (G) {
                    Log.v("FragmentManager", "restoreAllState: back stack #" + i8 + " (index " + aVarA.f518l + "): " + aVarA);
                    PrintWriter printWriter = new PrintWriter(new g.e.i.b("FragmentManager"));
                    aVarA.e("  ", printWriter, false);
                    printWriter.close();
                }
                this.f549h.add(aVarA);
                int i9 = aVarA.f518l;
                if (i9 >= 0) {
                    U0(i9, aVarA);
                }
                i8++;
            }
        } else {
            this.f549h = null;
        }
        int i10 = kVar.f;
        if (i10 >= 0) {
            this.r = this.f548g.get(i10);
        }
        this.e = kVar.f556g;
    }

    public boolean N(MenuItem menuItem) {
        if (this.n < 1) {
            return false;
        }
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null && cVar.k1(menuItem)) {
                return true;
            }
        }
        return false;
    }

    g.h.a.j N0() {
        X0(this.E);
        return this.E;
    }

    public void O(Menu menu) {
        if (this.n < 1) {
            return;
        }
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null) {
                cVar.l1(menu);
            }
        }
    }

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

    Parcelable P0() {
        int[] iArr;
        int size;
        i0();
        X();
        a0();
        this.t = true;
        g.h.a.b[] bVarArr = null;
        this.E = null;
        SparseArray<g.h.a.c> sparseArray = this.f548g;
        if (sparseArray == null || sparseArray.size() <= 0) {
            return null;
        }
        int size2 = this.f548g.size();
        g.h.a.l[] lVarArr = new g.h.a.l[size2];
        boolean z = false;
        for (int i2 = 0; i2 < size2; i2++) {
            g.h.a.c cVarValueAt = this.f548g.valueAt(i2);
            if (cVarValueAt != null) {
                if (cVarValueAt.f527g < 0) {
                    b1(new IllegalStateException("Failure saving state: active " + cVarValueAt + " has cleared index: " + cVarValueAt.f527g));
                    throw null;
                }
                g.h.a.l lVar = new g.h.a.l(cVarValueAt);
                lVarArr[i2] = lVar;
                if (cVarValueAt.b <= 0 || lVar.f563m != null) {
                    lVar.f563m = cVarValueAt.d;
                } else {
                    Bundle bundleQ0 = Q0(cVarValueAt);
                    lVar.f563m = bundleQ0;
                    g.h.a.c cVar = cVarValueAt.f530j;
                    if (cVar != null) {
                        if (cVar.f527g < 0) {
                            b1(new IllegalStateException("Failure saving state: " + cVarValueAt + " has target not in fragment manager: " + cVarValueAt.f530j));
                            throw null;
                        }
                        if (bundleQ0 == null) {
                            lVar.f563m = new Bundle();
                        }
                        I0(lVar.f563m, "android:target_state", cVarValueAt.f530j);
                        int i3 = cVarValueAt.f532l;
                        if (i3 != 0) {
                            lVar.f563m.putInt("android:target_req_state", i3);
                        }
                    }
                }
                if (G) {
                    Log.v("FragmentManager", "Saved state of " + cVarValueAt + ": " + lVar.f563m);
                }
                z = true;
            }
        }
        if (!z) {
            if (G) {
                Log.v("FragmentManager", "saveAllState: no fragments!");
            }
            return null;
        }
        int size3 = this.f.size();
        if (size3 > 0) {
            iArr = new int[size3];
            for (int i4 = 0; i4 < size3; i4++) {
                iArr[i4] = this.f.get(i4).f527g;
                if (iArr[i4] < 0) {
                    b1(new IllegalStateException("Failure saving state: active " + this.f.get(i4) + " has cleared index: " + iArr[i4]));
                    throw null;
                }
                if (G) {
                    Log.v("FragmentManager", "saveAllState: adding fragment #" + i4 + ": " + this.f.get(i4));
                }
            }
        } else {
            iArr = null;
        }
        ArrayList<g.h.a.a> arrayList = this.f549h;
        if (arrayList != null && (size = arrayList.size()) > 0) {
            bVarArr = new g.h.a.b[size];
            for (int i5 = 0; i5 < size; i5++) {
                bVarArr[i5] = new g.h.a.b(this.f549h.get(i5));
                if (G) {
                    Log.v("FragmentManager", "saveAllState: adding back stack #" + i5 + ": " + this.f549h.get(i5));
                }
            }
        }
        g.h.a.k kVar = new g.h.a.k();
        kVar.b = lVarArr;
        kVar.d = iArr;
        kVar.e = bVarArr;
        g.h.a.c cVar2 = this.r;
        if (cVar2 != null) {
            kVar.f = cVar2.f527g;
        }
        kVar.f556g = this.e;
        S0();
        return kVar;
    }

    public void Q(boolean z) {
        int size = this.f.size();
        while (true) {
            size--;
            if (size < 0) {
                return;
            }
            g.h.a.c cVar = this.f.get(size);
            if (cVar != null) {
                cVar.n1(z);
            }
        }
    }

    Bundle Q0(g.h.a.c cVar) {
        if (this.B == null) {
            this.B = new Bundle();
        }
        cVar.q1(this.B);
        I(cVar, this.B, false);
        Bundle bundle = null;
        if (!this.B.isEmpty()) {
            Bundle bundle2 = this.B;
            this.B = null;
            bundle = bundle2;
        }
        if (cVar.K != null) {
            R0(cVar);
        }
        if (cVar.e != null) {
            if (bundle == null) {
                bundle = new Bundle();
            }
            bundle.putSparseParcelableArray("android:view_state", cVar.e);
        }
        if (!cVar.N) {
            if (bundle == null) {
                bundle = new Bundle();
            }
            bundle.putBoolean("android:user_visible_hint", cVar.N);
        }
        return bundle;
    }

    public boolean R(Menu menu) {
        if (this.n < 1) {
            return false;
        }
        boolean z = false;
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null && cVar.o1(menu)) {
                z = true;
            }
        }
        return z;
    }

    void R0(g.h.a.c cVar) {
        if (cVar.L == null) {
            return;
        }
        SparseArray<Parcelable> sparseArray = this.C;
        if (sparseArray == null) {
            this.C = new SparseArray<>();
        } else {
            sparseArray.clear();
        }
        cVar.L.saveHierarchyState(this.C);
        if (this.C.size() > 0) {
            cVar.e = this.C;
            this.C = null;
        }
    }

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

    void S0() {
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        g.h.a.j jVar;
        if (this.f548g != null) {
            arrayList = null;
            arrayList2 = null;
            arrayList3 = null;
            for (int i2 = 0; i2 < this.f548g.size(); i2++) {
                g.h.a.c cVarValueAt = this.f548g.valueAt(i2);
                if (cVarValueAt != null) {
                    if (cVarValueAt.E) {
                        if (arrayList == null) {
                            arrayList = new ArrayList();
                        }
                        arrayList.add(cVarValueAt);
                        g.h.a.c cVar = cVarValueAt.f530j;
                        cVarValueAt.f531k = cVar != null ? cVar.f527g : -1;
                        if (G) {
                            Log.v("FragmentManager", "retainNonConfig: keeping retained " + cVarValueAt);
                        }
                    }
                    i iVar = cVarValueAt.v;
                    if (iVar != null) {
                        iVar.S0();
                        jVar = cVarValueAt.v.E;
                    } else {
                        jVar = cVarValueAt.w;
                    }
                    if (arrayList2 == null && jVar != null) {
                        arrayList2 = new ArrayList(this.f548g.size());
                        for (int i3 = 0; i3 < i2; i3++) {
                            arrayList2.add(null);
                        }
                    }
                    if (arrayList2 != null) {
                        arrayList2.add(jVar);
                    }
                    if (arrayList3 == null && cVarValueAt.x != null) {
                        arrayList3 = new ArrayList(this.f548g.size());
                        for (int i4 = 0; i4 < i2; i4++) {
                            arrayList3.add(null);
                        }
                    }
                    if (arrayList3 != null) {
                        arrayList3.add(cVarValueAt.x);
                    }
                }
            }
        } else {
            arrayList = null;
            arrayList2 = null;
            arrayList3 = null;
        }
        if (arrayList == null && arrayList2 == null && arrayList3 == null) {
            this.E = null;
        } else {
            this.E = new g.h.a.j(arrayList, arrayList2, arrayList3);
        }
    }

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

    void T0() {
        synchronized (this) {
            boolean z = false;
            boolean z2 = (this.D == null || this.D.isEmpty()) ? false : true;
            if (this.b != null && this.b.size() == 1) {
                z = true;
            }
            if (z2 || z) {
                this.o.g().removeCallbacks(this.F);
                this.o.g().post(this.F);
            }
        }
    }

    public void U0(int i2, g.h.a.a aVar) {
        synchronized (this) {
            if (this.f551j == null) {
                this.f551j = new ArrayList<>();
            }
            int size = this.f551j.size();
            if (i2 < size) {
                if (G) {
                    Log.v("FragmentManager", "Setting back stack index " + i2 + " to " + aVar);
                }
                this.f551j.set(i2, aVar);
            } else {
                while (size < i2) {
                    this.f551j.add(null);
                    if (this.f552k == null) {
                        this.f552k = new ArrayList<>();
                    }
                    if (G) {
                        Log.v("FragmentManager", "Adding available back stack index " + size);
                    }
                    this.f552k.add(Integer.valueOf(size));
                    size++;
                }
                if (G) {
                    Log.v("FragmentManager", "Adding back stack index " + i2 + " with " + aVar);
                }
                this.f551j.add(aVar);
            }
        }
    }

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

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

    public void W0(g.h.a.c cVar) {
        if (cVar == null || (this.f548g.get(cVar.f527g) == cVar && (cVar.u == null || cVar.U() == this))) {
            this.r = cVar;
            return;
        }
        throw new IllegalArgumentException("Fragment " + cVar + " is not an active fragment of FragmentManager " + this);
    }

    void Z(g.h.a.c cVar) {
        if (!cVar.o || cVar.r) {
            return;
        }
        cVar.d1(cVar.h1(cVar.d), null, cVar.d);
        View view = cVar.K;
        if (view == null) {
            cVar.L = null;
            return;
        }
        cVar.L = view;
        view.setSaveFromParentEnabled(false);
        if (cVar.C) {
            cVar.K.setVisibility(8);
        }
        cVar.V0(cVar.K, cVar.d);
        L(cVar, cVar.K, cVar.d, false);
    }

    public void Z0(g.h.a.c cVar) {
        if (G) {
            Log.v("FragmentManager", "show: " + cVar);
        }
        if (cVar.C) {
            cVar.C = false;
            cVar.Q = !cVar.Q;
        }
    }

    @Override // g.h.a.h
    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<g.h.a.c> sparseArray = this.f548g;
        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++) {
                g.h.a.c cVarValueAt = this.f548g.valueAt(i2);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i2);
                printWriter.print(": ");
                printWriter.println(cVarValueAt);
                if (cVarValueAt != null) {
                    cVarValueAt.F(str2, fileDescriptor, printWriter, strArr);
                }
            }
        }
        int size6 = this.f.size();
        if (size6 > 0) {
            printWriter.print(str);
            printWriter.println("Added Fragments:");
            for (int i3 = 0; i3 < size6; i3++) {
                g.h.a.c cVar = this.f.get(i3);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i3);
                printWriter.print(": ");
                printWriter.println(cVar.toString());
            }
        }
        ArrayList<g.h.a.c> arrayList = this.f550i;
        if (arrayList != null && (size4 = arrayList.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Fragments Created Menus:");
            for (int i4 = 0; i4 < size4; i4++) {
                g.h.a.c cVar2 = this.f550i.get(i4);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i4);
                printWriter.print(": ");
                printWriter.println(cVar2.toString());
            }
        }
        ArrayList<g.h.a.a> arrayList2 = this.f549h;
        if (arrayList2 != null && (size3 = arrayList2.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Back Stack:");
            for (int i5 = 0; i5 < size3; i5++) {
                g.h.a.a aVar = this.f549h.get(i5);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i5);
                printWriter.print(": ");
                printWriter.println(aVar.toString());
                aVar.d(str2, fileDescriptor, printWriter, strArr);
            }
        }
        synchronized (this) {
            if (this.f551j != null && (size2 = this.f551j.size()) > 0) {
                printWriter.print(str);
                printWriter.println("Back Stack Indices:");
                for (int i6 = 0; i6 < size2; i6++) {
                    Object obj = (g.h.a.a) this.f551j.get(i6);
                    printWriter.print(str);
                    printWriter.print("  #");
                    printWriter.print(i6);
                    printWriter.print(": ");
                    printWriter.println(obj);
                }
            }
            if (this.f552k != null && this.f552k.size() > 0) {
                printWriter.print(str);
                printWriter.print("mAvailBackStackIndices: ");
                printWriter.println(Arrays.toString(this.f552k.toArray()));
            }
        }
        ArrayList<l> arrayList3 = this.b;
        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.b.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.o);
        printWriter.print(str);
        printWriter.print("  mContainer=");
        printWriter.println(this.p);
        if (this.q != null) {
            printWriter.print(str);
            printWriter.print("  mParent=");
            printWriter.println(this.q);
        }
        printWriter.print(str);
        printWriter.print("  mCurState=");
        printWriter.print(this.n);
        printWriter.print(" mStateSaved=");
        printWriter.print(this.t);
        printWriter.print(" mStopped=");
        printWriter.print(this.u);
        printWriter.print(" mDestroyed=");
        printWriter.println(this.v);
        if (this.s) {
            printWriter.print(str);
            printWriter.print("  mNeedMenuInvalidate=");
            printWriter.println(this.s);
        }
        if (this.w != null) {
            printWriter.print(str);
            printWriter.print("  mNoTransactionsBecause=");
            printWriter.println(this.w);
        }
    }

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

    void a1() {
        if (this.f548g == null) {
            return;
        }
        for (int i2 = 0; i2 < this.f548g.size(); i2++) {
            g.h.a.c cVarValueAt = this.f548g.valueAt(i2);
            if (cVarValueAt != null) {
                E0(cVarValueAt);
            }
        }
    }

    @Override // g.h.a.h
    public List<g.h.a.c> b() {
        List<g.h.a.c> list;
        if (this.f.isEmpty()) {
            return Collections.emptyList();
        }
        synchronized (this.f) {
            list = (List) this.f.clone();
        }
        return list;
    }

    @Override // g.h.a.h
    public boolean c() {
        return this.t || this.u;
    }

    @Override // g.h.a.h
    public boolean d() {
        l();
        return F0(null, -1, 0);
    }

    public g.h.a.c e0(int i2) {
        for (int size = this.f.size() - 1; size >= 0; size--) {
            g.h.a.c cVar = this.f.get(size);
            if (cVar != null && cVar.z == i2) {
                return cVar;
            }
        }
        SparseArray<g.h.a.c> sparseArray = this.f548g;
        if (sparseArray == null) {
            return null;
        }
        for (int size2 = sparseArray.size() - 1; size2 >= 0; size2--) {
            g.h.a.c cVarValueAt = this.f548g.valueAt(size2);
            if (cVarValueAt != null && cVarValueAt.z == i2) {
                return cVarValueAt;
            }
        }
        return null;
    }

    void f(g.h.a.a aVar) {
        if (this.f549h == null) {
            this.f549h = new ArrayList<>();
        }
        this.f549h.add(aVar);
    }

    public g.h.a.c f0(String str) {
        if (str != null) {
            for (int size = this.f.size() - 1; size >= 0; size--) {
                g.h.a.c cVar = this.f.get(size);
                if (cVar != null && str.equals(cVar.B)) {
                    return cVar;
                }
            }
        }
        SparseArray<g.h.a.c> sparseArray = this.f548g;
        if (sparseArray == null || str == null) {
            return null;
        }
        for (int size2 = sparseArray.size() - 1; size2 >= 0; size2--) {
            g.h.a.c cVarValueAt = this.f548g.valueAt(size2);
            if (cVarValueAt != null && str.equals(cVarValueAt.B)) {
                return cVarValueAt;
            }
        }
        return null;
    }

    public void g(g.h.a.c cVar, boolean z) {
        if (G) {
            Log.v("FragmentManager", "add: " + cVar);
        }
        s0(cVar);
        if (cVar.D) {
            return;
        }
        if (this.f.contains(cVar)) {
            throw new IllegalStateException("Fragment already added: " + cVar);
        }
        synchronized (this.f) {
            this.f.add(cVar);
        }
        cVar.f533m = true;
        cVar.n = false;
        if (cVar.K == null) {
            cVar.Q = false;
        }
        if (cVar.G && cVar.H) {
            this.s = true;
        }
        if (z) {
            B0(cVar);
        }
    }

    public g.h.a.c g0(String str) {
        g.h.a.c cVarH;
        SparseArray<g.h.a.c> sparseArray = this.f548g;
        if (sparseArray == null || str == null) {
            return null;
        }
        int size = sparseArray.size();
        while (true) {
            size--;
            if (size < 0) {
                return null;
            }
            g.h.a.c cVarValueAt = this.f548g.valueAt(size);
            if (cVarValueAt != null && (cVarH = cVarValueAt.H(str)) != null) {
                return cVarH;
            }
        }
    }

    public void i(g.h.a.g gVar, g.h.a.e eVar, g.h.a.c cVar) {
        if (this.o != null) {
            throw new IllegalStateException("Already attached");
        }
        this.o = gVar;
        this.p = eVar;
        this.q = cVar;
    }

    public void j(g.h.a.c cVar) {
        if (G) {
            Log.v("FragmentManager", "attach: " + cVar);
        }
        if (cVar.D) {
            cVar.D = false;
            if (cVar.f533m) {
                return;
            }
            if (this.f.contains(cVar)) {
                throw new IllegalStateException("Fragment already added: " + cVar);
            }
            if (G) {
                Log.v("FragmentManager", "add from attach: " + cVar);
            }
            synchronized (this.f) {
                this.f.add(cVar);
            }
            cVar.f533m = true;
            if (cVar.G && cVar.H) {
                this.s = true;
            }
        }
    }

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

    public g.h.a.c m0(Bundle bundle, String str) {
        int i2 = bundle.getInt(str, -1);
        if (i2 == -1) {
            return null;
        }
        g.h.a.c cVar = this.f548g.get(i2);
        if (cVar != null) {
            return cVar;
        }
        b1(new IllegalStateException("Fragment no longer exists for key " + str + ": index " + i2));
        throw null;
    }

    void n(g.h.a.a aVar, boolean z, boolean z2, boolean z3) {
        if (z) {
            aVar.g(z3);
        } else {
            aVar.f();
        }
        ArrayList arrayList = new ArrayList(1);
        ArrayList arrayList2 = new ArrayList(1);
        arrayList.add(aVar);
        arrayList2.add(Boolean.valueOf(z));
        if (z2) {
            n.C(this, arrayList, arrayList2, 0, 1, true);
        }
        if (z3) {
            A0(this.n, true);
        }
        SparseArray<g.h.a.c> sparseArray = this.f548g;
        if (sparseArray != null) {
            int size = sparseArray.size();
            for (int i2 = 0; i2 < size; i2++) {
                g.h.a.c cVarValueAt = this.f548g.valueAt(i2);
                if (cVarValueAt != null && cVarValueAt.K != null && cVarValueAt.P && aVar.j(cVarValueAt.A)) {
                    float f2 = cVarValueAt.R;
                    if (f2 > 0.0f) {
                        cVarValueAt.K.setAlpha(f2);
                    }
                    if (z3) {
                        cVarValueAt.R = 0.0f;
                    } else {
                        cVarValueAt.R = -1.0f;
                        cVarValueAt.P = false;
                    }
                }
            }
        }
    }

    LayoutInflater.Factory2 n0() {
        return this;
    }

    void o(g.h.a.c cVar) {
        Animator animator;
        if (cVar.K != null) {
            g gVarR0 = r0(cVar, cVar.X(), !cVar.C, cVar.Y());
            if (gVarR0 == null || (animator = gVarR0.b) == null) {
                if (gVarR0 != null) {
                    V0(cVar.K, gVarR0);
                    cVar.K.startAnimation(gVarR0.a);
                    gVarR0.a.start();
                }
                cVar.K.setVisibility((!cVar.C || cVar.l0()) ? 0 : 8);
                if (cVar.l0()) {
                    cVar.z1(false);
                }
            } else {
                animator.setTarget(cVar.K);
                if (!cVar.C) {
                    cVar.K.setVisibility(0);
                } else if (cVar.l0()) {
                    cVar.z1(false);
                } else {
                    ViewGroup viewGroup = cVar.J;
                    View view = cVar.K;
                    viewGroup.startViewTransition(view);
                    gVarR0.b.addListener(new d(this, viewGroup, view, cVar));
                }
                V0(cVar.K, gVarR0);
                gVarR0.b.start();
            }
        }
        if (cVar.f533m && cVar.G && cVar.H) {
            this.s = true;
        }
        cVar.Q = false;
        cVar.H0(cVar.C);
    }

    public g.h.a.c o0() {
        return this.r;
    }

    @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, k.a);
        if (attributeValue == null) {
            attributeValue = typedArrayObtainStyledAttributes.getString(0);
        }
        String str2 = attributeValue;
        int resourceId = typedArrayObtainStyledAttributes.getResourceId(1, -1);
        String string = typedArrayObtainStyledAttributes.getString(2);
        typedArrayObtainStyledAttributes.recycle();
        if (!g.h.a.c.p0(this.o.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);
        }
        g.h.a.c cVarE0 = resourceId != -1 ? e0(resourceId) : null;
        if (cVarE0 == null && string != null) {
            cVarE0 = f0(string);
        }
        if (cVarE0 == null && id != -1) {
            cVarE0 = e0(id);
        }
        if (G) {
            Log.v("FragmentManager", "onCreateView: id=0x" + Integer.toHexString(resourceId) + " fname=" + str2 + " existing=" + cVarE0);
        }
        if (cVarE0 == null) {
            cVarE0 = this.p.a(context, str2, null);
            cVarE0.o = true;
            cVarE0.z = resourceId != 0 ? resourceId : id;
            cVarE0.A = id;
            cVarE0.B = string;
            cVarE0.p = true;
            cVarE0.t = this;
            g.h.a.g gVar = this.o;
            cVarE0.u = gVar;
            cVarE0.J0(gVar.e(), attributeSet, cVarE0.d);
            g(cVarE0, true);
        } else {
            if (cVarE0.p) {
                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);
            }
            cVarE0.p = true;
            g.h.a.g gVar2 = this.o;
            cVarE0.u = gVar2;
            if (!cVarE0.F) {
                cVarE0.J0(gVar2.e(), attributeSet, cVarE0.d);
            }
        }
        g.h.a.c cVar = cVarE0;
        if (this.n >= 1 || !cVar.o) {
            B0(cVar);
        } else {
            C0(cVar, 1, 0, 0, false);
        }
        View view2 = cVar.K;
        if (view2 != null) {
            if (resourceId != 0) {
                view2.setId(resourceId);
            }
            if (cVar.K.getTag() == null) {
                cVar.K.setTag(string);
            }
            return cVar.K;
        }
        throw new IllegalStateException("Fragment " + str2 + " did not create a view.");
    }

    public void p(g.h.a.c cVar) {
        if (G) {
            Log.v("FragmentManager", "detach: " + cVar);
        }
        if (cVar.D) {
            return;
        }
        cVar.D = true;
        if (cVar.f533m) {
            if (G) {
                Log.v("FragmentManager", "remove from detach: " + cVar);
            }
            synchronized (this.f) {
                this.f.remove(cVar);
            }
            if (cVar.G && cVar.H) {
                this.s = true;
            }
            cVar.f533m = false;
        }
    }

    public void p0(g.h.a.c cVar) {
        if (G) {
            Log.v("FragmentManager", "hide: " + cVar);
        }
        if (cVar.C) {
            return;
        }
        cVar.C = true;
        cVar.Q = true ^ cVar.Q;
    }

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

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

    public void r(Configuration configuration) {
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null) {
                cVar.Z0(configuration);
            }
        }
    }

    g r0(g.h.a.c cVar, int i2, boolean z, int i3) {
        int iC1;
        int iW = cVar.W();
        Animation animationY0 = cVar.y0(i2, z, iW);
        if (animationY0 != null) {
            return new g(animationY0);
        }
        Animator animatorZ0 = cVar.z0(i2, z, iW);
        if (animatorZ0 != null) {
            return new g(animatorZ0);
        }
        if (iW != 0) {
            boolean zEquals = "anim".equals(this.o.e().getResources().getResourceTypeName(iW));
            boolean z2 = false;
            if (zEquals) {
                try {
                    Animation animationLoadAnimation = AnimationUtils.loadAnimation(this.o.e(), iW);
                    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.o.e(), iW);
                    if (animatorLoadAnimator != null) {
                        return new g(animatorLoadAnimator);
                    }
                } catch (RuntimeException e3) {
                    if (zEquals) {
                        throw e3;
                    }
                    Animation animationLoadAnimation2 = AnimationUtils.loadAnimation(this.o.e(), iW);
                    if (animationLoadAnimation2 != null) {
                        return new g(animationLoadAnimation2);
                    }
                }
            }
        }
        if (i2 == 0 || (iC1 = c1(i2, z)) < 0) {
            return null;
        }
        switch (iC1) {
            case 1:
                return v0(this.o.e(), 1.125f, 1.0f, 0.0f, 1.0f);
            case 2:
                return v0(this.o.e(), 1.0f, 0.975f, 1.0f, 0.0f);
            case 3:
                return v0(this.o.e(), 0.975f, 1.0f, 0.0f, 1.0f);
            case 4:
                return v0(this.o.e(), 1.0f, 1.075f, 1.0f, 0.0f);
            case 5:
                return t0(this.o.e(), 0.0f, 1.0f);
            case 6:
                return t0(this.o.e(), 1.0f, 0.0f);
            default:
                if (i3 == 0 && this.o.l()) {
                    i3 = this.o.k();
                }
                if (i3 == 0) {
                }
                return null;
        }
    }

    public boolean s(MenuItem menuItem) {
        if (this.n < 1) {
            return false;
        }
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null && cVar.a1(menuItem)) {
                return true;
            }
        }
        return false;
    }

    void s0(g.h.a.c cVar) {
        if (cVar.f527g >= 0) {
            return;
        }
        int i2 = this.e;
        this.e = i2 + 1;
        cVar.A1(i2, this.q);
        if (this.f548g == null) {
            this.f548g = new SparseArray<>();
        }
        this.f548g.put(cVar.f527g, cVar);
        if (G) {
            Log.v("FragmentManager", "Allocated fragment index " + cVar);
        }
    }

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

    public String toString() {
        StringBuilder sb = new StringBuilder(128);
        sb.append("FragmentManager{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(" in ");
        g.h.a.c cVar = this.q;
        if (cVar != null) {
            g.e.i.a.a(cVar, sb);
        } else {
            g.e.i.a.a(this.o, sb);
        }
        sb.append("}}");
        return sb.toString();
    }

    public boolean u(Menu menu, MenuInflater menuInflater) {
        if (this.n < 1) {
            return false;
        }
        ArrayList<g.h.a.c> arrayList = null;
        boolean z = false;
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null && cVar.c1(menu, menuInflater)) {
                if (arrayList == null) {
                    arrayList = new ArrayList<>();
                }
                arrayList.add(cVar);
                z = true;
            }
        }
        if (this.f550i != null) {
            for (int i3 = 0; i3 < this.f550i.size(); i3++) {
                g.h.a.c cVar2 = this.f550i.get(i3);
                if (arrayList == null || !arrayList.contains(cVar2)) {
                    cVar2.D0();
                }
            }
        }
        this.f550i = arrayList;
        return z;
    }

    void u0(g.h.a.c cVar) {
        if (cVar.f527g < 0) {
            return;
        }
        if (G) {
            Log.v("FragmentManager", "Freeing fragment index " + cVar);
        }
        this.f548g.put(cVar.f527g, null);
        cVar.i0();
    }

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

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

    public void x() {
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            g.h.a.c cVar = this.f.get(i2);
            if (cVar != null) {
                cVar.i1();
            }
        }
    }

    public void y(boolean z) {
        int size = this.f.size();
        while (true) {
            size--;
            if (size < 0) {
                return;
            }
            g.h.a.c cVar = this.f.get(size);
            if (cVar != null) {
                cVar.j1(z);
            }
        }
    }

    void z(g.h.a.c cVar, Bundle bundle, boolean z) {
        g.h.a.c cVar2 = this.q;
        if (cVar2 != null) {
            g.h.a.h hVarU = cVar2.U();
            if (hVarU instanceof i) {
                ((i) hVarU).z(cVar, bundle, true);
            }
        }
        for (j jVar : this.f554m) {
            if (!z || jVar.b) {
                jVar.a.a(this, cVar, bundle);
            }
        }
    }

    void z0(g.h.a.c cVar) {
        if (cVar == null) {
            return;
        }
        int iMin = this.n;
        if (cVar.n) {
            iMin = cVar.m0() ? Math.min(iMin, 1) : Math.min(iMin, 0);
        }
        C0(cVar, iMin, cVar.X(), cVar.Y(), false);
        if (cVar.K != null) {
            g.h.a.c cVarH0 = h0(cVar);
            if (cVarH0 != null) {
                View view = cVarH0.K;
                ViewGroup viewGroup = cVar.J;
                int iIndexOfChild = viewGroup.indexOfChild(view);
                int iIndexOfChild2 = viewGroup.indexOfChild(cVar.K);
                if (iIndexOfChild2 < iIndexOfChild) {
                    viewGroup.removeViewAt(iIndexOfChild2);
                    viewGroup.addView(cVar.K, iIndexOfChild);
                }
            }
            if (cVar.P && cVar.J != null) {
                float f2 = cVar.R;
                if (f2 > 0.0f) {
                    cVar.K.setAlpha(f2);
                }
                cVar.R = 0.0f;
                cVar.P = false;
                g gVarR0 = r0(cVar, cVar.X(), true, cVar.Y());
                if (gVarR0 != null) {
                    V0(cVar.K, gVarR0);
                    Animation animation = gVarR0.a;
                    if (animation != null) {
                        cVar.K.startAnimation(animation);
                    } else {
                        gVarR0.b.setTarget(cVar.K);
                        gVarR0.b.start();
                    }
                }
            }
        }
        if (cVar.Q) {
            o(cVar);
        }
    }

    /* JADX INFO: compiled from: FragmentManager.java */
    private static class g {
        public final Animation a;
        public final Animator b;

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

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

    /* JADX INFO: renamed from: g.h.a.i$i, reason: collision with other inner class name */
    /* JADX INFO: compiled from: FragmentManager.java */
    private static class RunnableC0033i extends AnimationSet implements Runnable {
        private final ViewGroup b;
        private final View d;
        private boolean e;
        private boolean f;

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

        RunnableC0033i(Animation animation, ViewGroup viewGroup, View view) {
            super(false);
            this.f555g = true;
            this.b = viewGroup;
            this.d = view;
            addAnimation(animation);
            this.b.post(this);
        }

        @Override // android.view.animation.AnimationSet, android.view.animation.Animation
        public boolean getTransformation(long j2, Transformation transformation) {
            this.f555g = true;
            if (this.e) {
                return !this.f;
            }
            if (!super.getTransformation(j2, transformation)) {
                this.e = true;
                q.a(this.b, this);
            }
            return true;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (this.e || !this.f555g) {
                this.b.endViewTransition(this.d);
                this.f = true;
            } else {
                this.f555g = false;
                this.b.post(this);
            }
        }

        @Override // android.view.animation.Animation
        public boolean getTransformation(long j2, Transformation transformation, float f) {
            this.f555g = true;
            if (this.e) {
                return !this.f;
            }
            if (!super.getTransformation(j2, transformation, f)) {
                this.e = true;
                q.a(this.b, this);
            }
            return true;
        }
    }

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