B4A Library MusicBobber (Audio Widget Overlay View)

Enjoy this beautiful widget Overlay https://github.com/Cleveroad/MusicBobber from our beautiful B4A :)
Awesome Audio Widget for any Android Music App

header_.jpg


@DependsOn(values={"android-support-v4","audiowidget.aar"})

MusicBobber
Author:
SMM
Version: 0.01
  • MusicBobber
    Events:
    • _albumclicked
    • _nextlongclicked
    • _playlistlongclicked
    • _previouslongclicked
    • _albumlongclicked
    • _nextclicked
    • _playpauseclicked
    • _playpauselongclicked
    • _previousclick
    • _statechanged (state As String)
    • _widgetpositionchanged (x As Int, y As Int)
    Methods:
    • Initialize (EventName As String)
    • Initialize2 (EventName As String, lightcolor As Int, darkcolor As Int, expandwidgetColor As Int, progresscolor As Int, progressStrokewidth As Float, crosscolor As Int, crossoverlappedColor As Int, crossStrokewidth As Float, buttonpadding As Int, bubblesminSize As Float, bubblesmaxSize As Float, shadowcolor As Int, shadowradius As Float, shadowdx As Float, shadowdy As Float, playdrawable As Drawable, pausedrawable As Drawable, playlistdrawable As Drawable, prevtrackDrawale As Drawable, nexttrackDrawable As Drawable, defaultalbumDrawable As Drawable, edgeoffsetXCollapsed As Int, edgeoffsetYCollapsed As Int, edgeoffsetXExpanded As Int, edgeoffsetYExpanded As Int)
    • IsInitialized As Boolean
    • collapse
    • expand
    • hide
    • isShown As Boolean
    • show (x As Int, y As Int)
    Permissions:
    • android.permission.SYSTEM_ALERT_WINDOW
    • android.permission.VIBRATE


Sample Service

B4X:
#Region  Service Attributes
    #StartAtBoot: False

#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 mb As MusicBobber
End Sub

Sub Service_Create
    'I am too lazy to fully test Initialize2 :D
'    mb.Initialize2("mb",Colors.LightGray,Colors.Black,Colors.LightGray,Colors.Black,2,Colors.Black,Colors.LightGray,3,1dip,30dip,100dip,Colors.Black,1dip,0,0,Null,Null,Null,Null,Null,Null,1dip,1dip,2dip,2dip)
    mb.Initialize("mb")
    mb.show(0,0)
End Sub

Sub Service_Start (StartingIntent As Intent)

End Sub

Sub Service_Destroy

End Sub



Sub mb_widgetpositionchanged(x As Int,y As Int)
    Log("("&x&","&y&")")
End Sub
Sub mb_playpauseclicked
    Log("mb_playpauseclicked")
End Sub



Version 3 just correcting a typo reported here thanks NJDude :) I hope there are no more typos .

Version 2 adds two parameters to Initialize methods so you can customize these options from original library
  • OnControlsClickListener.onPlaylistClicked should return true to consume the action or false to use default behavior (collapse the widget)
  • OnControlsClickListener.onPlayPauseClicked should return true to consume the action or false to use default behavior (change play/pause state)
thank you MarcoRome :)
 

Attachments

  • MusicBobber.zip
    171.9 KB · Views: 280
  • MusicBobber2.zip
    7.4 KB · Views: 211
  • MusicBobber3.zip
    7.4 KB · Views: 262
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Great work. But button "Pause". Wha i do for see this ?
I read:
  • OnControlsClickListener.onPlayPauseClicked should return true to consume the action or false to use default behavior (change play/pause state)
 
Top