B4A Library [Lib] UltimateListView

I've been working on this project for a long time and I'm very proud to release the version 4 today.

The UltimateListView is, as its pompous name says, THE ListView.

  • It can handle very long lists. This is a screenshot of a list with 245813 items, all different:

    verylonglist.jpg


  • It can mix different layouts (and they can be changed dynamically). You can use it as an expandable ListView:

    layouts.jpg


  • It has a low memory footprint and is very fast (this report comes from the Performance demo where the list has to display 128901 distinct words read from a database and the used device is a Huawei Honor single core 1.4 Ghz):

    performance.png


  • It can scroll in both directions thanks to its swipe detector:

    tables.jpg


  • The swipe detector can also be used to implement a swipe-to-dismiss or a swipe-to-reveal:

    swipedetector.png
  • You can easily add editors to your table to change its content:

    celledit.jpg


  • You can animate the items when they are added, removed, replaced or when the list is scrolled (with your own custom animation):

    animationclap.png


  • It can stack items from the bottom:

    stackfrombottom.png


  • It supports drag & drop operations (internal & external):

    dragndrop.png


  • You can synchronize lists with different item heights:

    grid.jpg
The examples will show you how to implement a Pull-to-Refresh, create sticky headers or combine several lists to make a wheel. One of the examples is an improved version of my File Explorer class.

All texts and images can be loaded asynchronously (from Internet, from a database or from a local folder), so you can scroll even if the data are not fully loaded.

The list has its own state manager.

Since September 2018, ULV is available for free. You can still donate for it if you wish.
To send the money, just click on the Donate button below (the amount to enter is in euros):


Note that UltimateListView is not a wrapper around the work of someone else. It is 100% my own code and it is based upon the standard Java ListView of Android.

The UltimateListView does not work with Android versions < 2. It cannot work with B4J or B4i.

Current version: 4.50

DOWNLOAD HERE:
 
Last edited:

Bryanne Vega

Member
Licensed User
Longtime User
On the swipe demo (scrolling), do you have available something like pagination?

(When scrolling left or right, stop at the next page instead of continuously slide to the other page if not stopped, sort of like when you're browsing you apps in the app dash board on your phone)
 

Informatix

Expert
Licensed User
Longtime User
On the swipe demo (scrolling), do you have available something like pagination?

(When scrolling left or right, stop at the next page instead of continuously slide to the other page if not stopped, sort of like when you're browsing you apps in the app dash board on your phone)
I don't understand what you mean by "Next page" in the context of the demo. Maybe AHViewPager will suit your needs.
 

JordiCP

Expert
Licensed User
Longtime User
Hi Fred,

I am using your ULV with two different layouts: "Headers" and "Items": the first element is always a "Header", then some items, then another header, and so on....
Also, I am using Drag when there is a LongClick event to move "Items" within the list. It works perfect!!:)

if I drag one item to the first position, of course it allows me to do it. But I would like to prevent this, since it will result in having an item before the first header, which in my app does not make sense.
I know it can be done by checking the position in the Drop event and correcting it if needed.
But (just in case I am missing it) is there any other way to prevent it in advance? I mean, not letting the user drag to certain positions?

Thanks in advance!
 

Prosg

Active Member
Licensed User
Longtime User
Hello,

I want to change the height of LayoutPanel dynamicly

I need to change in the sub

B4X:
Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)

how can i do this ?

I test

B4X:
Dim monPanel As Panel = LayoutPanel
    monPanel.Height = 500dip

but error

java.lang.NullPointerException: Attempt to invoke interface method 'void android.view.ViewParent.requestLayout()' on a null object reference
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
Hello,

I want to change the height of LayoutPanel dynamicly

I need to change in the sub

B4X:
Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)

how can i do this ?

I test

B4X:
Dim monPanel As Panel = LayoutPanel
    monPanel.Height = 500dip

but error

java.lang.NullPointerException: Attempt to invoke interface method 'void android.view.ViewParent.requestLayout()' on a null object reference
Please read the post just before yours.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Fred. Before you leave for the holidays i have one question:

example.jpg


I have this ULV, when i click about "Like" (1) i have +1 as Points ( points is label in ULV ) . It is possible without reload all ULV that i have label Point update ?
Example now you see first picture "1 Points" in label color orange. Now if i click about Like (1) i want see (whitout reload all ULV) "2 Points".

The code is:
B4X:
....
Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
   
.......
 
    Dim lbl_punti As Label =  LayoutPanel.GetView(4)
    lbl_punti  =  LayoutPanel.GetView(4)
    lbl_punti.Typeface = FA.FontAwesomeTypeface
    lbl_punti.TextColor = Colors.White
        If preleva.Get("log_punteggio" & Position) = 0 Then
            lbl_punti.Text = "0  Points"
        Else
            lbl_punti.Text = preleva.Get("log_punteggio" & Position) & " " &  " Points  "
        End If
.......
End Sub
 
 
'Click Like
Sub imageview3_Click
   
    Dim imageview3 As ImageView = Sender
    Dim foto_id As Int =  preleva.Get("log_id" & imageview3.Tag)
    Starter.scelta_id_foto = foto_id
 
    'Check if pictures is already Vote
    db.QueryASync("select * from dario_fotolike where id_customers = "& Starter.id_customers &" and id_foto = "&Starter.scelta_id_foto &";", "Riporta_Dati2")   
 
End Sub

Thank you
Marco
 

johndb

Active Member
Licensed User
Longtime User
Hi Fred. Before you leave for the holidays i have one question:

View attachment 39661

I have this ULV, when i click about "Like" (1) i have +1 as Points ( points is label in ULV ) . It is possible without reload all ULV that i have label Point update ?
Example now you see first picture "1 Points" in label color orange. Now if i click about Like (1) i want see (whitout reload all ULV) "2 Points".

The code is:
B4X:
....
Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
 
.......

    Dim lbl_punti As Label =  LayoutPanel.GetView(4)
    lbl_punti  =  LayoutPanel.GetView(4)
    lbl_punti.Typeface = FA.FontAwesomeTypeface
    lbl_punti.TextColor = Colors.White
        If preleva.Get("log_punteggio" & Position) = 0 Then
            lbl_punti.Text = "0  Points"
        Else
            lbl_punti.Text = preleva.Get("log_punteggio" & Position) & " " &  " Points  "
        End If
.......
End Sub


'Click Like
Sub imageview3_Click
 
    Dim imageview3 As ImageView = Sender
    Dim foto_id As Int =  preleva.Get("log_id" & imageview3.Tag)
    Starter.scelta_id_foto = foto_id

    'Check if pictures is already Vote
    db.QueryASync("select * from dario_fotolike where id_customers = "& Starter.id_customers &" and id_foto = "&Starter.scelta_id_foto &";", "Riporta_Dati2") 

End Sub

Thank you
Marco
I would use ulv.RefreshContent as it will only reload the visible items.
 

MarcoRome

Expert
Licensed User
Longtime User
I would use ulv.RefreshContent as it will only reload the visible items.
Thank John. But RefreshContent isnt sufficient in this cases. Because "reload" items as in original. But dont change value
 

JordiCP

Expert
Licensed User
Longtime User
Thank John. But RefreshContent isnt sufficient in this cases. Because "reload" items as in original. But dont change value

I would also use RefreshContent.

If I understood correctly your code (sorry if I am wrong), you get the current votes from "preleva" map, and that is what you use in Item_ContentFiller Sub

So, if you update this preleva map with the new points before calling RefreshContent, the Item_ContentFiller calls will fill the label with the desired updated values

It can be done in the same event if you have this data in memory, or if you need to update it from a DB with an async query, do the call to Refreshcontent when the results are available
 

