Well if you want to do it only once, simply copy the dimming code in the Activity onCreate event.
But if you want to control it yourself, dim or undim, the easiest way seems to be using Bridge, from Gideros Labs (aka Native UI http://giderosmobile.com/labs/native-ui)
You can add two new functions to GBridge.java file:
publicstaticvoid dimBar(){View decorView = sActivity.get().getWindow().getDecorView();int uiOptions =View.SYSTEM_UI_FLAG_LOW_PROFILE;
decorView.setSystemUiVisibility(uiOptions);}publicstaticvoid unDimBar(){View decorView = sActivity.get().getWindow().getDecorView();// Calling setSystemUiVisibility() with a value of 0 clears// all flags.
decorView.setSystemUiVisibility(0);}
and use it in lua through the bridge:
local bridge = native.getClass("com.giderosmobile.android.plugins.bridge.GBridge")
bridge.dimBar()
thanks, for the first solution, the problem is that on each touch of the status bar (according to the android page explanation) the dimming is reseted and the app has to set it again manually at some point. i don't know if/how that's possible to make some 'eventlistener' in java that sets dimming on regularly. the second solution seems best with the native ui.
Android has some rules regarding their UI, mostly that touching the status bar should undim it, and that touching anywhere the screen should show the software-buttons (if that device has them...)
Doing a auto-dimming or auto-hiding again that is too agressive might make google delete your app when they find about it.
What you should do instead if find another solution for dimming it again, most likely put the dimming code when the app comes to foreground, and after you handle the back-button (ie: if the reason the UI is undimmed was because you pressed the back button to change the screen, then it is safe to assume the person won't need the UI for now again, thus you can dim it again).
By the way, both of these can be done from within Gideros Lua. (Gideros if I remember has events for hardware back button and for the app going or returning from background).
Comments
But if you want to control it yourself, dim or undim, the easiest way seems to be using Bridge, from Gideros Labs (aka Native UI http://giderosmobile.com/labs/native-ui)
You can add two new functions to GBridge.java file:
for the first solution, the problem is that on each touch of the status bar (according to the android page explanation) the dimming is reseted and the app has to set it again manually at some point. i don't know if/how that's possible to make some 'eventlistener' in java that sets dimming on regularly.
the second solution seems best with the native ui.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Android has some rules regarding their UI, mostly that touching the status bar should undim it, and that touching anywhere the screen should show the software-buttons (if that device has them...)
Doing a auto-dimming or auto-hiding again that is too agressive might make google delete your app when they find about it.
What you should do instead if find another solution for dimming it again, most likely put the dimming code when the app comes to foreground, and after you handle the back-button (ie: if the reason the UI is undimmed was because you pressed the back button to change the screen, then it is safe to assume the person won't need the UI for now again, thus you can dim it again).
Fragmenter - animated loop machine and IKONOMIKON - the memory game