B4A Library [Lib] UltimateListView

Informatix

Expert
Licensed User
Longtime User
Hi johndb

Thanks for your comments,
Sure, let's wait
Hello,

We live in different time zones, so when you're awake, I'm maybe sleeping. And during the day it happens that I'm busy or that Paypal takes some time to send the confirmation of the transaction, so sending the link is not always very fast.
As said above, no one is entitled to send the link to the library but me.
 

wildfandango

Member
Licensed User
Longtime User
Hi ULV is the best solution i have found for vertical scroll of items... Informatix... THX!!!!

BUT.

For horizontal scrolling of items what do you recommend ?
 

Informatix

Expert
Licensed User
Longtime User
Hi,

I just donated EUR 25, how can I get the Ultimate listview?
It's of no use to post here after a donation because I don't send anything until I have the confirmation of the transaction by Paypal. Someone already tried to fool me in the past so I don't trust anything else that the money on my account.
In your case, the confirmation should arrive soon in my mailbox. Please wait.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Informatix.
I have this code, but i dont understand why ULV_ItemClick dont work

B4X:
Sub ULV_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
    Log(Position)
End Sub

This is code:
B4X:
Sub Process_Globals
    Dim dbSQL As SQL
    Dim su As StringUtils
    Dim Padding As Int = 10dip
    Dim FontSize As Int = 18
End Sub

Sub Globals
    Dim ULV As UltimateListView
    Dim dbCursor As Cursor
    Dim bmpAndroid As Bitmap
    Dim lblMeasure As Label
    Dim HoloDark As Boolean
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Duplicates and opens the database
    If Not(File.Exists(File.DirInternal, "wikipedimo.db")) Then
        File.Copy(File.DirAssets, "wikipedimo.db", File.DirInternal, "wikipedimo.db")
    End If
    dbSQL.Initialize(File.DirInternal, "wikipedimo.db", False)

    'Gets a cursor on data
    dbCursor = dbSQL.ExecQuery("SELECT * FROM Android")

    'Creates the invisible label used to measure the height of each item
    lblMeasure.Initialize("")
    lblMeasure.TextSize = FontSize
    lblMeasure.Typeface = Typeface.DEFAULT
    lblMeasure.Visible = False
    Activity.AddView(lblMeasure, Padding, Padding, 100%x - (Padding * 2), 100%y - (Padding * 2))

    'Initializes the ULV
    ULV.Initialize(0, 0, "", "")
    Activity.AddView(ULV, 0, 0, 100%x, 100%y)


        ULV.SetStyle(ULV.STYLE_HOLO_DARK)
        HoloDark = True


    'Loads the Android image and adds the layout for this image
    bmpAndroid = LoadBitmap(File.DirAssets, "voice_memos.png")
    Dim Height As Int = (bmpAndroid.Height * Density) + (Padding * 2)

    For i = 0 To dbCursor.RowCount - 1
        'Each item has a different content, with a different height. For each new height, a layout is created.
        dbCursor.Position = i
        Height = su.MeasureMultilineTextHeight(lblMeasure, dbCursor.GetString("Text")) + (Padding * 2)
        If Not(ULV.LayoutExists("TEXT_" & Height)) Then
            ULV.AddLayout("TEXT_" & Height, "Item_LayoutCreator", "Item_ContentFiller", Height + 60dip,True)
        End If
        ULV.AddItem("TEXT_" & Height, i)       
    Next



End Sub




Sub Activity_Resume
End Sub

Sub Activity_Pause(UserClosed As Boolean)
    'When the user quits, the database is deleted
    If UserClosed And File.Exists(File.DirInternal, "wikipedimo.db") Then
        File.Delete(File.DirInternal, "wikipedimo.db")
    End If

    'Number of layouts used in this example
    If ULV.IsInitialized Then Log("Nb. of layouts = " & ULV.NumberOfLayouts)
End Sub

Sub PanelWithWhiteGradient(pnl As Panel)
    'Creates a panel with a gradient background (from white to very light gray)
    Dim gd As GradientDrawable
    Dim Couleurs(2) As Int
    If HoloDark Then
        Couleurs(0) = Colors.RGB(30, 30, 30)
        Couleurs(1) = Colors.Black
    Else
        Couleurs(0) = Colors.White
        Couleurs(1) = Colors.RGB(240, 240, 240)
    End If
    gd.Initialize("TOP_BOTTOM", Couleurs)
    pnl.Background = gd
End Sub

