B4A Library [B4X] [XUI] AS ViewPager based on xCustomListView

Alexander Stolte

Expert
Licensed User
Longtime User
but between Last and First Page and vice versa its a instant screenjump instead of scrolling, is this correct?
Thats correct, because its not possible to get to the first page from the last page, without scroll back to the other pages. And if I used smooth scroll, you would always see that you are thrown back.

it does not work in vertical mode.
i'll check
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.33
    • B4I Native paging is now used
      • The paging feels smoother now
      • In debug mode, the swiping should now also run better
Swiping feels much better now in B4I

I have tested the changes in ASScheduler and ASCalendarAdvanced and have not seen any bugs related to the new paging.
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
does this mean that GestureRecognizer is not needed anymore?
Haha, no

I was looking forward to it, but then I saw that I have 2 events (TouchDown and TouchUp) and 1 function (Carousel) that only work with gestures...
But maybe I'll manage to put the functions I need into the class of GestureRecognizer. I had tried that before, but it never worked.
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
Update
  • 1.31
    • Add Designer Property LoadingPanelColor
how do I revert to the old behavior?
while on B4A, I get a nice fade-in effect, from black to the actual layout, on B4i the effect is not so pleasant: the full layout appears immediately and the goes black and fades in again
as a workaround I set LoadingPanelColor to Transparent
 

Alexander Stolte

Expert
Licensed User
Longtime User
The loading panel is shown when the Base_Resize event is triggered, when the ViewPager is loaded the panel is shown until the Base_Resize event is triggered the 1st time.

In B4A this will happen only 1 time automatically, because there is no B4XPage_Resize event where the page is resized, unless you resize the view in the code.

Since I don't know how you integrated the ASViewPager into your project it's hard to say, I would guess that the Base_Resize event is triggered several times.
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
Same code in B4A and B4i: no explicit calls to Base_Resize
I think it’s called by the system after LoadLayout
 

angel_

Well-Known Member
Licensed User
Longtime User
I have updated to the latest version (was v1.24 before) and loading the views shows a black screen for a short time, it happens in B4A and B4i.
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
I have updated to the latest version (was v1.24 before) and loading the views shows a black screen for a short time, it happens in B4A and B4i.
10 versions. Thats hard
Yes this is a deliberate behavior, the black should be smooth when disappearing. If you want it to hide completely, just set the "LoadingPanelColor" property in the designer to transparent.
 

pliroforikos

Active Member
Licensed User
Hello
I'm trying to use viewpager with one view in more than 1 pager.
I only get items in last page.
I need a help please to show a clv to more than 1 pages.

B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("frm_main")
    For i = 0 To 3
        xpnl = xui.CreatePanel("")
        xpnl.SetLayoutAnimated(0,0,0,ASViewPager1.Base.Width,ASViewPager1.Base.Height)
        xpnl.LoadLayout("list")
        ASViewPager1.AddPage(xpnl,i +1)
'        Label1.Text = "View " & i
    Next
    B4XPages.SetTitle(Me,"ASViewPager Example | Page " & 1 & "/" & ASViewPager1.Size)
End Sub


Sub ASViewPager1_PageChanged (index As Int)
    Log("PageChanged: " & index)
    B4XPages.SetTitle(Me,"ASViewPager Example | Page " & (index +1) & "/" & ASViewPager1.Size)
    CustomListView1.clear

    If index = 0 Then
        For i = 1 To 20
            CustomListView1.AddTextItem($"Item #${i}"$, $"Item #${i}"$)
        Next
    else if index = 1 Then
        For i = 21 To 40
            CustomListView1.AddTextItem($"Item #${i}"$, $"Item #${i}"$)
        Next
    else if index = 2 Then
        For i = 41 To 60
            CustomListView1.AddTextItem($"Item #${i}"$, $"Item #${i}"$)
        Next
    else if index = 3 Then
        For i = 61 To 80
            CustomListView1.AddTextItem($"Item #${i}"$, $"Item #${i}"$)
        Next
    End If
End Sub
 

Attachments

  • Project.zip
    18.6 KB · Views: 134

Alessandro71

Well-Known Member
Licensed User
Longtime User
Is there any option to dynamically hide/unhide pages?
Example: I have 4 pages
page1
page2
page3
page4

page 3 should be displayed based on an external condition
using Remove/Add on pages will also change the index of page4, so i'm looking for something that would not change the underlaying structure
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.35
    • Add Designer Property BackGestureGap - Only for B4I. If you use the ViewPager on a 2nd page and still want to close the page with the swipe gesture then set the checkbox to true
      • Default: False
If the property is set to true, then you can use the native back gesture of ios again to switch to the previous page. I just place an invisible panel 30dip on the left side, so the swipe gesture from the gesture recognizer is no longer used on this area and the native back gesture can be used again.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.00
    • New dependency in B4J: jPager
    • Removed dependency in B4J: xCustomListView
    • Add GetPanel
    • Add GetValue
    • In B4J, the jPager is now used instead of the xCustomListView
      • Better performance
      • No more unwanted scrolling with the mouse
jPager
The xCustomListview was not good enough for desktop use, it often gave me a stomach ache. So I decided to develop a custom pager for the AS_ViewPager for B4J.
Switching between pages is done with the Arrow keys, or with the functions: NextPage/PreviousPage
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…