SRE/02-Easy5/E5/sources/androidx/transition/ViewGroupUtils.java
2025-03-31 16:33:42 +02:00

64 lines
2.1 KiB
Java

package androidx.transition;
import android.os.Build;
import android.view.ViewGroup;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
class ViewGroupUtils {
private static Method sGetChildDrawingOrderMethod = null;
private static boolean sGetChildDrawingOrderMethodFetched = false;
private static boolean sTryHiddenSuppressLayout = true;
static ViewGroupOverlayImpl getOverlay(ViewGroup viewGroup) {
return new ViewGroupOverlayApi18(viewGroup);
}
static void suppressLayout(ViewGroup viewGroup, boolean z) {
if (Build.VERSION.SDK_INT >= 29) {
viewGroup.suppressLayout(z);
} else {
hiddenSuppressLayout(viewGroup, z);
}
}
private static void hiddenSuppressLayout(ViewGroup viewGroup, boolean z) {
if (sTryHiddenSuppressLayout) {
try {
viewGroup.suppressLayout(z);
} catch (NoSuchMethodError unused) {
sTryHiddenSuppressLayout = false;
}
}
}
static int getChildDrawingOrder(ViewGroup viewGroup, int i) {
int childDrawingOrder;
if (Build.VERSION.SDK_INT >= 29) {
childDrawingOrder = viewGroup.getChildDrawingOrder(i);
return childDrawingOrder;
}
if (!sGetChildDrawingOrderMethodFetched) {
try {
Method declaredMethod = ViewGroup.class.getDeclaredMethod("getChildDrawingOrder", Integer.TYPE, Integer.TYPE);
sGetChildDrawingOrderMethod = declaredMethod;
declaredMethod.setAccessible(true);
} catch (NoSuchMethodException unused) {
}
sGetChildDrawingOrderMethodFetched = true;
}
Method method = sGetChildDrawingOrderMethod;
if (method != null) {
try {
return ((Integer) method.invoke(viewGroup, Integer.valueOf(viewGroup.getChildCount()), Integer.valueOf(i))).intValue();
} catch (IllegalAccessException | InvocationTargetException unused2) {
}
}
return i;
}
private ViewGroupUtils() {
}
}