#Region Project Attributes
#ApplicationLabel: TDScreenOnOff
#VersionCode: 1
#VersionName: TDScreenOnOFF
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Private xui As XUI
End Sub
Sub Globals
Private PWS As PhoneWakeState
Private statusAn As Boolean = False
Private btAn As Label
Private btClose As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Activity.Title = "TDScreenON: Bildschirm immer an?"
End Sub
Private Sub btClose_Click
' reset screen on to phone standard
PWS.ReleaseKeepAlive
' close all activities
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAffinity", Null)
End Sub
Private Sub btAn_Click
' toogle status
statusAn = Not(statusAn)
If statusAn Then
' disable phone standard screen timeout
PWS.KeepAlive(True)
' set button param
btAn.Color = Colors.yellow
btAn.TextColor=Colors.black
btAn.Text = "Bleibt immer an!"
Else
' enable phone standard screen timeout
PWS.ReleaseKeepAlive
' set button param
btAn.Color = Colors.blue
btAn.TextColor=Colors.white
btAn.Text = "Ja, immer anschalten."
End If
End Sub