MarcoRome

Expert
Licensed User
Longtime User
I would also use RefreshContent.

If I understood correctly your code (sorry if I am wrong), you get the current votes from "preleva" map, and that is what you use in Item_ContentFiller Sub

So, if you update this preleva map with the new points before calling RefreshContent, the Item_ContentFiller calls will fill the label with the desired updated values

It can be done in the same event if you have this data in memory, or if you need to update it from a DB with an async query, do the call to Refreshcontent when the results are available
Right JordiCP work in great mode.
Thank you for your suggestion and GREAT YEAR 2016
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Fred,

I accidentally deleted my copy of ULV and have proof of my donation.

Can you send me an email with the current version I can download?

Thanks.

Truly,
Richard Leiman
 

MarcoRome

Expert
Licensed User
Longtime User
Hi all.
I'd like to change the color of the keys when the user clicks on one of them. Example where I click the button turns green the other blacks.
I have this layout:

Screenshot 2016-01-07 08.10.58.png

and this is result:
2016-01-07 07.16.53.png


My code is:

B4X:
Sub Item_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
            LayoutPanel.LoadLayout("lay_strumenti")            
End Sub


Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)

    Dim imageview1 As ImageView = LayoutPanel.GetView(0)
    'First view in the panel
    imageview1.Gravity = Gravity.FILL
    Dim immagine As Bitmap
    immagine.Initialize(File.DirAssets, "sc_3.jpg" )
    imageview1.Bitmap = immagine

    Dim Label1 As Label =  LayoutPanel.GetView(1)
    Label1.Text =  risposte.Get("log_id_domanda" & Position)
    Label1.Tag =  risposte.Get("log_id_domanda" & Position)
   
    Dim Button1 As Button = LayoutPanel.GetView(2)
   
        Button1.Text = risposte.Get("log_risposta_a" & Position)
        Button1.Tag = risposte.Get("log_risposta_a" & Position)


   
    Dim Button2 As Button = LayoutPanel.GetView(3)
        Button2.Text = risposte.Get("log_risposta_b" & Position)
        Button2.Tag = risposte.Get("log_risposta_b" & Position)


   
    Dim Button3 As Button = LayoutPanel.GetView(4)
        Button3.Text = risposte.Get("log_risposta_c" & Position)
        Button3.Tag = risposte.Get("log_risposta_c" & Position)


End Sub

Sub Button1_Click
    Dim Button1 As Button = Sender
    Dim dove_mitrovo As String = Button1.Tag
    ToastMessageShow( dove_mitrovo , True)
    Dim splitta() As String = Regex.Split("\|", Button1.Tag)
    primopezzo = splitta(0)
    secondopezzo = splitta(1)
    punti = splitta(2)
    Button1.TextColor = Colors.Black
    'Do la rotondità e cornice
    Dim c2, c3 As ColorDrawable
    c2.Initialize2(Colors.ARGB(255, 39, 255, 0),10dip,3dip,Colors.Black)
    Button1.Background = c2
   
End Sub

Any idea ?
Thank you
Marco
 

Informatix

Expert
Licensed User
Longtime User
For the last time: there's no support in this forum for ULV.
I see no reason to expose here the numerous errors of programming of my donors (like in the post above). Moreover I have many requests a day. I would not be able to handle them in a single thread or exchange private code in the forum. I want to keep this thread for public announcement and questions of people interested by ULV.
 

MarcoRome

Expert
Licensed User
Longtime User
For the last time: there's no support in this forum for ULV.
I see no reason to expose here the numerous errors of programming of my donors (like in the post above). Moreover I have many requests a day. I would not be able to handle them in a single thread or exchange private code in the forum. I want to keep this thread for public announcement and questions of people interested by ULV.
Ok Fred :) dont worry ... is last time that i expose here my numerous errors :D. I got it that you want keep this thread for public announcement... the next time i send only way email
 
Top