B4A Library CreditCardView

Discussion in 'Additional libraries, classes and official updates' started by jahswani, Jun 23, 2015.

  1. jahswani

    jahswani Active Member Licensed User

    You sometimes ask your users to enter their card information.Sometimes it's boring this is a lib to render the experience more cool.
    Depends On nineoldandroids-2.4.0.jar
    Copy jar and XML to your additional lib folder.
    copy the 3 fonts files in the example to your assets folder.
    Please buy me a beer if you think this lib is awesome.
    CreditCardView
    Version:
    1
    • CreditCardView
      Events:
      • ontoggle
      Fields:
      • ba As BA
      Methods:
      • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
      • BringToFront
      • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
      • Initialize (EventName As String)
      • Invalidate
      • Invalidate2 (arg0 As Rect)
      • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • IsInitialized As Boolean
      • RemoveView
      • RequestFocus As Boolean
      • SendToBack
      • SetBackgroundImage (arg0 As Bitmap)
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
      • isShowingFront As Boolean

        Return type: @return:
      • setCardValidThru (month As Int, year As Int)

        month:
        year:
      • setValidThruText (valid As String, thru As String)
      • toggleCardFace
      Properties:
      • Background As Drawable
      • CardCvv As Integer [write only]
      • CardName As String [write only]
      • CardNumber As String [write only]
      • Color As Int [write only]
      • CvvTextInput As EditText [write only]
      • Enabled As Boolean
      • ExpirationTextInput As EditText [write only]
      • Flag As CardFlag [write only]
      • Height As Int
      • InformationText As String [write only]
      • Left As Int
      • MonthYearText As String [write only]
      • NameTextInput As EditText [write only]
      • NumberTextInput As EditText [write only]
      • Tag As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int
    [​IMG]

    Code:
    #Region  Project Attributes
        
    #ApplicationLabel: LibEx
        
    #VersionCode: 1
        
    #VersionName:
        
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: unspecified
        
    #CanInstallToExternalStorage: False
    #End Region
    #AdditionalRes : ..\res

    #Region  Activity Attributes
        
    #FullScreen: False
        
    #IncludeTitle: True
    #End Region

    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.

    End Sub
    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
     
     
        
    Private etName As EditText
        
    Private etNumber As EditText
        
    Private etExpiration As EditText
        
    Private etCvv As EditText
        
    Private btnclose As Button
        
    Private btnturn As Button
        
    Private card As CreditCardView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
       Activity.LoadLayout("Layout1")
       card.CardNumber = 
    "3744 4444 4444 4444"
       card.CardName = 
    "Uncle Scrooge"
       card.setCardValidThru(
    8,2015)
       card.setValidThruText(
    "Express","End")
       card.MonthYearText = 
    "MONTH/YEAR"
       card.InformationText = 
    "Legal -SIGNATURE DU TITULAIRE VALIDE UNIQUEMENT APRES SIGNATURE"

        card.ExpirationTextInput = etExpiration
        card.CvvTextInput = etCvv
        card.NumberTextInput = etNumber
        card.NameTextInput = etName
    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub




    Sub btnclose_Click
        card.CardNumber = 
    ""
        card.CardName = 
    ""
        card.setCardValidThru(
    0,0)
        etExpiration.Text = 
    ""
        etCvv.Text = 
    ""
        etName.Text = 
    ""
        etNumber.Text = 
    ""
    End Sub
    Sub card_ontoggle
        
    'TO DO
        ToastMessageShow("I'm in the toggle event",True)
    End Sub
    Sub btnturn_Click
        card.toggleCardFace
    End Sub
     

    Attached Files:

    jmon, Mashiane, Star-Dust and 12 others like this.
  2. MAGAREY

    MAGAREY Member Licensed User

    amazing lib!

    only one question, Any idea why the card's view appears, smaller than the view itself in the designer?
     

    Attached Files:

  3. jahswani

    jahswani Active Member Licensed User

    Are you testing the example ?
     
  4. MAGAREY

    MAGAREY Member Licensed User

    in the example does the same
     

    Attached Files:

  5. jahswani

    jahswani Active Member Licensed User

    This is an old wrapper. The new b4a updates may have passed through. Any way i’ll look into it.
     
  6. MAGAREY

    MAGAREY Member Licensed User

    thank's
     
  7. jahswani

    jahswani Active Member Licensed User

    I just tested on my phone and it seems to work very well. CardView is not resized. 5.01
     
  8. MAGAREY

    MAGAREY Member Licensed User

    I thought maybe it was an error of the emulator, but I tried on my cell phone but the same thing happened 7.1.2
    I tried on debug mode and release mode and still the same.
    Also i tried to create a panel and use addtoparent, without success.
    Any ideas?
     

    Attached Files:

  9. MAGAREY

    MAGAREY Member Licensed User

    I thought that if it enlarges the view, it would compensate the size of the object, but the size of the card remains fixed.
    Did you have the opportunity to see the detail with dimensions?
     
  10. jahswani

    jahswani Active Member Licensed User

    I’ll see how i can do next week.
     
  11. MAGAREY

    MAGAREY Member Licensed User

    thank's man, i appreciate it
     
  12. Carlos marin

    Carlos marin Active Member Licensed User

    I am testing the example and I get this error, what causes it?

    Sin título.png
     
  13. jahswani

    jahswani Active Member Licensed User

    A new wrapper is available if you still need it. PM me.
     
  14. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    hi
    going through this i got some errors
    will appreciate your help

    1- where and how should i put the font files ?
    2 - running the app i get error on loading layout1
    3 - you said there is a newer wrapper - can i please have it ?

    thanks
     
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