B4A Library [Lib] CoverFlow v2.0

Discussion in 'Additional libraries, classes and official updates' started by lonleystar, Mar 25, 2013.

  1. lonleystar

    lonleystar Well-Known Member Licensed User

    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
     

    Attached Files:

    Last edited: Mar 30, 2014
  2. margret

    margret Well-Known Member Licensed User

    This looks really good!! I am going to check it out!

    Thanks
     
  3. NJDude

    NJDude Expert Licensed User

    Very nice, thanks!
     
  4. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi margret, thanks to u any comment will be appreciated
     
  5. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi njdude, thanks to u any comment will be appreciated
     
  6. margret

    margret Well-Known Member Licensed User

    I been checking this out and it is really cool! I have hit an out of memory a few times with just 15 images. Does your lib, in the Coverflow.PopulateCoverflow load these images as BitmapSamples? I didn't know if this may contribute to the OM. It is very nice though!! Testing on ASUS TF 10.1" with Android 4.0.3.
     
  7. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi margret, i just test it again with 1200 more jpg and i dont get out of memory i have Samsung Galaxy Tab - p1 with cyanogenmod 4.2.2 and with Samsung Galaxy Tab Note 2 10.1 with JB 4.1.2

    let me know more, thanks again.
     
  8. margret

    margret Well-Known Member Licensed User

    I am sure it's the code that sets the background image, so It's not in the lib but in the B4A code sample. This is not a problem!
     
  9. margret

    margret Well-Known Member Licensed User

    Is there a way before anyone has touched or moved the control to get the Value of the current item displayed? The same Value that:

    Coverflow_ItemSelected(Position As Int, Value As Object)

    Returns.
     
  10. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi margret, yes u r right the problem is in loadbitmap when u try to display an image more the 2 or 3 mb.
     
  11. NJDude

    NJDude Expert Licensed User

    I have a question, I changed the AnimationDuration and I see no difference, even I did something like Coverflow.AnimationDuration = 50000

    What am I doing wrong?
     
  12. margret

    margret Well-Known Member Licensed User

    What about the question in Post #9?
     
  13. lonleystar

    lonleystar Well-Known Member Licensed User

    u r not wrog, AnimationDuration Sets how long a transition animation should run (in milliseconds) when layout has changed.
     
  14. lonleystar

    lonleystar Well-Known Member Licensed User

    about the question in Post #9 yes u r right the problem is in loadbitmap when u try to display an image more then 2 or 3 or 4 mb.

    Also the size LoadBitmap das not display an image more then 1900 width X 1200 height
     
    Last edited: Mar 25, 2013
  15. margret

    margret Well-Known Member Licensed User

    Post #9 is below. The question is, there is no value for Value until the Item is clicked or you have moved the Coverflow left or right. I need the Value to have a value as soon as the display shows. At this point Value is Null. How can I get the Value of the centered Image upon display?

     
  16. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi margret, u r right i just sow now sorry for the inconvenience, tomorrow i´ll fix thanks to report it.
     
  17. jiangws

    jiangws Member Licensed User

    HI lonleystar,

    I got a error message:

    Coverflow.PopulateCoverflow(File.DirRootExternal, "YOUR FODER HERE")
    java.lang.NullPointerException


    at it.giuseppe.salvi.ICOSCoverFlowActivity.PopulateCoverflow(ICOSCoverFlowActivity.java:228)
    at it.giuseppe.salvi.coverflow.main._activity_create(main.java:257)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
    at it.giuseppe.salvi.coverflow.main.afterFirstLayout(main.java:89)
    at it.giuseppe.salvi.coverflow.main.access$100(main.java:16)
    at it.giuseppe.salvi.coverflow.main$WaitForLayout.run(main.java:74)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4575)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
    at dalvik.system.NativeStart.main(Native Method)
    java.lang.NullPointerException
    ** Activity (main) Resume **

    Could you tell me how to solve this?

    Thanks
     
  18. NJDude

    NJDude Expert Licensed User

    You have to replace that message with the directory where you have your pictures.

    For example:
    Code:
    Coverflow.PopulateCoverflow(File.DirRootExternal, "Pictures")
    Might be different on your device.
     
  19. lonleystar

    lonleystar Well-Known Member Licensed User

    hi jiangws, as NJDUDE told you, you have to replacemessage with the directory where you have your pictures.

    Thanks to NJDUDE have answered for me.
     
  20. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi NJDUDE , i have a little problem when i try to put in my signature the donation I don't know where I'm wrong please can u write a little guide so i can put my own donation in my signature. thanks in advance.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice