Bug? CustomListView and expandable list: issue on latest v.1.76

lucad

Member
Licensed User
Longtime User
It seems the use of expandable list ( Erel Tutorial ) with the latest version of customlistview have problems. The 'expand' causes a weird waving animation, like a quick collapsing before expanding.
This doesn't happens if we use the previous version 1.65.

Here the Sub involved :
B4X:
InsertAtImpl(Index As Int, Pnl As Panel, ItemHeight As Int, Value As Object, InitialHeight As Int)

Below the differences that I have found only at the end of the InsertAtImpl sub.

Newer 1.76 - issues
B4X:
heights.InsertAt(Index, ItemHeight)
      

        sv.Panel.AddView(p, 0, top, sv.Width, InitialHeight)      
        p.SetLayoutAnimated(AnimationDuration, 0, top, p.Width, ItemHeight)
    End If
    sv.Panel.Height = sv.Panel.Height + ItemHeight - InitialHeight + IncludeDividierHeight
    If items.Size = 1 Then sv.Panel.Height = sv.Panel.Height + IncludeDividierHeight
End Sub

Older 1.65 - ok for me
B4X:
heights.InsertAt(Index, ItemHeight)
      
        Dim ShouldSetPanelHeight As Boolean
        If InitialHeight > ItemHeight Then
            sv.Panel.AddView(p, 0, top, sv.Width, InitialHeight)
            Pnl.Height = InitialHeight
            ShouldSetPanelHeight = True
        Else
            sv.Panel.AddView(p, 0, top, sv.Width, ItemHeight)
          
        End If
        p.SendToBack
    End If
    Dim NewSvHeight As Int = sv.Panel.Height + ItemHeight - InitialHeight + IncludeDividierHeight
    sv.Panel.Height = NewSvHeight
    If items.Size = 1 Then sv.Panel.Height = sv.Panel.Height + IncludeDividierHeight
    If ShouldSetPanelHeight Then
        Sleep(AnimationDuration)
        If p.Parent <> Null Then
            'this can happen if the user clicks on the item while it is being animated
            p.Height = ItemHeight
            Pnl.Height = ItemHeight
        End If
    End If

I think this is something related to the initial and final height of the panel to be animated, however I did not investigate further yet. I am for now using the older function.
 
Top