B4A Library [Lib] CoverFlow v2.0

Mashiane

Expert
Licensed User
Longtime User
Hi,

For some reason, in version 2, if I change this line

From
B4X:
Coverflow.CreateCache = "Pippo.Pluto.Paperino"

To
B4X:
Coverflow.CreateCache = "a.b.c.d"

The CoverFlow plugin does not work.
Q1. Is the Cache locked to "Pippo.Pluto.Paperino" or can someone use their own cache names?

Q2. I have placed the CoverFlow inside a panel with....
B4X:
pnlCoverFlow.AddView(Coverflow, 0dip, 0dip, 100%x, 100%y)

and did this also

B4X:
Coverflow.ItemWidth = 50%x
    Coverflow.ItemHeight = 100%y

because I was under the impression that each image will fit the panel size height. Unfortunately it does not. How can I ensure that each image fits perfectly (see attached images for clarity)

Q3. Each image I am adding is currently sitting in the Assets folder and I am using AddImage method. I will not use all the images in the assets folder but some. The thing is, I have to call this method below for my code to even display in the emulator otherwise nothing happens. When this line is commented out, my app does not even run.
B4X:
Coverflow.PopulatePhotoFlowFromAssets("a")

Is it possible to make this library to work without having to populate from assets but instead populate from a list of given files? I don't have a folder called "a" in assets and this methods is supposed to read that folder and display the images isn't it? Below is my complete source for this. Can someone please advise?

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    ProgressDialogShow("Loading...") 
    DoEvents
    Activity.LoadLayout("vSplash")
    Activity.Color = Colors.black
    modMashiane.Button_PowderBlueWhite(btnLogin)
    modMashiane.Button_PowderBlueWhite(cmdRegister)
    StateManager.Initialize(Application.LabelName)
    pnlCoverFlow.Color = Colors.transparent
    Coverflow.InitializeCoverflow("Coverflow")
    ' if string below is changed to anything else other than Pippo.Pluto.Paperino
    ' nothing is displayed on coverflow
    Coverflow.CreateCache = "Pippo.Pluto.Paperino"
    pnlCoverFlow.AddView(Coverflow, 0dip, 0dip, 100%x, 100%y)
    Coverflow.Spacing= -15
    Coverflow.ItemWidth = 50%x
    Coverflow.ItemHeight = 100%y
    Coverflow.AnimationDuration=1000
    ' if this line is commented out, the app does start, there is no folder called "a" in assets
    Coverflow.PopulatePhotoFlowFromAssets("a")  
    Coverflow.ShowText = False
    Coverflow.AddImage(File.DirAssets,"slide1.jpg")
    Coverflow.AddImage(File.DirAssets,"slide2.jpg")
    Coverflow.AddImage(File.DirAssets,"slide3.jpg")
    Coverflow.AddImage(File.DirAssets,"slide4.jpg")
    Coverflow.AddImage(File.DirAssets,"slide5.jpg")
    Coverflow.AddImage(File.DirAssets,"slide6.jpg")
    Coverflow.AddImage(File.DirAssets,"slide7.jpg")
    Coverflow.AddImage(File.DirAssets,"slide8.jpg")
    Coverflow.AddImage(File.DirAssets,"slide9.jpg")
    Coverflow.AddImage(File.DirAssets,"slide10.jpg")
    Coverflow.AddImage(File.DirAssets,"slide11.jpg")
    Coverflow.AddImage(File.DirAssets,"slide12.jpg")
    Coverflow.AddImage(File.DirAssets,"slide13.jpg")
    Coverflow.AddImage(File.DirAssets,"slide14.jpg")
    Coverflow.Selection = 1
    ProgressDialogHide
End Sub
 

Attachments

  • coverflow.png
    318.4 KB · Views: 340
  • slide1.jpg
    289.2 KB · Views: 312
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User


Hi, if U dont set the cache does matter, it will create a cache named your package name.

right now i tested the library:

Coverflow.CreateCache = "Pippo.Pluto.Paperino"
To
Coverflow.CreateCache = "a.b.c.d"

and work fine.
 

Attachments

  • a.b.c.d.png
    240.5 KB · Views: 295

lonleystar

Well-Known Member
Licensed User
Longtime User
Q2 and Q3 as question 2 and question 3 respectively. Can you please look into those in the first post? Thanks.

Hi the first question the Cache is not locked, the second question I test with panel and not work fine, third question ShowFromAssets(Your path neme here) instead of PopulatePhotoFlowFromAssets("a")

Best Regard.

G.Salvi
 
Reactions: tmf

tmf

Member
Licensed User
Longtime User
OK this is driving me nuts!

First had issues I think finding paths to the files, but now it should be OK as its returning TRUE to the msgbox() seen below... so what is the issue?

Sub Globals
Dim cf As PhotoFlow
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
cf.InitializeCoverflow("cover")
cf.CreateCache = "Pippo.Pluto.Paperino"
cf.Spacing = -20
cf.ItemWidth = 200
cf.ItemHeight = 200
cf.AnimationDuration = 800
cf.ClearCache
Activity.AddView(cf, 0dip, 0dip, 100%x, 100%y)

' returns a TRUE so the file exists
Msgbox(File.Exists("/storage/emulated/0", "k2.jpg"), "")
' returns a TRUE so cf is initialized
Msgbox(cf.IsInitialized, "")

' this next line throws up the error below which I thought was due to file missing
cf.AddImage("/storage/emulated/0", "k2.jpg")
cf.Enabled = True
End Sub

LogCat connected to: B4A-Bridge: motorola XT1064
--------- beginning of main
Installing file.
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 43)
cf.AddImage("/storage/emulated/0", "k2.jpg")
java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null object reference
at it.giuseppe.salvi.PhotoFlowActivity.AddImage(PhotoFlowActivity.java:229)
at b4a.example.main._activity_create(main.java:376)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at b4a.example.main.afterFirstLayout(main.java:100)
at b4a.example.main.access$100(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5310)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Installing file.
PackageAdded: package:b4a.example
 

tmf

Member
Licensed User
Longtime User
OK I added cf.PopulatePhotoFlowFromAssets("") before cf.addimage and even though it loaded no images from assets it allowed the cf.addimage to work Can someone answer why so I have a full understanding of this.
 

tmf

Member
Licensed User
Longtime User
Thanks! I will test it for you once I receive it, I am actively writing an APP that will require it, hope it works for me!
 

tmf

Member
Licensed User
Longtime User
Am I missing the new code? I am newish here and do not know the procedure... where to find it?
 

victormedranop

Well-Known Member
Licensed User
Longtime User
Something strange happened I add the library, I can see the library loaded but I cant create the code.
B4X:
Dim Coverflow As B4ACoverFlow
 

Attachments

  • Capture1.PNG
    1.4 KB · Views: 245
  • Capture2.PNG
    1.3 KB · Views: 248

victormedranop

Well-Known Member
Licensed User
Longtime User
I need son help with this lib, can't make carousel to start. stay in the first picture.
check my code
B4X:
#region: image
 If image_list.Size > 0 Then
 ImageView1.Visible = False
 Coverflow.Visible = True
 Coverflow.Carousel = True
 Coverflow.Reverse = True
 Try
 Coverflow.PopulatePhotoFlow(File.DirRootExternal,"") 
 Log("starting coverflow")
 Catch
 Log(LastException)
 End Try
 Else
 Log ("No image files to display ") 
 End If
#end region
[\CODE]
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…