'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim StartVideo As Timer
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.
Dim cnv As Canvas
Dim stpanel As Panel
Dim xcenter,ycenter As Int
Dim lv As LayoutValues
Dim vv As VideoView
Dim Video As Int
Dim PlayStart As Long
Dim Picture As Int
Dim IV As ImageView
Dim mc As Controls
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("starscroll") 'nothing special just stpanel + exitbtn
lv = GetDeviceLayoutValues
' resize panel
stpanel.Width = lv.Width
stpanel.height= lv.Height
cnv.Initialize(stpanel)
mc.Initialize(Activity, Me)
xcenter = stpanel.Width / 2
ycenter = stpanel.Height / 2
mc.NavBarOff' mc.NavBarOn
mc.ActionBarOff ' mc.ActionBarOn
If FirstTime = True Then
StartVideo.Initialize("StartVideo", 1000)
StartVideo.Enabled =False
End If
' ShowPictures
Video=1
PlayStart=DateTime.Now
PlayVideo
End Sub
Sub Activity_Resume
' Video=1
' PlayVideo
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub PlayVideo
Dim VideoName As String
' FullScreen(True,"Main" )
Select Case Video
Case 1 :
VideoName = "Iris.avi"
vv.Initialize("vv")
vv.MediaControllerEnabled = False
Activity.AddView(vv, 0, 0, 640 , 480 )
vv.SetLayout (0,0,stpanel.Width*4,stpanel.Height*4)'Top,Left,Width,Height
Case 2 : VideoName = "Spiral.mp4"
Case 3 : VideoName = "Star.mp4"
Case 4 : VideoName = "Swirl1.avi"
Case 5 : VideoName = "Swirl2.mp4"
Case 6 : VideoName = "WindMill.avi"
Case 7 : VideoName = "WindMill2.avi"
Case 8 : VideoName = "WindMill3.avi"
Case 9 : VideoName = "WindMill4.avi"
Case 10 : VideoName = "PsychoSpin.mp4"
End Select
' If vv.isinitialized = True Then vv.RemoveView
vv.LoadVideo(File.DirRootExternal, "/Media/Video/" & VideoName)
' File.DirRootExternal = /mnt/sdcard
StartVideo.Enabled =True
End Sub
Sub vv_Complete 'Playing completed
If Video<10 Then
Video=Video+1
Else
Video=1
End If
If (DateTime.Now - PlayStart) < 120000 Then
PlayVideo
Else
If Video<>1 Then
PlayVideo
Else
ExitApplication
End If
End If
End Sub
Sub StartVideo_Tick
If vv.Duration > 0 Then
StartVideo.Enabled = False
vv.Play
End If
End Sub