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,407
  • coverflow2.jpg
    coverflow2.jpg
    81.1 KB · Views: 2,198
  • CoverFlow with Text.jpg
    CoverFlow with Text.jpg
    115.6 KB · Views: 1,614
  • B4ACoverFlow v.1.70.zip
    36.2 KB · Views: 488
  • B4ACoverFlow v.1.80.zip
    40.2 KB · Views: 488
  • B4ACoverFlow v2.0 fix.zip
    40.6 KB · Views: 1,102
Last edited:

ronovar

Active Member
Licensed User
Longtime User
No hurry, i have just ask...i know that there is a loot of javascript cooding...so i will wait.

Do You have any good tutorial how can i write library for B4A using java code? I diassembled some apk and would like to copy code and make library for one component from this apk.I need tutorial to learn how to write library.

Thanks.
 

Mrjoey

Active Member
Licensed User
Longtime User
hello lonelystar , i noticed that when u scroll , the image is loaded , do u mind to share some codes about doing that? i have lots of images i want to add to list , so instead of adding them directly using a loop wish becomes slow , it would fill the list and when the list is finished it will fill then the images hope u did understand my point , any suggestions are appreciated , tnx man keep forward :)
 

Mrjoey

Active Member
Licensed User
Longtime User
Hi MrJoey, I think I understand, but can U make an example in B4Android?.
B4X:
Sub ScrollView1_ScrollChanged(Position As Int)
'If Ind < (mapa.Size/9 )-1 Then
    If Position + ScrollView1.Height >= ScrollView1.Panel.Height Then
    If DateTime.Now > lastAddItemsTime + 1 Then
      lastAddItemsTime = DateTime.Now
    CallSub(Me,"ReadAudios")
    End If
  End If
'End If 
End Sub
this code loads additional items when the scrollview reaches a specific number of items so lets say there is 20 panels added to this scrollview and instead of making a loop to fill that 20 panels once , it add let say 10 and then when the user scrolls down it will add the other 10 , that way is very efficient and public , i think u are using this method in kind of ways , i would like u to share an idea of urs to display images instead , tnx :)
 

ronovar

Active Member
Licensed User
Longtime User
Hi, i im playing with this excellent library and would like to ask if is possible to get images direct from httputils2 using Job.GetBitmap.

I would like to fill coverflow with images from my url link of my server, not to save it to device.

So i have sucessfully used this:

B4X:
CoverFlow1.SetBackgroundImage(Job.GetBitmap)

but this sets last image retrieved from server, witch is what i expected.

So i need the code if is possible to add image to CoverFlow instead of saving it to device.

For example:

CoverFlow1.AddImageFromUrl(Job.GetBitmap)
 

Mrjoey

Active Member
Licensed User
Longtime User
hey , 1 suggestion for next update , im using B4Agallery , and there is a function called setarraylist , can u include it in coverflow? thank u
 

Mrjoey

Active Member
Licensed User
Longtime User
aha appreciate ur hardwork , take ur time man , so this update will coverflow includes setarraylist or the next update u mean? :)
 
Top