Sub Item_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
    PanelWithWhiteGradient(LayoutPanel)

    'Very simple layout: just an ImageView
    Dim IV As ImageView
    IV.Initialize("")
    IV.Gravity = Gravity.LEFT
    LayoutPanel.AddView(IV, 0, 0, 100%x, 60dip)
   
    'Aggiungo una label affianco ad immagine
    Dim lbl0 As Label
    lbl0.Initialize("")
    lbl0.Color = Colors.Transparent
    'If HoloDark Then
        lbl0.TextColor = Colors.White
    'Else
    '    lbl.TextColor = Colors.Black
    'End If
    lbl0.TextSize = FontSize
    lbl0.Typeface = Typeface.DEFAULT
    lbl0.Gravity = Gravity.TOP
    LayoutPanel.AddView(lbl0, 95dip, 5dip, LayoutPanel.Width - 100dip, 60dip)
   
    'Aggiungo una label affianco ad immagine
    Dim lbl1 As Label
    lbl1.Initialize("")
    lbl1.Color = Colors.Transparent
    'If HoloDark Then
        lbl1.TextColor = Colors.White
    'Else
    '    lbl.TextColor = Colors.Black
    'End If
    lbl1.TextSize = FontSize
    lbl1.Typeface = Typeface.DEFAULT
    lbl1.Gravity = Gravity.TOP
    LayoutPanel.AddView(lbl1, 95dip, 25dip, LayoutPanel.Width - 100dip, 60dip)
   
    'Panel come linea
    Dim linea As Panel
    linea.Initialize("")
    LayoutPanel.AddView(linea, 0, 65dip, LayoutPanel.Width, 1dip)
   


   

    'Very simple layout: just a label
    Dim lbl As Label
    lbl.Initialize("")
    lbl.Color = Colors.Transparent
    'If HoloDark Then
        lbl.TextColor = Colors.White
    'Else
    '    lbl.TextColor = Colors.Black
    'End If
    lbl.TextSize = FontSize
    lbl.Typeface = Typeface.DEFAULT
    lbl.Gravity = Gravity.TOP
    'LayoutPanel.AddView(lbl, Padding, Padding, 100%x - (Padding * 2), LayoutPanel.Height - (Padding * 2))
    LayoutPanel.AddView(lbl, Padding, 70dip, 100%x - (Padding * 2), LayoutPanel.Height - (Padding * 2))
    'LayoutPanel.AddView(lbl, Padding, IV.Height, 100%x - (Padding * 2), LayoutPanel.Height - (Padding * 2) + IV.Height)

        'Panel come linea
    Dim linea1 As Panel
    linea1.Initialize("")
    LayoutPanel.AddView(linea1, 0, lbl.Height + 10dip, LayoutPanel.Width, 1dip)
   
End Sub

Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
    'Inserisci Immagine
    Dim IV As ImageView = LayoutPanel.GetView(0)
    IV.Bitmap = bmpAndroid
   
    'Reads the data and sets the label text
    Dim lbl0 As Label = LayoutPanel.GetView(1)
    'dbCursor.Position = Position - 1
    dbCursor.Position = Position
    lbl0.Text = dbCursor.GetString("altro")
   
    'Reads the data and sets the label text
    Dim lbl1 As Label = LayoutPanel.GetView(2)
    'dbCursor.Position = Position - 1
    dbCursor.Position = Position
    lbl1.Text = "ore: 434434 - Messaggio"
   
    'Linea
'    Dim linea As Panel =  LayoutPanel.GetView(3)
'    linea.Color = Colors.Red
   
   
    'Reads the data and sets the label text
    Dim lbl As Label = LayoutPanel.GetView(4)
    'dbCursor.Position = Position - 1
    dbCursor.Position = Position
    lbl.Text = dbCursor.GetString("Text")
   
    'Linea 2
    Dim linea As Panel =  LayoutPanel.GetView(5)
    linea.Color = Colors.Red
   
End Sub



Sub ULV_CellClick(RowID As Long, CellIndex As Byte, Position As Int, ClickedPanel As Panel)
    'Shows a MsgBox with some data of the clicked cell
    dbCursor.Position = RowID
    Msgbox("Test=" & dbCursor.GetString("altro"), "Click")
End Sub

Sub ULV_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
    Log(Position)
End Sub

In attachment source.

Where i wrong ?

Thank you
Marco
 

Attachments

  • MioTestULV.zip
    21 KB · Views: 394
Cookies are required to use this site. You must accept them to continue using the site. Learn more…