ADD week 5
This commit is contained in:
63
02-Easy5/E5/sources/androidx/transition/ViewGroupUtils.java
Normal file
63
02-Easy5/E5/sources/androidx/transition/ViewGroupUtils.java
Normal file
@@ -0,0 +1,63 @@
|
||||
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() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user