package X6FRs_4.JZJr_16;

import android.animation.LayoutTransition;
import android.util.Log;
import android.view.ViewGroup;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* compiled from: ViewGroupUtilsApi14.java */
/* loaded from: classes.dex */
public class NzhupJ_29 {
    public static LayoutTransition KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public static Field f584KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public static Method f585KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public static boolean f586KQgRr5e_0;
    public static boolean QxJ9d_1;

    /* compiled from: ViewGroupUtilsApi14.java */
    /* loaded from: classes.dex */
    public static class KQgRr5e_0 extends LayoutTransition {
        @Override // android.animation.LayoutTransition
        public boolean isChangingLayout() {
            return true;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:31:0x0081  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x008e  */
    /* JADX WARN: Removed duplicated region for block: B:44:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static void KQgRr5e_0(ViewGroup viewGroup, boolean z) {
        LayoutTransition layoutTransition;
        boolean z2 = false;
        if (KQgRr5e_0 == null) {
            KQgRr5e_0 kQgRr5e_0 = new KQgRr5e_0();
            KQgRr5e_0 = kQgRr5e_0;
            kQgRr5e_0.setAnimator(2, null);
            KQgRr5e_0.setAnimator(0, null);
            KQgRr5e_0.setAnimator(1, null);
            KQgRr5e_0.setAnimator(3, null);
            KQgRr5e_0.setAnimator(4, null);
        }
        if (z) {
            LayoutTransition layoutTransition2 = viewGroup.getLayoutTransition();
            if (layoutTransition2 != null) {
                if (layoutTransition2.isRunning()) {
                    KQgRr5e_0(layoutTransition2);
                }
                if (layoutTransition2 != KQgRr5e_0) {
                    viewGroup.setTag(WwEq_13.transition_layout_save, layoutTransition2);
                }
            }
            viewGroup.setLayoutTransition(KQgRr5e_0);
            return;
        }
        viewGroup.setLayoutTransition(null);
        if (!f586KQgRr5e_0) {
            try {
                Field declaredField = ViewGroup.class.getDeclaredField("mLayoutSuppressed");
                f584KQgRr5e_0 = declaredField;
                declaredField.setAccessible(true);
            } catch (NoSuchFieldException unused) {
                Log.i("ViewGroupUtilsApi14", "Failed to access mLayoutSuppressed field by reflection");
            }
            f586KQgRr5e_0 = true;
        }
        Field field = f584KQgRr5e_0;
        if (field != null) {
            try {
                boolean z3 = field.getBoolean(viewGroup);
                if (z3) {
                    try {
                        f584KQgRr5e_0.setBoolean(viewGroup, false);
                    } catch (IllegalAccessException unused2) {
                        z2 = z3;
                        Log.i("ViewGroupUtilsApi14", "Failed to get mLayoutSuppressed field by reflection");
                        if (z2) {
                        }
                        layoutTransition = (LayoutTransition) viewGroup.getTag(WwEq_13.transition_layout_save);
                        if (layoutTransition == null) {
                        }
                    }
                }
                z2 = z3;
            } catch (IllegalAccessException unused3) {
            }
        }
        if (z2) {
            viewGroup.requestLayout();
        }
        layoutTransition = (LayoutTransition) viewGroup.getTag(WwEq_13.transition_layout_save);
        if (layoutTransition == null) {
            viewGroup.setTag(WwEq_13.transition_layout_save, null);
            viewGroup.setLayoutTransition(layoutTransition);
        }
    }

    public static void KQgRr5e_0(LayoutTransition layoutTransition) {
        if (!QxJ9d_1) {
            try {
                Method declaredMethod = LayoutTransition.class.getDeclaredMethod("cancel", new Class[0]);
                f585KQgRr5e_0 = declaredMethod;
                declaredMethod.setAccessible(true);
            } catch (NoSuchMethodException unused) {
                Log.i("ViewGroupUtilsApi14", "Failed to access cancel method by reflection");
            }
            QxJ9d_1 = true;
        }
        Method method = f585KQgRr5e_0;
        if (method != null) {
            try {
                method.invoke(layoutTransition, new Object[0]);
            } catch (IllegalAccessException unused2) {
                Log.i("ViewGroupUtilsApi14", "Failed to access cancel method by reflection");
            } catch (InvocationTargetException unused3) {
                Log.i("ViewGroupUtilsApi14", "Failed to invoke cancel method by reflection");
            }
        }
    }
}
