Private Sub AnimatePanel(xlv As CustomListView, Duration As Int, Content As Object, Height As Int, Color As Int, TextColor As Int) As ResumableSub
LogSub("AnimatePanel: Duration = " & Duration & " BackgroundColor = " & Color)
LogSub("Content = " & Content)
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0,0,0,xlv.AsView.Width, Height)
p.SetColorAnimated(0, xui.Color_White, Color)
Dim lbl As Label
lbl.Initialize("")
Dim xlbl As B4XView = lbl
xlbl.SetLayoutAnimated(0,0,0,p.Width,p.Height)
xlbl.SetTextAlignment("CENTER","LEFT")
xlbl.TextColor = TextColor
xlbl.Text = Content
p.AddView(xlbl,0,0,p.Width,p.Height)
xlv.Add(p,0)
p = xlv.GetPanel(xlv.Size-1)
p.Visible = False ' this was important - thought SetVisibleAnimated took care of that
p.SetVisibleAnimated(Duration, True)
''Log("Animate Wait")
Sleep(Duration)
Return True
End Sub