Hello, i've been trying all sorts of things to not make statusbar hide itself when ArFragment loads, but can't seem to successfully do it by setting/clearing various activity window flags. I even tried OnGlobalLayoutListener for sceneView but still no luck. How can this be achieved
This is how i mainly tried it within global listener, scene OnUpdateListener etc.
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
activity?.window?.decorView?.systemUiVisibility = SYSTEM_UI_FLAG_VISIBLE
Navigation bar is also hidden, which i'd like to revert, I assume it is the same fullscreen flag problem
Thanks for the question. Currently there is no way to directly control this via the fragment configuration. A work around is to override the onWindowFocusChanged() methodin a subclass of ArFragment, then you can implement it as needed.
Ok this resolves the problem (if i don't call the super, just to clarify for others). Thanks for your help!
Hi Clayton.
Please, could you explain a little more on this.
How can I use onWindowsFocusChanges from inside a Fragment?
I usually follow this way when an Activity is used:
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
// Get a support ActionBar corresponding to this toolbar
ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
//
if (hasFocus) {
showSystemUI();
}
}
private void showSystemUI() {
// Enables regular immersive mode.
// For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
// Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
...but I can麓t call getSupportActionBar or getWindow (mut I call it through getActivity?) in the case of a Fragment.
Thanks for your time.
Most helpful comment
Thanks for the question. Currently there is no way to directly control this via the fragment configuration. A work around is to override the onWindowFocusChanged() methodin a subclass of ArFragment, then you can implement it as needed.