Android Question How to check for current panel type in Customlistview?

Reminisce

Active Member
I have this code for my customlistview class
Customlistview load more code.:
Sub lvmenufeed_loadmore
    Dim lbllastpostid As Label
    Dim pnl As Panel
    pnl = lvmenufeed.GetPanel(lvmenufeed.thesizer - 1)
    lbllastpostid = pnl.GetView(10)
    lastfeedpostid = lbllastpostid.Text


    ToastMessageShow("Loading more posts...",False)
    
    '''/get lastpostid
    
    LogColor(lastfeedpostid,Colors.Yellow)
    
    If lvmenufeed.thesizer = 0 Then
        firstloadpost
    Else
        loadolderpost
    End If
    loadoldpost = True
    LogColor(lastfeedpostid,Colors.Yellow)
End Sub

I have a panel at some index that loads images, some load videos, something like facebook feed.

While scrolling up/down I need to know if it's displaying the panel with the video view so I can catch the videoview.isplaying action.

Code that populates my Lvmenufeed (customlistview):
Sub loadlvfeed

Dim parser As JSONParser

parser.Initialize(feedresponse)

feedresponselist= parser.NextArray

feedresponsemap.Initialize

                    Dim imgmap,m As Map

    Dim pnl As Panel

    Dim imgpostimage As ImageView

    Dim videoplayer As VideoView

    Dim videoplayerlayout As VideoViewRelativeLayout

    Dim pnlvholder As Panel

    imgmap.Initialize

    m.Initialize

                

For i = 0 To feedresponselist.Size - 1

    feedresponsemap = feedresponselist.Get(i)

    Dim user_profilepicture_thumb As String = feedresponsemap.Get("user_profilepicture_thumb")

    Dim post_content As String = feedresponsemap.Get("post_content")

    Dim post_id As String = feedresponsemap.Get("post_id")

    Dim post_date As String = feedresponsemap.Get("post_date")

    Dim user_verifiedaccount As String = feedresponsemap.Get("user_verifiedaccount")

    Dim user_title As String = feedresponsemap.Get("user_title")

    Dim post_like As Int= feedresponsemap.Get("post_like")

    Dim post_type As String = feedresponsemap.Get("post_type")

    Dim post_media_content As String = feedresponsemap.Get("post_media_content")

    Dim user_username As String = feedresponsemap.Get("user_username")

    Dim post_user_id As String = feedresponsemap.Get("post_user_id")

    post_date = du.FormatDateTime(DateTime.Now, Bit.Or(du.FORMAT_SHOW_WEEKDAY, du.FORMAT_SHOW_DATE))

                        

    If user_verifiedaccount = 1 And user_title <> "" Then

        user_title = user_title

    End If

                        

    If user_verifiedaccount = 0  Then

        user_title = "Unverified"

    End If

                        

    If user_verifiedaccount = 1 And user_ti

Screenshot_20200201-090845.png

That's my feed..
 

lucasheer

Active Member
Licensed User
Longtime User
I always set the tag of the panel:

feedPanel.tag = 1
or
feedPanel.tag = 2

Then use it later:

B4X:
if(feedPanel.tag = 1) then

else if(feedPanel.tag = 2) then

end if

or if you need to store multiple objects in the tag, create a custom TYPE, and change the tag to your custom object. Then, grab the tag whenever you need it to check what it is.
 
Upvote 0

Reminisce

Active Member
I always set the tag of the panel:

feedPanel.tag = 1
or
feedPanel.tag = 2

Then use it later:

B4X:
if(feedPanel.tag = 1) then

else if(feedPanel.tag = 2) then

end if

or if you need to store multiple objects in the tag, create a custom TYPE, and change the tag to your custom object. Then, grab the tag whenever you need it to check what it is.
I could add the panel tag while populating the clv from the example code I provided. I just need to know how to check for it whilst scrolling through the feed.
 
Upvote 0

lucasheer

Active Member
Licensed User
Longtime User

Check out the CLV1_VisibleRangeChanged Method. You can set a flag on the video to state whether its been loaded or not :)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I have this code for my customlistview class
Don't use CustomListView class. You should use xCustomListView library.

You can store any information you like in the value field. This is the correct place for it. Use a custom type if you need to store several values.
 
Upvote 0

Reminisce

Active Member
Don't use CustomListView class. You should use xCustomListView library.

You can store any information you like in the value field. This is the correct place for it. Use a custom type if you need to store several values.
I'm using the class because I did some modifications and is the "sv_scrollchanged" Method in the library? I'll check it out though.
 
Upvote 0
Top