B4i Library [class] CustomListView

Discussion in 'iOS Libraries' started by Erel, Nov 6, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    B4i implementation of CustomListView (http://www.basic4ppc.com/android/fo...xible-list-based-on-scrollview.19567/#content).

    Note that you should make sure that there is a live reference to all instances of CustomListView. Otherwise the instance will be released and the events will not be raised.

    You can use a global variable to store a live reference.

    New version was uploaded. CustomListView is implemented as a custom view. It should be added with the designer.

    V1.76 uploaded. This update brings the improvements added to B4A CustomListView:
    - Animated inserts.
    - ResizeItem method.
    - FirstVisibleIndex / LastVisibleIndex properties.
    - ScrollToItem.
    - ReachEnd event.
    - RemoveAt / ReplaceAt methods.

    The class will be included as a library in B4i v4.30.
     

    Attached Files:

    Last edited: Aug 27, 2017
  2. DonManfred

    DonManfred Expert Licensed User

    B4A implementation...
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    I meant to say that this is the B4i implementation of B4A CustomListView.
     
    DonManfred likes this.
  4. hzchrisfang

    hzchrisfang Member Licensed User

    Hi, awesome Erel, could you please add longclick event into CustomListView ? And how to recognize swipe gestures ?
     
    Last edited: Nov 20, 2014
  5. Erel

    Erel Administrator Staff Member Licensed User

    Add this sub to add long click. Adding swipe gestures is more complicated.
    Code:
    Private Sub Panel_LongClick
       
    Dim p As Panel = Sender
       p.GetView(
    0).Color = HighlightColor
       p.GetView(
    0).SetColorAnimated(700Colors.Transparent)
       
    CallSub3(CallBack, EventName & "_ItemLongClick", p.Tag, items.Get(p.Tag))
    End Sub
     
  6. hzchrisfang

    hzchrisfang Member Licensed User

    Thanks Erel.
    I thought the Click and LongClick have different animate effect, know now that I was wrong.
     
  7. hzchrisfang

    hzchrisfang Member Licensed User

    I have add LongClick sub into my app. But when I take long press on my phone, it produce a multiple LongClick event response, how could this be?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    It is a bug related to LongClick event. It is fixed for the next update which will be released later today.
     
  9. LucaMs

    LucaMs Expert Licensed User

    In the meantime, you could use a boolean variable at module level, check and set it in the event, so as not to repeat it.
     
  10. hzchrisfang

    hzchrisfang Member Licensed User

    OK, I got it, thank you.
     
  11. stobi

    stobi New Member Licensed User

    Is the pull to refresh feature available in this B4I version ?
    Also I'm Looking for a possibility to allow the User to reorder the list items. Is this possible?
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    Both features are not implemented. You will need to modify the class to support them.
     
  13. stobi

    stobi New Member Licensed User

    As I'm new to B4I I don't think I'm able to implement this functionality ...
    Will these features be available once the default iOS ListView will be implemented ?
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    I don't know.
     
  15. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    How can I implement the ScrollViewEvents in this CLASS?
     
  16. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

  17. Erel

    Erel Administrator Staff Member Licensed User

    Almost the same code as in B4A:
    Code:
    Sub sv_ScrollChanged (OffsetX As Int, OffsetY As Int)
       
    If OffsetY + sv.Height >= sv.Panel.Height Then
         
    If DateTime.Now > lastAddItemsTime + 200 Then
           lastAddItemsTime = 
    DateTime.Now
           
    CallSub(CallBack, EventName & "_AddItems")
         
    End If
       
    End If
    End Sub
    Add to Class_Globals:
    Code:
    Private lastAddItemsTime As Long
    Main module:
    Code:
    Sub clv1_AddItems
      
    Log("AddItems")
      
    For i = 1 To 20
      clv1.AddTextItem(i, i)
      
    Next
    End Sub
     
  18. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    Hi, I have a customlistview and
    1) when I add more lines than the screen height, I scrooll the list till the end, and, the last item is always showed at half its height.
    How to solve this?
    2) any way to sort the list by any of its line components?
    How?

    Thanks
     
  19. ilan

    ilan Expert Licensed User

    Does it means that we need to change old projects where we added the clv in our code and not via designer? (If we use the new class)
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    Yes. However you can keep the old implementation and only use the new implementation in new projects.
     
    ilan likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice