Hi,
As we are using vertical list, we need to show (or) hide the menu items in the list based on the external status which varies for each menu item.
We are showing four menu items in a single page. All the menu items are static which is stored in a array. (database)
we are using a queue for maintaining the currently availble item's array index and loading the items with the requested array index in onloaditem.
for reference :
whole queue :
| 1 |
| 2 |
| 3 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
page currently in screen :
| 7 |
| 8 |
| 9 |
| 10 |
if item 10 is hided,
the actual result is
| 7 |
| 8 |
| 9 |
-empty-
the expected result is
| 6 |
| 7 |
| 8 |
| 9 |
first we are adjusting number of items, then calling invalidateitems(0, no_of_items-1), to load the whole list. In this case, In onloaditem 6th index is also getting loaded but once invalidate is completed. only 7,8 and 9 is visible. we are using scroll offset and adjusting this scenario.
number of items shown (or) hidden at the same time can differ. it will be within the array size. If 4 items are hided, and we are updating Vertical list number of items first, then we are calling invalidate_items, both times onload is getting triggered to reload the items.
when onload item is triggered by the change in number of items, it is showing different item (because the list is shrinking), after a gap when invalidate is called then the expected screen is visible.
Also highlighter is maintained separately and ensure visibility is called to verify highlighted item is present in the screen.
first onload second onload
I have implemented it with some issues. for a clarification, is it possible to implement show/hide condition for menu items using vertical list. List view state updating, no of items updating and highlighter pointing all these sequences will be able to maintain in a order. Because when the update view state is calling onloaditem can't be determined by us. I have doubt in the vertical list sequence.