Hi,
I liked the example posted here: https://www.b4x.com/android/forum/t...ew-lazy-loading-virtualization.87930/#content
However, when I load the app, for a few time, while the cards are being constructed, it would be nice to have something like "gifviewer" posted here: https://www.b4x.com/android/forum/threads/custom-view-gifviewer.82104/
I suppose that the code I need to resolve is this:
Let's suppose that I have the Wait here:
And I have an event:
When the Search_closed is executed, for a while the app is "blocked" while the FillList2 is completed ( I suppose)
Here goes my question: how to deal with it? I think I need to use resumable, but when I try to use it making the FillList2 resumable, I still having the app blocked:
Could anyone help me?
Thanks in advance
I liked the example posted here: https://www.b4x.com/android/forum/t...ew-lazy-loading-virtualization.87930/#content
However, when I load the app, for a few time, while the cards are being constructed, it would be nice to have something like "gifviewer" posted here: https://www.b4x.com/android/forum/threads/custom-view-gifviewer.82104/
I suppose that the code I need to resolve is this:
B4X:
Sub FillList2
Dim bitmaps As List = Array("pexels-photo-446811.jpeg", "pexels-photo-571195.jpeg", _
"pexels-photo-736212.jpeg", "pexels-photo-592798.jpeg")
Dim n As Long = DateTime.Now
For i = 1 To 1000
Dim content As String = $"Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."$
Dim cd As CardData
cd.Initialize
cd.Title = $"This is item #${i}"$
cd.Content = content
cd.BitmapFile = bitmaps.Get((i - 1) Mod bitmaps.Size)
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, CLV1.AsView.Width, 280dip)
CLV1.Add(p, cd)
Next
Log("Loading cards took: " & (DateTime.Now - n) & "ms")
End Sub
Let's suppose that I have the Wait here:
B4X:
Private Wait As GifViewer
And I have an event:
B4X:
Sub Search_Closed
Log("SearchView closed")
FillList2
End Sub
When the Search_closed is executed, for a while the app is "blocked" while the FillList2 is completed ( I suppose)
Here goes my question: how to deal with it? I think I need to use resumable, but when I try to use it making the FillList2 resumable, I still having the app blocked:
B4X:
Sub Search_Closed
Log("SearchView closed")
Wait.Start
Wait For(FillList2) Complete (Result As Int)
Wait.Stop
End Sub
B4X:
Sub FillList2 As ResumableSub
Dim bitmaps As List = Array("pexels-photo-446811.jpeg", "pexels-photo-571195.jpeg", _
"pexels-photo-736212.jpeg", "pexels-photo-592798.jpeg")
Dim n As Long = DateTime.Now
For i = 1 To 1000
Dim content As String = $"Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."$
Dim cd As CardData
cd.Initialize
cd.Title = $"This is item #${i}"$
cd.Content = content
cd.BitmapFile = bitmaps.Get((i - 1) Mod bitmaps.Size)
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, CLV1.AsView.Width, 280dip)
CLV1.Add(p, cd)
Next
Log("Loading cards took: " & (DateTime.Now - n) & "ms")
return 0 'just to get something as a result for Complete (Result As Int)
End Sub
Could anyone help me?
Thanks in advance