B4A Library [B4X] [XUI] AS Swipe Card - a tinder like swipeable card view [Payware]

asales

Expert
Licensed User
Longtime User
Just for information: if you run the examples, open the layout and save it before.
If you don't this will get this error:

B4X:
asswipecard_ini_props (java line: 297)
java.lang.RuntimeException: Cannot parse: null as boolean
    at anywheresoftware.b4a.BA.parseBoolean(BA.java:629)
    at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:699)
 

asales

Expert
Licensed User
Longtime User
Hello Alexander,
I have some questions:

1 - How can I load a layout (with labels, images and buttons) to the card?
I tried to change this:
Dim xpnl_cardbase As B4XView = CreateLabel("")
to this:
Dim xpnl_cardbase As B4XView = xui.CreatePanel("")
but I get this error:
'java.lang.RuntimeException: Type does not match (class anywheresoftware.b4a.BALayout)

2 - In the B4J example the button "Go To First Card" don't works.

3 - I want to save the card index and go to this index when the user start the app.
I made some changes to test.
With 10 cards (index 0-9), if I started in the index 8 and move to the last, I get this issues:
a) I don't see the button and label "You Reached the End" when the last card is show.
b) After click in the Next - in the last item (#9) - the first card (#0) is show and not the label and button "Go To First Card".
B4X:
For i = 0 To 10 -1  
    Dim xpnl_cardbase As B4XView = CreateLabel("")
    (...)
    ASSwipeCard1.AddCard(xpnl_cardbase,"")
Next

ASSwipeCard1.CurrentIndex = 8  'last index used

Thanks for your support.
 

asales

Expert
Licensed User
Longtime User
1 - I don't saw the Click and LongClick events in the component.
Can we have this?
I want to use a click to open another module with information of the selected card and a longclick to confirm and remove the card.

2 - There is a limit of cards added to the component? To avoid issues like out of memory, for example?

Thanks for your support.
 

Alexander Stolte

Expert
Licensed User
Longtime User
1 - I don't saw the Click and LongClick events in the component.
There is a reason why this is not included, because it is not possible, because the Touch Event steals the events.
You have to add a panel that triggers a click event and then check the current index.

2 - There is a limit of cards added to the component? To avoid issues like out of memory, for example?
Your device is the limit.
I might add lazy loading at some point if it's really necessary.

sorry for the long delay, i had corona for the 2nd time...
 

asales

Expert
Licensed User
Longtime User
There is a reason why this is not included, because it is not possible, because the Touch Event steals the events.
You have to add a panel that triggers a click event and then check the current index.
I understand. I'll try this.
Your device is the limit.
I might add lazy loading at some point if it's really necessary.
Will be great.
sorry for the long delay, i had corona for the 2nd time...
No problem. I hope you are well now.

Thanks for the answers.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.00
    • Add Designer Property LazyLoading - activates lazy loading
      • Default: False
    • Add Designer Property LazyLoadingExtraSize - How many pages to load in advance
      • Default: 5
    • Add Event LazyLoadingAddContent - Add here your layout or views
    • Add get and set LazyLoadingExtraSize
    • Add Commit - Triggers the LazyLoadingAddContent event
      • Call this after you have added the cards
LazyLoading
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("frm_main")
   
    ASSwipeCard1.IniParent(Root)
   
    For i = 0 To 100 -1
        Dim xpnl_cardbase As B4XView = xui.CreatePanel("")
        xpnl_cardbase.SetLayoutAnimated(0,0,0,ASSwipeCard1.Base.Width,ASSwipeCard1.Base.Height)
        ASSwipeCard1.AddCard(xpnl_cardbase,i)
    Next
   
    Sleep(0)
    ASSwipeCard1.Commit
   
End Sub

Private Sub ASSwipeCard1_LazyLoadingAddContent(Parent As B4XView, Value As Object)
    Dim xpnl_cardbase As B4XView = CreateLabel("")
    xpnl_cardbase.SetColorAndBorder(xui.Color_ARGB(255,Rnd(1,254), Rnd(1,254), Rnd(1,254)),0,0,10dip)
    xpnl_cardbase.Text = "Item #" & Value
    xpnl_cardbase.SetTextAlignment("CENTER","CENTER")
    xpnl_cardbase.TextColor = xui.Color_White
    xpnl_cardbase.Font = xui.CreateDefaultBoldFont(20)
    Parent.AddView(xpnl_cardbase,0,0,ASSwipeCard1.Base.Width,ASSwipeCard1.Base.Height)
End Sub
 

asales

Expert
Licensed User
Longtime User
Is possible add more space to the margins left and right and adjust the text?

I tried to change this code, but there is no effect:
B4X:
xpnl_cardbase.SetLayoutAnimated(0,0,0,ASSwipeCard1.Base.Width,ASSwipeCard1.Base.Height)

to

xpnl_cardbase.SetLayoutAnimated(0,10%x,5%y,ASSwipeCard1.Base.Width - 10%x, ASSwipeCard1.Base.Height - 5%y)
Thanks in advance.
 

hears

Active Member
Licensed User
Longtime User
do you have alipay or Ethereum coin address ? many people only can pay by this way
 

Daica

Active Member
Licensed User
The attachment is for version 1.01 and not 2.00.
Could you please update attachment.

No wonder I would not find some of the options you guys were talking about lol
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…