Android Question SMM .Webp In CLV

Samara

Member
I use simple media manager in customlistview with ".webp" format everything good in loading but when scroll clv get lag so much with 100 image...

B4X:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region

'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip

Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private CustomListView1 As CustomListView
    Private PCVL_Main As PreoptimizedCLV
   
    Private Panel2 As Panel
    Private Panel1 As Panel
    Dim SMM As SimpleMediaManager
    Dim Perfix As String = "hide"
    Dim NumberMax As Int
End Sub

Public Sub Initialize
'    B4XPages.GetManager.LogEvents = True
    SMM.Initialize
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
   
    NumberMax = SQL_Main.ExecQuerySingleResult("SELECT count(*) As MaxNumber FROM source")
   
    PCVL_Main.Initialize(Me, "PCVL_Main", CustomListView1)
    PCVL_Main.ShowScrollBar = False
    For i = 0 To NumberMax - 1
        PCVL_Main.AddItem(100dip, xui.Color_White, i)
    Next
    PCVL_Main.Commit
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Private Sub CustomListView1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    For Each i As Int In PCVL_Main.VisibleRangeChanged(FirstIndex, LastIndex)
        Dim item As CLVItem = CustomListView1.GetRawListItem(i)
        Dim pnl As B4XView = xui.CreatePanel("")
        item.Panel.AddView(pnl, 0, 0, item.Panel.Width, item.Panel.Height)
        pnl.LoadLayout("Cell") 'Create the item layout
        Dim Cursor As Cursor
        Cursor = Starter.SQL_Main.ExecQuery("SELECT * FROM source")
        Cursor.Position = i
        SMM.SetMedia(Panel2,Perfix&Cursor.GetString("url")&".webp")
    Next
    SMM.TrimMediaCache
End Sub
 

Samara

Member
I fixed all..
png format working greatly... but still when use .webp problem not fixed...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…