Sub Activity_Create(FirstTime As Boolean)
Dim jo As JavaObject = Activity
Dim e As Object = jo.CreateEvent("android.view.View.OnSystemUiVisibilityChangeListener", "VisibilityChanged", Null)
jo.RunMethod("setOnSystemUiVisibilityChangeListener", Array As Object(e))
Activity.Width = -1
Activity.Height = -1
End Sub
Sub Activity_Resume
Activity.Color = Colors.Red
End Sub
Sub ForceImmersiveMode
Dim r As Reflector
r.Target = r.GetActivity
r.Target = r.RunMethod("getWindow")
r.Target = r.RunMethod("getDecorView")
r.RunMethod2("setSystemUiVisibility", 5894, "java.lang.int")
End Sub
Sub VisibilityChanged_Event(MethodName As String, Args() As Object) As Object
ForceImmersiveMode
End Sub
Sub Activity_WindowFocusChanged(HasFocus As Boolean)
If HasFocus Then
ForceImmersiveMode
End If
End Sub