iOS Question Issue in xCustomListview ResizeItem in B4i


Active Member
Licensed User
All things is good in xCLV
I can load my items in CLV correctly and use ReachEnd other event
So no problem here
But problem is when i need use ResizeItem for resize panel
When i use this method,it cannot resize panel sometimes or resize panel but when i change
panel's views (top or width) ,it dont happen
So i have to use sleep(100) and when i use it,resizeitem working well
But when clv try to resize panel and sleep(100),user can see all happening during apply changing
My Code is
Dim xui As XUI
        For i = 0 To ReportList.Size - 1
            Dim p As B4XView = xui.CreatePanel("")
            p.Color    =    Colors.Transparent
            p.SetLayoutAnimated(0, 0, 0, listclv.AsView.Width, 100dip)
            listclv.Add(p, i)

Sub listclv_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    Dim ExtraSize As Int = 10
    For i = Max(0, FirstIndex - ExtraSize) To Min(LastIndex + ExtraSize, listclv.Size - 1)
        Dim p As B4XView = listclv.GetPanel(i)
        If p.NumberOfViews = 0 Then
        End If
End Sub

Sub LoadContent(LayoutPanel As Panel,Position As Int)
    Dim pnltoolbar As Panel
    pnltoolbar    =    LayoutPanel.GetView(3)
    Dim imgavatar As ImageView
    imgavatar    =    LayoutPanel.GetView(0)
    Dim lblusername As Label
    lblusername    =    LayoutPanel.GetView(1)
    Dim imgbg As ImageView
    imgbg        =    LayoutPanel.GetView(2)
    Dim lblsubject As Label
    lblsubject    =    pnltoolbar.GetView(4)
    Dim lbldate As Label
    lbldate    =    pnltoolbar.GetView(6)
    Dim lbldesc As Label
    lbldesc        =    pnltoolbar.GetView(5)
    Dim lblview As Label
    lblview        =    pnltoolbar.GetView(2)
    lblview.Font    =    Views.GetFont("icomoon",lblview.Font.Size)
    Dim lblbookmark As Label
    lblbookmark    =    pnltoolbar.GetView(0)
    Dim lbldirect As Label
    lbldirect    =    pnltoolbar.GetView(1)
    lbldirect.Font    =    Views.GetFont("icomoon",lbldirect.Font.Size)
    Dim lblcomment As Label
    lblcomment    =    pnltoolbar.GetView(3)
    lblcomment.Font    =    Views.GetFont("icomoon",lblcomment.Font.Size)
    Dim data As Map
    data    =    ReportList.Get(Position)
    Dim url As String
    url        =    Configuration.BASE_ & "files/avatar/" & data.Get("sUsername") & ".jpg"
    Dim tar1,tar2 As DefaultTarget
    tar1.EventName    =    "glide2"
    tar1.Tag = imgavatar
    tar2.EventName    =    "glide"
    tar2.Tag = imgbg
    Dim picassoT As Picasso
    lblusername.Text    =    data.Get("sNames")
    Dim picasso4 As Picasso
    If data.Get("sHavePicture") = "1" Then
        Dim url As String
        url        =    Configuration.BASE_ & "files/report/" & data.Get("sID") & "/1.jpg"
        pnltoolbar.Top     =    imgbg.Top
        imgbg.Visible    =    False
        listclv.ResizeItem(Position,pnltoolbar.Height + pnltoolbar.Top) 'here i try small panel when user post dont have picture
        pnltoolbar.Top     =    imgbg.Top
    End If
    lblsubject.Text    =    data.Get("sSubject")
    lbldate.Text    =    conv.GetTimeAgo(Library.ConvertDateTime2Tick(data.Get("sDateTime")))
    Dim pre_height As Int
    pre_height            =    lbldesc.Height
    lbldesc.Text        =    data.Get("sText")
    lbldesc.TextAlignment    =    lbldesc.ALIGNMENT_RIGHT
    lbldesc.Height        =    lbldesc.Text.MeasureHeight(lbldesc.Font)
    LayoutPanel.Height    =    Max(LayoutPanel.Height + (lbldesc.Height-pre_height),LayoutPanel.Height)
    pnltoolbar.Height    =    Max(pnltoolbar.Height + (lbldesc.Height-pre_height),pnltoolbar.Height)

    lblbookmark.Top        =    lbldesc.Top + lbldesc.Height + 5dip
    lbldirect.Top        =    lbldesc.Top + lbldesc.Height + 5dip
    lblcomment.Top        =    lbldesc.Top + lbldesc.Height + 5dip
    lblview.Top            =    lbldesc.Top + lbldesc.Height + 5dip
    lblview.Text        =    " " & data.Get("sView")
    pnltoolbar.Tag        =    data
    LayoutPanel.Color    =    Colors.White
    LayoutPanel.Tag        =    data
End Sub

When i use sleep(100) all things are good and loading well