62 lines
2.0 KiB
Java
62 lines
2.0 KiB
Java
package androidx.appcompat.widget;
|
|
|
|
import android.graphics.Rect;
|
|
import android.os.Build;
|
|
import android.util.Log;
|
|
import android.view.View;
|
|
import androidx.core.view.ViewCompat;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ViewUtils {
|
|
private static Method a;
|
|
|
|
static {
|
|
if (Build.VERSION.SDK_INT >= 18) {
|
|
try {
|
|
a = View.class.getDeclaredMethod("computeFitSystemWindows", Rect.class, Rect.class);
|
|
if (a.isAccessible()) {
|
|
return;
|
|
}
|
|
a.setAccessible(true);
|
|
} catch (NoSuchMethodException unused) {
|
|
Log.d("ViewUtils", "Could not find method computeFitSystemWindows. Oh well.");
|
|
}
|
|
}
|
|
}
|
|
|
|
public static boolean a(View view) {
|
|
return ViewCompat.k(view) == 1;
|
|
}
|
|
|
|
public static void b(View view) {
|
|
if (Build.VERSION.SDK_INT >= 16) {
|
|
try {
|
|
Method method = view.getClass().getMethod("makeOptionalFitsSystemWindows", new Class[0]);
|
|
if (!method.isAccessible()) {
|
|
method.setAccessible(true);
|
|
}
|
|
method.invoke(view, new Object[0]);
|
|
} catch (IllegalAccessException e) {
|
|
Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e);
|
|
} catch (NoSuchMethodException unused) {
|
|
Log.d("ViewUtils", "Could not find method makeOptionalFitsSystemWindows. Oh well...");
|
|
} catch (InvocationTargetException e2) {
|
|
Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e2);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void a(View view, Rect rect, Rect rect2) {
|
|
Method method = a;
|
|
if (method != null) {
|
|
try {
|
|
method.invoke(view, rect, rect2);
|
|
} catch (Exception e) {
|
|
Log.d("ViewUtils", "Could not invoke computeFitSystemWindows", e);
|
|
}
|
|
}
|
|
}
|
|
}
|