Android Question CLV VisibleRangeChanged

MarcoRome

Expert
Licensed User
Longtime User
I was doing some tests on SSM, I entered the load of a hundred items using VisibleRangeChanged.
I have this code:

B4X:
Sub clv_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    For Each i As Int In PCLV.VisibleRangeChanged(FirstIndex, LastIndex)

        Dim item As CLVItem = clv.GetRawListItem(i)
        Dim pnl As B4XView = xui.CreatePanel("")
        item.Panel.AddView(pnl,0,0, item.Panel.Width, item.Panel.Height)
        Dim mappa As Map = item.Value
        pnl.LoadLayout("lay_clv_dentro")
                
        Log($"${mappa.Get($"caricoitem${i}"$)}"$)
        lbl_item.Text = $"${mappa.Get($"caricoitem${i}"$)}"$
        'or
        'pnl.GetView(3).Text = $"${mappa.Get($"caricoitem${i}"$)}"$
        
'        'Foto Normal
        MediaManager.SetMedia(Panel1, $"${mappa.Get("foto")}"$)
        
'        'Foto Round
        Dim extra As Map = CreateMap(MediaManager.REQUEST_ROUNDIMAGE: True, MediaManager.REQUEST_BACKGROUND: xui.Color_Transparent, MediaManager.REQUEST_RESIZE_MODE: "FILL_WIDTH")
        MediaManager.SetMediaWithExtra(Panel2, $"${mappa.Get("foto")}"$, "", extra)

'        'Movie
        MediaManager.SetMedia(Panel3, $"${mappa.Get("filmato")}"$)
        
    Next
    
End Sub

I have tried on different devices, but the effect is always the same, loads a certain number of items (from device to device they change), and some are not loaded.
For example in the movie the item:
6,7,8 are not loaded, then after 7 items it repeats
15,16,17 are not loaded, then after 7 items it repeats
24,25,26 are not loaded, then after 7 items it repeats
....


In attachment example
Any idea ?
Thank you
 

Attachments

  • SimpleMediaManager.zip
    280.8 KB · Views: 232

Erel

B4X founder
Staff member
Licensed User
Longtime User
SMM was built to work with B4XPages. You will lose functionality in non-B4XPages projects. I've added a note about it in the tutorial.

See SMM_Example2. There is a call for MediaManager.TrimMediaCache. It also explains why it is required. If it doesn't solve this issue then please create a B4XPages project with this code.
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
SMM was built to work with B4XPages. You will lose functionality in non-B4XPages projects. I've added a note about it in the tutorial.

See SMM_Example2. There is a call for MediaManager.TrimMediaCache. It also explains why it is required. If it doesn't solve this issue then please create a B4XPages project with this code.
Hi @Erel thank you for your reply.

Unfortunately, even if you insert MediaManager.TrimMediaCache or replicate the example on B4Xpages, the effect does not change.
For example for B4XPages, it loses the item 8,17,26,35 ... (every 9), same thing with another device even if in a different order
In attachment example B4XPages
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Correct way to zip B4XPages projects:
B4X:
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=SMM_Example2.zip

I've tested the B4XPages project. Works perfect here. In some cases you need to wait a few seconds until the video appears, however it is normal and not related to SMM.
It is possible that Vimeo blocks some of your connections. You are making an unintentional DOS attack on their servers.
 
Upvote 0
Top