B4A Library [Lib] CoverFlow v2.0

Hi guys, as I have promised, CoverFlow is here.

Download the Coverflow.zip

The zip contains the library and an example that´s all


The CoverFlow Class = Neil Davies




B4ACoverFlow
Author:
Giuseppe Salvi
Version: 2
  • PhotoFlow
    Events:
    • ItemClick (Position As Int, Value As Object)
    • ItemLongClick (Position As Int, Value As Object)
    • ItemSelected (Position As Int, Value As Object)
    Methods:
    • AddImage (Dir As String, FileName As String)
      Add an image at the end of the PhotoFlow from sdcard or AssetsDir
      Example:
      PhotoFlow.AddImage(File.DirRootExternal,"a.jpg")
    • AddImageAt (index As Int, Dir As String, FileName As String)
      Add an image to the desired position in the PhotoFlow from sdcard or AssetsDir
      Example:
      PhotoFlow.AddImage(1,File.DirRootExternal,"a.jpg")
    • BringToFront
    • ClearCache
      Delete entire disk and memory cache created before
    • GetImageListFromAssets (path As String) As List
      Get entire list of images stored in assets folder
      Examples:
      Dim lv as ListView
      Dim l as list
      l.Initialize
      lv.Initialize("lv")
      Sub Menu_Click
      Activity.AddView(lv,0,0,100%x,100%y)
      l = Coverflow.GetImageListFromAssets("Here the Images path u've in assets")
      For n = 0 To l.Size-1
      lv.AddSingleLine(l.Get(n))
      next
      End Sub
    • GetItem (position As Int) As String
      Returns Item
      Example:
      i.Bitmap=LoadBitmap("",PhotoFlow.GetItem(Position))
    • InitializeCarousel (EventName As String)
      Initialize the Carousel
    • InitializeCoverflow (EventName As String)
      Initialize the PhotoFlow
    • IsInitialized As Boolean
    • PopulatePhotoFlow (dir As String, path As String)
      Populate PhotoFlow from sdcard not from assets
    • PopulatePhotoFlowFromAssets (path As String)
      Populate CoverFlow from assets not from sdcard
    • RemoveView
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    Permissions:
    • android.permission.WRITE_EXTERNAL_STORAGE
    Properties:
    • AnimationDuration As Int [write only]
      Sets how long the transition animation should run when a child view changes position.
    • Carousel As Boolean [write only]
      Set as Carousel
    • Color As Int [write only]
    • CreateCache As String [write only]
      Sets the name of your own cache
      Examples:
      PhotoFlow.CreateCache = "Your cache Name Here")
      It'll create a cache in "Android/data/Your cache name/cache/.thumbs" in to SdCard
    • Enabled As Boolean
    • FadingEdgeLength As Int [write only]
      Set the size of the faded edge used to indicate that more content in this view is available.
    • Height As Int
    • ItemHeight As Int
      Get or Set ItemHeight
    • ItemWidth As Int
      Get or Sets ItemWidth
    • Left As Int
    • Length As Int [read only]
      Returns lenght
    • Reverse As Boolean [write only]
      Set reverse
    • Selection As Int [write only]
      Jump directly to a specific item in the adapter data.
    • ShowText As Boolean
      Get or Sets the visibility of the text - by default is hide
    • Spacing As Int [write only]
      Sets the spacing between items in a Gallery
    • Tag As Object
    • TextColor As Int
      Get or Sets Text Color - by default is White
    • TextSize As Int
      Get or Sets Text size
    • Top As Int
    • Version As String [read only]
      Return Author and Version of this library
    • Visible As Boolean
    • Width As Int
 

Attachments

  • coverflow.jpg
    coverflow.jpg
    83.8 KB · Views: 2,463
  • coverflow2.jpg
    coverflow2.jpg
    81.1 KB · Views: 2,254
  • CoverFlow with Text.jpg
    CoverFlow with Text.jpg
    115.6 KB · Views: 1,662
  • B4ACoverFlow v.1.70.zip
    36.2 KB · Views: 550
  • B4ACoverFlow v.1.80.zip
    40.2 KB · Views: 549
  • B4ACoverFlow v2.0 fix.zip
    40.6 KB · Views: 1,163
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User
hi MrJoey, addimage(bmp as bitmap) it's the some way AddImage(dir , filename)

Example:


Dim b as Bitmap = LoadBitmap(File.DirAssets,"icon.png") -> AddImage(b) this what u ask to add any images as a Bitmap to coverflow.

^
AddImage(File.DirAssets,"icon.png") -> this is the way to add any images to coverflow.
 

Mrjoey

Active Member
Licensed User
Longtime User
hi mr Lonleystar , thats not what im asking for , my point is to load a bitmap already loaded from an mp3 album cover so the bitmap is : bmp.bitmap = cover.bitmap and i want to load bmp into coverflow so the bmp does not exist on storage , its loaded in memory , however i can save the bmp to a file and then load it again using LoadBitmap(File.DirAssets,"bmp.png") but that way is not efficient hope u understood my point tnx for ur caring :)
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Hello lonleystar,

It´s a lot of trouble to put a propertie to choose a cover with accelerometer?

I can explain: i´m a developing right now to GOOGLE GLASS and imagine you don´t have any screen to touch, only the movements from your head.

