B4A Library Music Cover View

A wrapper for this GitHub library https://github.com/andremion/Music-Cover-View

A Subclass of ImageView that 'morphs' into a circle shape and can rotates. Useful to be used as album cover in Music apps.

MusicCoverView
Author:
SMM
Version: 0.02
  • MusicCoverView
    Events:
    • _morphend(mv As MusicCoverView)
    • _rotateend (mv As MusicCoverView)
    • _click
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • Morph
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Start
    • isRunning As Boolean
    • stop
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Parent As Object [read only]
    • Shape As Int [read only]
    • Tag As Object
    • Top As Int
    • TrackColor As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • MusicCoverView.zip
    35.5 KB · Views: 273
  • MusicCoverView (2).zip
    23.6 KB · Views: 222
Last edited:

moster67

Expert
Licensed User
Longtime User
Sweet and cool!
Will try it as soon as I have a moment.
 

moster67

Expert
Licensed User
Longtime User
Can you post a demo app or some code showing how to use the wrapper. Where do I assign the image to use and so forth?
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Can you post a demo app or some code showing how to use the wrapper. Where do I assign the image to use and so forth?
This is my not very neat sample
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim mcv As MusicCoverView
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("Layout1")
    mcv.Initialize("mcv")
    Activity.AddView(mcv,0,0,50%x,50%y)
    mcv.SetBackgroundImage(LoadBitmap(File.DirAssets,"ba.png"))
    mcv.Morph
'    mcv.Start
End Sub

Sub mcv_rotateend
    Log("mcv_onRotateEnd")
    mcv.Morph
End Sub

Sub mcv_morphend
    Log("mcv_onMorphEnd")
    mcv.Start

End Sub
Sub mcv_click
    Log("mcv_click")
    mcv.stop
End Sub
 

Almora

Active Member
Licensed User
Longtime User
Hi..
I put it into practice but it did not work .. I am making a mistake.
 

Attachments

  • cover.zip
    26.8 KB · Views: 190

DonManfred

Expert
Licensed User
Longtime User
I put it into practice but it did not work .. I am making a mistak
i dont see any posted errormessage!?

Edit: Your project is working fine here
 

Almora

Active Member
Licensed User
Longtime User
But it does not move.

The picture is not returning.
 
Last edited:

cxdzbl

Active Member
Licensed User
Rotatable, but the picture does not change into a circle, and has always been a square picture in rotation
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
You guys are right .
I don't know why it does not change into circle .
I will see what I can do
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I uploaded v2 it does not fix the problem but now you get musiccover object in morphend and rotateend events just as original library so we can try something like this (from sample app)
B4X:
@Override
            public void onMorphEnd(MusicCoverView coverView) {
                if (MusicCoverView.SHAPE_CIRCLE == coverView.getShape()) {
                    coverView.start();
                }
which I already tried unsuccessfully :D
 
Top