mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-18 08:36:56 -04:00
cleanup(tools): remove unused code related to fullscreen
This commit is contained in:
committed by
Maksim Belov
parent
f2e95b6e65
commit
9a7fb2ae69
@@ -513,33 +513,7 @@ public final class Tools {
|
||||
return displayMetrics;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void setFullscreenLegacy(Activity activity, boolean fullscreen) {
|
||||
final View decorView = activity.getWindow().getDecorView();
|
||||
View.OnSystemUiVisibilityChangeListener visibilityChangeListener = visibility -> {
|
||||
boolean multiWindowMode = SDK_INT >= 24 && activity.isInMultiWindowMode();
|
||||
// When in multi-window mode, asking for fullscreen makes no sense (cause the launcher runs in a window)
|
||||
// So, ignore the fullscreen setting when activity is in multi window mode
|
||||
if(fullscreen && !multiWindowMode){
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
}else{
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
|
||||
};
|
||||
decorView.setOnSystemUiVisibilityChangeListener(visibilityChangeListener);
|
||||
visibilityChangeListener.onSystemUiVisibilityChange(decorView.getSystemUiVisibility()); //call it once since the UI state may not change after the call, so the activity wont become fullscreen
|
||||
}
|
||||
|
||||
|
||||
private static void setFullscreenSdk30(Activity activity, boolean fullscreen) {
|
||||
public static void setFullscreen(Activity activity, boolean fullscreen) {
|
||||
WindowInsetsControllerCompat windowInsetsController =
|
||||
WindowCompat.getInsetsController(activity.getWindow(), activity.getWindow().getDecorView());
|
||||
if (windowInsetsController == null) {
|
||||
@@ -573,15 +547,6 @@ public final class Tools {
|
||||
|
||||
}
|
||||
|
||||
public static void setFullscreen(Activity activity, boolean fullscreen) {
|
||||
setFullscreenSdk30(activity, fullscreen);
|
||||
/*
|
||||
if (SDK_INT >= Build.VERSION_CODES.R) {
|
||||
}else {
|
||||
setFullscreenLegacy(activity, fullscreen);
|
||||
}*/
|
||||
}
|
||||
|
||||
public static DisplayMetrics currentDisplayMetrics;
|
||||
|
||||
public static void updateWindowSize(Activity activity) {
|
||||
|
||||
Reference in New Issue
Block a user