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:

Loading...