VUI fixes & improvements pt.3.5

Fixed the controls layout being offset on first start
Fixed the controls layout crashing when loading new control layout
This commit is contained in:
artdeell 2022-11-11 09:57:36 +03:00 committed by ArtDev
parent 8419cee745
commit ca0e9e2c0d
2 changed files with 5 additions and 3 deletions

View File

@ -500,7 +500,7 @@ public final class Tools {
public static void setFullscreen(Activity activity, boolean fullscreen) {
final View decorView = activity.getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener (visibility -> {
View.OnSystemUiVisibilityChangeListener visibilityChangeListener = visibility -> {
if(fullscreen){
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
@ -514,7 +514,9 @@ public final class Tools {
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
}
public static DisplayMetrics currentDisplayMetrics;

View File

@ -242,7 +242,7 @@ public class ControlLayout extends FrameLayout {
@Override
public void onViewRemoved(View child) {
super.onViewRemoved(child);
if(child instanceof ControlInterface){
if(child instanceof ControlInterface && mControlPopup != null){
mControlPopup.disappearColor();
mControlPopup.disappear();
}