45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
package com.ubt.jimu.utils;
|
|
|
|
import android.app.Activity;
|
|
import android.content.pm.ActivityInfo;
|
|
import android.content.res.TypedArray;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Method;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class UiUtils {
|
|
public static boolean a(Activity activity) {
|
|
try {
|
|
Field declaredField = Activity.class.getDeclaredField("mActivityInfo");
|
|
declaredField.setAccessible(true);
|
|
((ActivityInfo) declaredField.get(activity)).screenOrientation = -1;
|
|
declaredField.setAccessible(false);
|
|
return true;
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static boolean b(Activity activity) {
|
|
boolean z;
|
|
try {
|
|
TypedArray obtainStyledAttributes = activity.obtainStyledAttributes((int[]) Class.forName("com.android.internal.R$styleable").getField("Window").get(null));
|
|
Method method = ActivityInfo.class.getMethod("isTranslucentOrFloating", TypedArray.class);
|
|
method.setAccessible(true);
|
|
z = ((Boolean) method.invoke(null, obtainStyledAttributes)).booleanValue();
|
|
try {
|
|
method.setAccessible(false);
|
|
} catch (Exception e) {
|
|
e = e;
|
|
e.printStackTrace();
|
|
return z;
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
z = false;
|
|
}
|
|
return z;
|
|
}
|
|
}
|