Imagine you have 5 covers, and I need choose one of them, then with a little movement to the right or left and wait a "n" seconds, then choose automaticly.

Can You do that?

Look the principal menu of glass, working the same, but in vertical way

SNP_3082137_en_v2
 

Mrjoey

Active Member
Licensed User
Longtime User
Hello lonleystar,

It´s a lot of trouble to put a propertie to choose a cover with accelerometer?

I can explain: i´m a developing right now to GOOGLE GLASS and imagine you don´t have any screen to touch, only the movements from your head.

Imagine you have 5 covers, and I need choose one of them, then with a little movement to the right or left and wait a "n" seconds, then choose automaticly.

Can You do that?

Look the principal menu of glass, working the same, but in vertical way

SNP_3082137_en_v2
i think mr lonelystar can do nothing about it , u have to focus on accelerometer calls and then call coverflow from that calls
 

ronovar

Active Member
Licensed User
Longtime User
Can You please modify a little Your excellent plugin to be scrollable images with text like on image bellow? This will be great.

https://lh3.ggpht.com/hSa0pnHGNyILc9-rgOYzjgPHi4_2uMkbuR9Ywp4mS2avnDILCqEIjastTlFHx0M1S9c=h900-rw

https://play.google.com/store/apps/details?id=com.archos.mediacenter.video

I would like to make videoplaying my own personal library like on pictures but with JSON of my private server. I have successfully get JSON data from my server to android device but i im missing this excellent left scroller like on picture.
 

ronovar

Active Member
Licensed User
Longtime User
Yes, this is what i need. I will now try to implement this into my current project, it looks very very good.

When i get success i will post here example pictures of my video projects.

Thanks.
 

ronovar

Active Member
Licensed User
Longtime User
Ok, no hurry. Just make it when you have time. I will wait until is finished. If i can give just one hint...if you can make it like in the original picture vertical scroller with pictures and text right to the picture and space between images in vertical scroller if you cann add api function that user can specify space between images in vertical images. Just a hint. If is too much work please ignore this hints.

Many Thanks for making new library.
 

Mrjoey

Active Member
Licensed User
Longtime User
hey mr lonleystar , i have some wish list ,
1 : edit the text , the text above the image displays the image name , i want to change that and put something else
2 : edit the position of the images , by default coverflow when initialized it displays the images from position 0 to item length , so i would like to make that position editable , so when initialized i want to make lets say the position 5 to be in the center
hope that would be possible , tnx man :)
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Mrjoey, for the text yes we can do that god idea thx.

for the Selection below.


Dim Coverflow As PhotoFlow

Coverflow.Selection = 33 that's all but don't forget to put Selection at the end of the code like below.


B4X:
Sub Activity_Create(FirstTime As Boolean)

    Coverflow.InitializeCoverflow("Coverflow")
 
    Coverflow.CreateCache = "Pippo.Pluto.Paperino"

    Activity.AddView(Coverflow, 0dip, 0dip, 100%x, 100%y)
    Coverflow.Spacing= -20
    Coverflow.ItemWidth = 500
    Coverflow.ItemHeight = 600
    Coverflow.AnimationDuration=800

    Coverflow.PopulatePhotoFlow(File.DirRootExternal, "Images2") 
    Activity.Title = "G.Salvi - Items = " & Coverflow.Length & " -  Width = " & Coverflow.ItemWidth&" | Height = "&Coverflow.ItemHeight

 
    Coverflow.ShowText = True
    Coverflow.TextColor = Colors.Yellow
    Coverflow.TextSize = 12
    'Coverflow.Carousel = True
    'Coverflow.Reverse = True

*******************************

    Coverflow.Selection = 33
 
*******************************

End Sub
 

Mrjoey

Active Member
Licensed User
Longtime User
Hi Mrjoey, for the text yes we can do that god idea thx.

for the Selection below.


Dim Coverflow As PhotoFlow

Coverflow.Selection = 33 that's all but don't forget to put Selection at the end of the code like below.


B4X:
Sub Activity_Create(FirstTime As Boolean)

    Coverflow.InitializeCoverflow("Coverflow")

    Coverflow.CreateCache = "Pippo.Pluto.Paperino"

    Activity.AddView(Coverflow, 0dip, 0dip, 100%x, 100%y)
    Coverflow.Spacing= -20
    Coverflow.ItemWidth = 500
    Coverflow.ItemHeight = 600
    Coverflow.AnimationDuration=800

    Coverflow.PopulatePhotoFlow(File.DirRootExternal, "Images2")
    Activity.Title = "G.Salvi - Items = " & Coverflow.Length & " -  Width = " & Coverflow.ItemWidth&" | Height = "&Coverflow.ItemHeight


    Coverflow.ShowText = True
    Coverflow.TextColor = Colors.Yellow
    Coverflow.TextSize = 12
    'Coverflow.Carousel = True
    'Coverflow.Reverse = True

*******************************

    Coverflow.Selection = 33

*******************************

End Sub
Oh that s great for the "selection" , works great , waiting for text editing and if u can make another option for the text to be whether at the top or at the bottom tnx man appreciate it :)
 
Last edited:

Mrjoey

Active Member
Licensed User
Longtime User
i suggest also : coverflow.RemoveAllItems or coverflow.RemoveItemAt
its good to remove all the items loaded and refill it with new images or remove specific items , tnx :)
 
Top