package androidx.fragment.app;

import android.graphics.Rect;
import android.transition.Transition;
import android.transition.TransitionManager;
import android.transition.TransitionSet;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import p011d0.C0605h;

/* renamed from: androidx.fragment.app.l0 */
/* loaded from: classes.dex */
public class C0324l0 extends AbstractC0349n0 {

    /* renamed from: androidx.fragment.app.l0$a */
    /* loaded from: classes.dex */
    public class C0325a extends Transition.EpicenterCallback {

        /* renamed from: a */
        public final /* synthetic */ Rect f1338a;

        public C0325a(Rect rect) {
            this.f1338a = rect;
        }

        @Override // android.transition.Transition.EpicenterCallback
        public Rect onGetEpicenter(Transition transition) {
            return this.f1338a;
        }
    }

    /* renamed from: androidx.fragment.app.l0$b */
    /* loaded from: classes.dex */
    public class C0326b implements Transition.TransitionListener {

        /* renamed from: a */
        public final /* synthetic */ View f1340a;

        /* renamed from: b */
        public final /* synthetic */ ArrayList f1341b;

        public C0326b(View view, ArrayList arrayList) {
            this.f1340a = view;
            this.f1341b = arrayList;
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionCancel(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionEnd(Transition transition) {
            transition.removeListener(this);
            this.f1340a.setVisibility(8);
            int size = this.f1341b.size();
            for (int i = 0; i < size; i++) {
                ((View) this.f1341b.get(i)).setVisibility(0);
            }
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionPause(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionResume(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionStart(Transition transition) {
            transition.removeListener(this);
            transition.addListener(this);
        }
    }

    /* renamed from: androidx.fragment.app.l0$c */
    /* loaded from: classes.dex */
    public class C0327c implements Transition.TransitionListener {

        /* renamed from: a */
        public final /* synthetic */ Object f1343a;

        /* renamed from: b */
        public final /* synthetic */ ArrayList f1344b;

        /* renamed from: c */
        public final /* synthetic */ Object f1345c;

        /* renamed from: d */
        public final /* synthetic */ ArrayList f1346d;

        /* renamed from: e */
        public final /* synthetic */ Object f1347e;

        /* renamed from: f */
        public final /* synthetic */ ArrayList f1348f;

        public C0327c(Object obj, ArrayList arrayList, Object obj2, ArrayList arrayList2, Object obj3, ArrayList arrayList3) {
            this.f1343a = obj;
            this.f1344b = arrayList;
            this.f1345c = obj2;
            this.f1346d = arrayList2;
            this.f1347e = obj3;
            this.f1348f = arrayList3;
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionCancel(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionEnd(Transition transition) {
            transition.removeListener(this);
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionPause(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionResume(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionStart(Transition transition) {
            Object obj = this.f1343a;
            if (obj != null) {
                C0324l0.this.mo3906q(obj, this.f1344b, null);
            }
            Object obj2 = this.f1345c;
            if (obj2 != null) {
                C0324l0.this.mo3906q(obj2, this.f1346d, null);
            }
            Object obj3 = this.f1347e;
            if (obj3 != null) {
                C0324l0.this.mo3906q(obj3, this.f1348f, null);
            }
        }
    }

    /* renamed from: androidx.fragment.app.l0$d */
    /* loaded from: classes.dex */
    public class C0328d implements Transition.TransitionListener {

        /* renamed from: a */
        public final /* synthetic */ Runnable f1350a;

        public C0328d(Runnable runnable) {
            this.f1350a = runnable;
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionCancel(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionEnd(Transition transition) {
            this.f1350a.run();
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionPause(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionResume(Transition transition) {
        }

        @Override // android.transition.Transition.TransitionListener
        public void onTransitionStart(Transition transition) {
        }
    }

    /* renamed from: androidx.fragment.app.l0$e */
    /* loaded from: classes.dex */
    public class C0329e extends Transition.EpicenterCallback {

        /* renamed from: a */
        public final /* synthetic */ Rect f1352a;

        public C0329e(Rect rect) {
            this.f1352a = rect;
        }

        @Override // android.transition.Transition.EpicenterCallback
        public Rect onGetEpicenter(Transition transition) {
            Rect rect = this.f1352a;
            if (rect == null || rect.isEmpty()) {
                return null;
            }
            return this.f1352a;
        }
    }

    /* renamed from: C */
    public static boolean m4053C(Transition transition) {
        List targetIds;
        List targetNames;
        List targetTypes;
        targetIds = transition.getTargetIds();
        if (AbstractC0349n0.m3911l(targetIds)) {
            targetNames = transition.getTargetNames();
            if (AbstractC0349n0.m3911l(targetNames)) {
                targetTypes = transition.getTargetTypes();
                if (AbstractC0349n0.m3911l(targetTypes)) {
                    return false;
                }
            }
        }
        return true;
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: A */
    public void mo3924A(Object obj, ArrayList<View> arrayList, ArrayList<View> arrayList2) {
        List targets;
        List targets2;
        TransitionSet transitionSet = (TransitionSet) obj;
        if (transitionSet != null) {
            targets = transitionSet.getTargets();
            targets.clear();
            targets2 = transitionSet.getTargets();
            targets2.addAll(arrayList2);
            mo3906q(transitionSet, arrayList, arrayList2);
        }
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: B */
    public Object mo3923B(Object obj) {
        if (obj == null) {
            return null;
        }
        TransitionSet transitionSet = new TransitionSet();
        transitionSet.addTransition((Transition) obj);
        return transitionSet;
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: a */
    public void mo3922a(Object obj, View view) {
        if (obj != null) {
            ((Transition) obj).addTarget(view);
        }
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: b */
    public void mo3921b(Object obj, ArrayList<View> arrayList) {
        List targets;
        int transitionCount;
        Transition transitionAt;
        Transition transition = (Transition) obj;
        if (transition == null) {
            return;
        }
        int i = 0;
        if (transition instanceof TransitionSet) {
            TransitionSet transitionSet = (TransitionSet) transition;
            transitionCount = transitionSet.getTransitionCount();
            while (i < transitionCount) {
                transitionAt = transitionSet.getTransitionAt(i);
                mo3921b(transitionAt, arrayList);
                i++;
            }
        } else if (m4053C(transition)) {
        } else {
            targets = transition.getTargets();
            if (AbstractC0349n0.m3911l(targets)) {
                int size = arrayList.size();
                while (i < size) {
                    transition.addTarget(arrayList.get(i));
                    i++;
                }
            }
        }
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: c */
    public void mo3920c(ViewGroup viewGroup, Object obj) {
        TransitionManager.beginDelayedTransition(viewGroup, (Transition) obj);
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: e */
    public boolean mo3918e(Object obj) {
        return obj instanceof Transition;
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: g */
    public Object mo3916g(Object obj) {
        Transition clone;
        if (obj != null) {
            clone = ((Transition) obj).clone();
            return clone;
        }
        return null;
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: m */
    public Object mo3910m(Object obj, Object obj2, Object obj3) {
        TransitionSet addTransition;
        TransitionSet addTransition2;
        Transition transition = (Transition) obj;
        Transition transition2 = (Transition) obj2;
        Transition transition3 = (Transition) obj3;
        if (transition != null && transition2 != null) {
            addTransition = new TransitionSet().addTransition(transition);
            addTransition2 = addTransition.addTransition(transition2);
            transition = addTransition2.setOrdering(1);
        } else if (transition == null) {
            transition = transition2 != null ? transition2 : null;
        }
        if (transition3 != null) {
            TransitionSet transitionSet = new TransitionSet();
            if (transition != null) {
                transitionSet.addTransition(transition);
            }
            transitionSet.addTransition(transition3);
            return transitionSet;
        }
        return transition;
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: n */
    public Object mo3909n(Object obj, Object obj2, Object obj3) {
        TransitionSet transitionSet = new TransitionSet();
        if (obj != null) {
            transitionSet.addTransition((Transition) obj);
        }
        if (obj2 != null) {
            transitionSet.addTransition((Transition) obj2);
        }
        if (obj3 != null) {
            transitionSet.addTransition((Transition) obj3);
        }
        return transitionSet;
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: p */
    public void mo3907p(Object obj, View view) {
        if (obj != null) {
            ((Transition) obj).removeTarget(view);
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:9:0x001f, code lost:
        r0 = r5.getTargets();
     */
    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: q */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void mo3906q(Object obj, ArrayList<View> arrayList, ArrayList<View> arrayList2) {
        List targets;
        int transitionCount;
        Transition transitionAt;
        Transition transition = (Transition) obj;
        int i = 0;
        if (transition instanceof TransitionSet) {
            TransitionSet transitionSet = (TransitionSet) transition;
            transitionCount = transitionSet.getTransitionCount();
            while (i < transitionCount) {
                transitionAt = transitionSet.getTransitionAt(i);
                mo3906q(transitionAt, arrayList, arrayList2);
                i++;
            }
        } else if (!m4053C(transition) && targets != null && targets.size() == arrayList.size() && targets.containsAll(arrayList)) {
            int size = arrayList2 == null ? 0 : arrayList2.size();
            while (i < size) {
                transition.addTarget(arrayList2.get(i));
                i++;
            }
            for (int size2 = arrayList.size() - 1; size2 >= 0; size2--) {
                transition.removeTarget(arrayList.get(size2));
            }
        }
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: r */
    public void mo3905r(Object obj, View view, ArrayList<View> arrayList) {
        ((Transition) obj).addListener(new C0326b(view, arrayList));
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: t */
    public void mo3903t(Object obj, Object obj2, ArrayList<View> arrayList, Object obj3, ArrayList<View> arrayList2, Object obj4, ArrayList<View> arrayList3) {
        ((Transition) obj).addListener(new C0327c(obj2, arrayList, obj3, arrayList2, obj4, arrayList3));
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: u */
    public void mo3902u(Object obj, Rect rect) {
        if (obj != null) {
            ((Transition) obj).setEpicenterCallback(new C0329e(rect));
        }
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: v */
    public void mo3901v(Object obj, View view) {
        if (view != null) {
            Rect rect = new Rect();
            m3912k(view, rect);
            ((Transition) obj).setEpicenterCallback(new C0325a(rect));
        }
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: w */
    public void mo3900w(Fragment fragment, Object obj, C0605h c0605h, Runnable runnable) {
        ((Transition) obj).addListener(new C0328d(runnable));
    }

    @Override // androidx.fragment.app.AbstractC0349n0
    /* renamed from: z */
    public void mo3897z(Object obj, View view, ArrayList<View> arrayList) {
        List targets;
        TransitionSet transitionSet = (TransitionSet) obj;
        targets = transitionSet.getTargets();
        targets.clear();
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            AbstractC0349n0.m3919d(targets, arrayList.get(i));
        }
        targets.add(view);
        arrayList.add(view);
        mo3921b(transitionSet, arrayList);
    }
}