Files
rr3-apk/decompiled-community/sources/androidx/appcompat/widget/ViewUtils.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

88 lines
3.1 KiB
Java

package androidx.appcompat.widget;
import android.annotation.SuppressLint;
import android.graphics.Insets;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.WindowInsets;
import androidx.annotation.ChecksSdkIntAtLeast;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class ViewUtils {
@ChecksSdkIntAtLeast(api = 27)
@RestrictTo({RestrictTo.Scope.LIBRARY})
static final boolean SDK_LEVEL_SUPPORTS_AUTOSIZE;
private static final String TAG = "ViewUtils";
private static Method sComputeFitSystemWindowsMethod;
private static boolean sInitComputeFitSystemWindowsMethod;
static {
SDK_LEVEL_SUPPORTS_AUTOSIZE = Build.VERSION.SDK_INT >= 27;
}
private ViewUtils() {
}
public static boolean isLayoutRtl(View view) {
return view.getLayoutDirection() == 1;
}
public static void computeFitSystemWindows(@NonNull View view, @NonNull Rect rect, @NonNull Rect rect2) {
if (Build.VERSION.SDK_INT >= 29) {
Api29Impl.computeFitSystemWindows(view, rect, rect2);
return;
}
if (!sInitComputeFitSystemWindowsMethod) {
sInitComputeFitSystemWindowsMethod = true;
try {
Method declaredMethod = View.class.getDeclaredMethod("computeFitSystemWindows", Rect.class, Rect.class);
sComputeFitSystemWindowsMethod = declaredMethod;
if (!declaredMethod.isAccessible()) {
sComputeFitSystemWindowsMethod.setAccessible(true);
}
} catch (NoSuchMethodException unused) {
}
}
Method method = sComputeFitSystemWindowsMethod;
if (method != null) {
try {
method.invoke(view, rect, rect2);
} catch (Exception unused2) {
}
}
}
@SuppressLint({"BanUncheckedReflection"})
public static void makeOptionalFitsSystemWindows(View view) {
try {
Method method = view.getClass().getMethod("makeOptionalFitsSystemWindows", new Class[0]);
if (!method.isAccessible()) {
method.setAccessible(true);
}
method.invoke(view, new Object[0]);
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
@DoNotInline
public static void computeFitSystemWindows(@NonNull View view, @NonNull Rect rect, @NonNull Rect rect2) {
Insets systemWindowInsets = view.computeSystemWindowInsets(new WindowInsets.Builder().setSystemWindowInsets(Insets.of(rect)).build(), rect2).getSystemWindowInsets();
rect.set(systemWindowInsets.left, systemWindowInsets.top, systemWindowInsets.right, systemWindowInsets.bottom);
}
}
}