B4A Library [Lib] UltimateListView

Informatix

Expert
Licensed User
Longtime User
Users have reported an issue with LoadImageAsync. Since Android v5, some images are not fully downloaded and a lot of error messages can be seen in the log. I tried to add a workaround in a previous version of ULV but it seems that's not enough. Unfortunately, the code that fails to work properly is in the Android API, not in the ULV code.
Downloading images is not a core feature of ULV (ULV is not supposed to handle data so this downloading code should not be in the lib), but I feel the need to keep it working as expected, without breaking the existing code, so I'll see next week if I can replace the calls to the Google's API by calls to the new OkHTTP lib used by B4A. I don't promise anything.
An alternative is to use a custom loader (as you do when you want to load an image from a database) and download images with another library.
I'm sorry for the inconvenience.
 

peacemaker

Expert
Licensed User
Longtime User
Is it correct that ULV cannot:
1) contain layout with scrollable views (GoogleMap)
2) be put itself into a ScrollView
?

p.s. trying to make vertically swiping interface like here
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
It's question that is important for all ULV users - this is the reason of my this public post. If you think another - let's remove the posts.
I tried to make the interface with scrolling views inside the scrolling parent, and could not reach the result.
But if it's common issue, not related only to ULV - so asked you.
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
It's question that is important for all ULV users - this is the reason of my this public post. If you think another - let's remove the posts.
It's the answer that may interest other users, not the question. So I repeat the answer for everyone: theoretically, a scrolling view cannot work well inside another scrolling view because the parent view intercepts the touch events and consumes them for its own scrolling, so the child view cannot see the events of the scrolling gesture. You can disallow the interception of touch events in some views, not in ULV.
 

Informatix

Expert
Licensed User
Longtime User
Good news: I replaced the code downloading images and the new version with OkHttp seems to work fine. My code is now a lot simpler as I removed many workarounds. Maybe I will add the possibility to add credentials for downloading on servers requiring an authentication.

Bad news:
an user reported a bug with Android 7 when you click on an item with SelectionMode set to SELECTION_SINGLE. The ClickedPanel got with the event is null because the visible items are recreated when the selection code is run, and since I disabled the recycling under Android 7, the clicked panel does no longer exist when the event code is run. The only proper solution that I see is to remove ClickedPanel from the event parameters. This parameter should not be there anyway as I always advise against accessing directly the panels to get data.
Tell me what you think of it.
 

johndb

Active Member
Licensed User
Longtime User
I'm using clickedpanel often. That's how I access the views in the selection. I'm currently using version 4.20 as I had problems with accessing views with newer versions. I haven't had time to submit a pruned down app showing the problem but will do so next week. No problems using UlimateListView 4.20 with Android 4.4 to 7.1
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
I wait for your email describing the problem with the recent versions.

My question was not clear enough: is there a case where ClickedPanel is the best way to access the views? There's maybe a case that I'm not aware of or that I don't remember. Using it is convenient, for sure, but it is not the recommended method. Removing this parameter is the only solution that I see for now. When I raise the ItemClick event, the clicked panel still exists, but when your code receives the event, it has gone because in the meanwhile the views were recreated by the selection code (the Filler sub is called for each item to let it update its state).
 

fredo

Well-Known Member
Licensed User
Longtime User
I'm using clickedpanel often.
Me too.

I make heavy use of ClickedPanel in my projects to pass values that are created at filltime via tags of views ...

...and it is working very well as you can see in this app: https://play.google.com/store/apps/details?id=com.rolloapps.fby&hl=en
https://play.google.com/store/apps/details?id=com.rolloapps.fby&hl=en
I know that the underlying datasource should be the only source of item-related data, but over the years ClickedPanel was a reliable transporter for all kind of objects to make them shorthand available in _ItemClick().
 

Informatix

Expert
Licensed User
Longtime User
I understand that it is convenient and I don't like breaking existing code but, if I keep this parameter, I will have to explain why it crashes your app under Android 7 as soon as you set the selection mode of ULV.
Note that you can get the clicked panel with this code:
B4X:
Sub getClickedPanel(Position As Int) As Panel
   Dim JO As JavaObject = ULV
   Return JO.RunMethod("getChildAt", Array(Position))
End Sub
Sub ULV_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
   Dim MyLabel As Label = getClickedPanel(Position).GetView(0)
...
EDIT: I found at least one case where the code above is not reliable.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…