#Region Project Attributes
#ApplicationLabel: MaskProgressView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim t 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.
Private mpv1 As MaskProgressView
Dim bm As Bitmap
Dim cnt As Int = 0
Private mpv2 As MaskProgressView
Private b1 As Button
Private b2 As Button
Private b3 As Button
Private b4 As Button
Private b5 As Button
Dim flag As Int = 0
Dim dur As Int = 0
Dim mp1 As MediaPlayer
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
t.Initialize("t", 1000)
bm.Initialize(File.DirAssets,"cover.png")
mpv1.CoverImage = bm
mpv1.MaxSeconds = 60
mpv1.BackgroundMaskColor = 0x260000ff 'mask color to apply to the image - a transparent blue
mpv1.ProgressMaskColor = 0x2600ff00 'mask color to apply to the progress - a transparent green
mpv1.DurationTextSize = 25
mpv1.DurationTextColor = Colors.Transparent
mpv2.CoverImage = bm
mpv2.MaxSeconds = 30
mpv2.BackgroundMaskColor = 0x2600ffff 'mask color to apply to the image - a transparent blue
mpv2.ProgressMaskColor = 0x26ffff00 'mask color to apply to the progress - a transparent green
mpv2.DurationTextSize = 30
mpv2.DurationTextColor = Colors.Magenta
End Sub
Sub Activity_Resume
mp1.Initialize( )
mp1.Load(File.DirAssets, "Mexican-whistler.mp3")
dur = mp1.Duration/1000
End Sub
Sub Activity_Pause (UserClosed As Boolean)
mp1.Stop
mp1.Release
t.Enabled = False
End Sub
Sub t_tick
cnt = cnt + 1
If cnt < 61 Then
mpv1.MaskTo = cnt
Else
t.Enabled = False
mpv1.stop
cnt = 0
End If
End Sub
Sub b1_Click
t.Enabled = True
End Sub
Sub b2_Click
mpv2.stop
If flag = 1 Then
flag = 0
bm.Initialize(File.DirAssets,"cover.png")
mpv2.CoverImage = bm
Else
flag = 1
bm.Initialize(File.DirAssets,"cover2.png")
mpv2.CoverImage = bm
End If
mpv2.start
End Sub
Sub b3_Click
mpv2.MaxSeconds = dur
mp1.Play
mpv2.start
End Sub
Sub b4_Click
mp1.Pause
mpv2.pause
End Sub
Sub b5_Click
mpv2.stop
If flag = 0 Then
flag = 1
bm.Initialize(File.DirAssets,"cover2.png")
mpv2.CoverImage = bm
Else
flag = 0
bm.Initialize(File.DirAssets,"cover.png")
mpv2.CoverImage = bm
End If
mpv2.start
End Sub
Sub mpv2_progress_changed(pos As Int)
Log("position = " & pos)
mp1.Position = pos*1000
End Sub
Sub mpv2_progress_completed()
Log("mpv2 is DONE")
End Sub