mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 22:18:34 +01:00
fixed status bar and display offset in android demo
This commit is contained in:
parent
3170d45bc1
commit
f5043eea30
1 changed files with 11 additions and 1 deletions
|
@ -23,6 +23,9 @@ namespace Demos.Android {
|
||||||
|
|
||||||
protected override void OnCreate(Bundle bundle) {
|
protected override void OnCreate(Bundle bundle) {
|
||||||
base.OnCreate(bundle);
|
base.OnCreate(bundle);
|
||||||
|
// render under notches
|
||||||
|
if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
|
||||||
|
this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
|
||||||
|
|
||||||
TextInputWrapper.Current = new TextInputWrapper.Mobile();
|
TextInputWrapper.Current = new TextInputWrapper.Mobile();
|
||||||
this.game = new GameImpl();
|
this.game = new GameImpl();
|
||||||
|
@ -30,11 +33,18 @@ namespace Demos.Android {
|
||||||
this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game.Window);
|
this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game.Window);
|
||||||
// disable mouse handling for android to make emulator behavior more coherent
|
// disable mouse handling for android to make emulator behavior more coherent
|
||||||
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
|
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
|
||||||
|
// set the game to fullscreen to cause the status bar to be hidden
|
||||||
|
this.game.GraphicsDeviceManager.IsFullScreen = true;
|
||||||
this.view = this.game.Services.GetService(typeof(View)) as View;
|
this.view = this.game.Services.GetService(typeof(View)) as View;
|
||||||
|
|
||||||
this.SetContentView(this.view);
|
this.SetContentView(this.view);
|
||||||
this.game.Run();
|
this.game.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnWindowFocusChanged(bool hasFocus) {
|
||||||
|
base.OnWindowFocusChanged(hasFocus);
|
||||||
|
// hide the status bar
|
||||||
|
this.view.SystemUiVisibility = (StatusBarVisibility) (SystemUiFlags.LayoutStable | SystemUiFlags.LayoutHideNavigation | SystemUiFlags.LayoutFullscreen | SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen | SystemUiFlags.ImmersiveSticky);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue