About Monkey 2 › Forums › Monkey 2 Programming Help › Android fullscreen-immersive
This topic contains 2 replies, has 1 voice, and was last updated by
abakobo
9 months ago.
-
AuthorPosts
-
July 15, 2018 at 11:01 am #15056
Does mx2 alredy features the Android fullscreen modes?
I’d like my app to be in immersive mode..
https://developer.android.com/training/system-ui/immersive
July 16, 2018 at 10:48 am #15058I’ve partially solver the problem, but I can’t find a way to hide the navigation bar once it has been shown (except by “resuming” the app)
Any help on how to “time” the navigation bar or make it disapear by simple touch is welcome!
EDIT: mmm looks like sdl2 is eating the events before I can get them in monkey2game.java?modified monkey2game.java:
Java123456789101112131415161718192021222324252627282930313233343536373839404142434445464748package com.monkey2.monkey2game;import android.os.Bundle;import com.monkey2.lib.Monkey2Activity;import android.view.*;public class Monkey2Game extends Monkey2Activity{protected void onCreate(Bundle savedInstanceState){super.onCreate( savedInstanceState );};protected void onDestroy(){super.onDestroy();}@Overridepublic void onWindowFocusChanged(boolean hasFocus) {super.onWindowFocusChanged(hasFocus);if (hasFocus) {hideSystemUI();}}private void hideSystemUI() {// Enables regular immersive mode.// For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.// Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKYView decorView = getWindow().getDecorView();decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE// Set the content to appear under the system bars so that the// content doesn't resize when the system bars hide and show.| View.SYSTEM_UI_FLAG_LAYOUT_STABLE| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN// Hide the nav bar and status bar| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_FULLSCREEN);}}July 16, 2018 at 5:54 pm #15064onTouchEvent is definitely giving nothing, how can I get those events and hide the nav bar once it’s there? sdl2 must have this implemented, i’m missing something!?
EDIT: had to use SYSTEM_UI_FLAG_IMMERSIVE_STICKY !
I working fine now! Except when I call the keyboard, then the navbar will randomly disapear, or not. So I still need events or some jni magic to call my hide_ui() java method from mx2?
-
AuthorPosts
You must be logged in to reply to this topic.