I am using an edited version on this code to hide the Navigation Bar on a 7" tablet.
This is a dedicated device for the app and is always in Portrait orientation.
However, I have an issue to sort out:
When I swipe down from the top of the screen, the Navigation Bar reappears.
How can I prevent the user from doing this as the user must never have access to the Navigation Bar?
My code:
Sub Process_Globals
Dim ActivityParent As JavaObject
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
Dim jo As JavaObject = Activity
jo.RunMethodJO("getContext", Null).RunMethodJO("getWindow", Null).RunMethod("setSoftInputMode", Array As Object(0x20))
ActivityParent = jo.RunMethodJO("getParent", Null)
ForceImmersiveMode
End Sub
Sub ForceImmersiveMode
' available flags:
'SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 4096 (0x01000)
'SYSTEM_UI_FLAG_IMMERSIVE = 2048 (0x0800)
'SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024 (0x0400)
'SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512 (0x0200)
'SYSTEM_UI_FLAG_LAYOUT_STABLE = 256 (0x0100)
'SYSTEM_UI_FLAG_FULLSCREEN = 4 (0x04)
'SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2 (0x02)
Dim flag As Int
flag = 5894 '(0x01706)'SYSTEM_UI_FLAG_IMMERSIVE_STICKY + SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + SYSTEM_UI_FLAG_FULLSCREEN + SYSTEM_UI_FLAG_HIDE_NAVIGATION ' 5894 (0x01706)
Dim r As Reflector
r.Target = r.GetActivity
r.Target = r.RunMethod("getWindow")
r.Target = r.RunMethod("getDecorView")
r.RunMethod2("setSystemUiVisibility", flag, "java.lang.int")
Dim ajo As Panel = Activity
Dim width As Int = ActivityParent.RunMethod("getMeasuredWidth", Null)
Dim height As Int = ActivityParent.RunMethod("getMeasuredHeight", Null)
If width = 0 Or height = 0 Then Return
ajo.Width = width 'update the "activity" width and height
ajo.Height = height
ajo.Color = Colors.white
End Sub