B4J Tutorial [ABMaterial] Infinite scrolling pages with 1.07

A new feature in v1.07 will be Infinite Scrolling Pages (like twitter, facebook, etc). It's going to be super simple to make :)

Demo video:

The code:
B4X:
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
    ...
    LoadNewCard
End Sub

Sub Page_NextContent(TriggerComponent As String)
    LoadNewCard
End Sub

Sub LoadNewCard()
    Dim pagecont As ABMContainer = page.Component("cont")

    ' build the card
    Dim tmpCard As ABMCard
    tmpCardId = tmpCardId + 1
    DateTime.TimeFormat = "HH:mm:ss"
    tmpCard.InitializeAsCard(page, "card" & tmpCardId, DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.now), "This is a new card from an infinite page", ABM.CARD_LARGE, "whitetitle")
    Dim picNr As Int = Rnd(1,96)
    tmpCard.Image = "../images2/" & picNr & ".jpg"
    tmpCard.AddAction("BUTTON 1")   

    ' add the card and refresh
    pagecont.Cell(15,1).AddComponent(tmpCard)
    pagecont.cell(15,1).Refresh

    ' set this card as the new trigger, when 200 pixels from the bottom
    page.RaiseNextContentOnComponent(tmpCard,200)
End Sub
 
Last edited:

somed3v3loper

Well-Known Member
Licensed User
Longtime User
And this ?
B4X:
Sub Page_NextContent(TriggerComponent As String)
    publictrigger = TriggerComponent
    'add show more item (button or another view )
End Sub

sub showmore_Click
    ' retrieve new items starting with publictrigger
end sub
 
Top