#Region Project Attributes
#ApplicationLabel: MusicPlayerView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#AdditionalJar: picasso-2.5.2
#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 MediaPlayer1 As MediaPlayer
Dim nativeMe 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.
Private mpv As MusicPlayerView
Dim bm As Bitmap
Dim imv1, imv2 As ImageView
Dim flag As Int = 0
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
nativeMe.InitializeContext
Activity.LoadLayout("main")
mpv.Initialize("mpv")
imv1.Initialize("imv1")
imv2.Initialize("imv2")
imv1.Bitmap = LoadBitmap(File.DirAssets,"icon_previous.png")
imv2.Bitmap = LoadBitmap(File.DirAssets,"icon_next.png")
Activity.AddView(mpv, 20%x, 5%y, 60%x, 50%y)
Activity.AddView(imv1, 20%x, 50%y, 30%x, 10%y)
Activity.AddView(imv2, 50%x, 50%y, 30%x, 10%y)
bm.Initialize(File.DirAssets,"1.jpg")
mpv.TimeColor = Colors.red
mpv.PlayerTextSize = 25
mpv.ButtonColor = Colors.Transparent
mpv.ProgressVisibility = True
' mpv.CoverBitmap = bm 'load the spinning image from a bitmap or....
mpv.CoverURL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRI1mwVxCNoS2jyi6X4HEC1rGEJNLjuu6_0ofeuLCqJLabLUO1g" '...fetch an image with Picasso
mpv.ProgressEmptyColor = Colors.white
mpv.ProgressLoadedColor = 0xFF7D26CD
mpv.ProgressLoadedWidth = 15.0
mpv.ProgressEmptyWidth = 5.0
End Sub
Sub Activity_Resume
MediaPlayer1.Initialize( )
MediaPlayer1.Load(File.DirAssets, "1.mp3")
Dim dur As Int = 0
dur = MediaPlayer1.Duration
mpv.Max = dur/1000
End Sub
Sub Activity_Pause (UserClosed As Boolean)
MediaPlayer1.Stop
MediaPlayer1.Release
End Sub
Sub mpv_paused()
mpv.stop
MediaPlayer1.Pause
End Sub
Sub mpv_started()
Dim dur As Int
dur = MediaPlayer1.Duration
mpv.Max = dur/1000
mpv.start
MediaPlayer1.Play
End Sub
Sub imv1_click
End Sub
Sub imv2_click
If flag = 0 Then
mpv.CoverURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQOvdqO7A3pDHJAclAEeQkDjYWYG14dxKJl2eiJdTsyFViCIX2h"
flag = 1
Else
flag = 0
mpv.CoverURL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRI1mwVxCNoS2jyi6X4HEC1rGEJNLjuu6_0ofeuLCqJLabLUO1g"
End If
End Sub