CustomListView - A flexible list based on ScrollView

Status
Not open for further replies.

mc73

Well-Known Member
Licensed User
Longtime User
Great job, Erel - as always. Sometimes, I wonder, though, whether in a 'big' project containing many of such classes, would tend to use more resources than specialized routines. Just a thought, after seeing some limitations of the Android OS. Anyway I'm off topic, great job, again!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
whether in a 'big' project containing many of such classes, would tend to use more resources than specialized routines.
Assuming that the classes are well written and used correctly then you will not have any negative impact on performance.

If you look at the code of SearchView and TableView you will see that they are highly optimized. This specific class is simpler as it is intended for limited sized lists (1000 - 2000 items).
 

mc73

Well-Known Member
Licensed User
Longtime User
Assuming that the classes are well written and used correctly then you will not have any negative impact on performance.

If you look at the code of SearchView and TableView you will see that they are highly optimized. This specific class is simpler as it is intended for limited sized lists (1000 - 2000 items).

I will surely take a look, after all, it's always interesting and provides great ideas!
 

Informatix

Expert
Licensed User
Longtime User
That would be great if I could pass an existing ScrollView to the class. This way, I could catch the ScrollView event, remove the panel needed to embed the scrollview and put this scrollview in a layout file (.bal).
This class gives me a lot of good ideas to improve my Checklist class. Thank you.
 

Informatix

Expert
Licensed User
Longtime User
There's a more reliable method to get the pressed drawable (I found this after many tries in my own class):
B4X:
   Dim r As Reflector
   r.Target = r.GetContext
   r.Target = r.RunMethod("getResources")
   r.Target = r.RunMethod("getSystem")
   Dim ID_PressedDrawable As Int
   ID_PressedDrawable = r.RunMethod4("getIdentifier", Array As Object("list_selector_background_pressed", "drawable", "android"), Array As String("java.lang.String", "java.lang.String", "java.lang.String"))
   r.Target = r.GetContext
   r.Target = r.RunMethod("getResources")
   PressedDrawable = r.RunMethod2("getDrawable", ID_PressedDrawable, "java.lang.int")
If you want to be convinced, replace this method by yours in my class CheckList and test the first layout ("Check only").
 

bluedude

Well-Known Member
Licensed User
Longtime User
Saved my day

Thanks,

This saved my day :) Listviews are very limited and this call is exactly what I need.
 

AscySoft

Active Member
Licensed User
Longtime User
Is it possible to create a list with some products where user is suppose to pick as many as he wants and then, on the same line(item) to put a number(textboxview, up/down customview or something) near any item he choose?

For ex. one must pick some products and quantities on a single step!

Sorry for my English. I hope YOU understand.
 

Informatix

Expert
Licensed User
Longtime User
Is it possible to create a list with some products where user is suppose to pick as many as he wants and then, on the same line(item) to put a number(textboxview, up/down customview or something) near any item he choose?

For ex. one must pick some products and quantities on a single step!

I created two examples. The first is made with CustomListView, the second is made with another class: CheckList. I tried to get the same result with both.
In this example, CheckList uses three functions (AddHeader, ExtendItem and CheckedList) which have no counterpart in CLV. Make your own choice between them.
 

Attachments

  • CustListVw_Example.zip
    10.2 KB · Views: 3,517
  • CheckList_example.zip
    12.7 KB · Views: 2,445
Last edited:

AscySoft

Active Member
Licensed User
Longtime User
I created two examples. The first is made with CustomListView, the second is made with another class

Thanks, that's a start.
The first example is working well.
I like the second one better, where you could display additional data (like price etc), but this example is not working too well
When I try to scroll down, application crush, saying "Sub pnlsvtouch signature does not match expected signature".
I am missing something?
 

AscySoft

Active Member
Licensed User
Longtime User
It's as simple as that.

Thanks, I already create that. Now I was just wandering, how to put the 3 views(plus/minus,qty) on the second line(on expanded panel), because to be honest... the list items tend to have more characters in description/name on real world app...

And one other thing(with is related with the one above).... I think you should implement a list on global process(or class) because one may "lose" item checked after screen rotation ie.

Thanks
 

Informatix

Expert
Licensed User
Longtime User
Thanks, I already create that. Now I was just wandering, how to put the 3 views(plus/minus,qty) on the second line(on expanded panel), because to be honest... the list items tend to have more characters in description/name on real world app...

You don't need the expanded panel to create a second line. You just have to increase the item panel height and put the views below the existing ones.

And one other thing(with is related with the one above).... I think you should implement a list on global process(or class) because one may "lose" item checked after screen rotation ie.

I cannot answer for the Erel's class, but for mine, I won't add this feature because it's not the class job. It does not store data. Use the StateManager module to handle that.
 

AscySoft

Active Member
Licensed User
Longtime User
You don't need the expanded panel to create a second line. You just have to increase the item panel height and put the views below the existing ones.

Thanks for the tip and for your time and patience.
But I will try to make this 3 views created from code on checked event, for my knowledge and for a simple list with one line per item!
 
Last edited:

Jaames

Active Member
Licensed User
Longtime User
The list is laggy when .Add and .Clear is called multiple times..
I'm loading 30 records , not too much...

Why is that?
 
Status
Not open for further replies.
Top