B4A Class [B4X] [XUI] AS PinLock

Discussion in 'Additional libraries, classes and official updates' started by Alexander Stolte, Feb 9, 2019.

  1. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    First, i spend a lot of time in creating views, some views i need by my self, but some views not and to create a high quality view cost a lot of time. If you want to support me, then you can do it here by Paypal. :)

    This Class is optimized for B4A and B4I, but not for B4J.

    This is the First Version, if you have bugs, then ask in the comments.

    This is a Lock View, to secure private user data in the app, the user must enter a code to get ahead.

    Screenshot_20190207-211132.jpg ezgif.com-video-to-gif (1).gif Screenshot_20190207-212007.jpg

    You can encrypt the input with the following methods
    • MD5
    • SHA-1
    • SHA-224
    • SHA-256
    • SHA-384
    • SHA-512
    • NONE (the output is 12345678 for example without encryption)
    You can set a Salt value to the Hash.
    And so it works:
    1 + Salt Optional = Hash
    2 + Salt Optional = Hash
    3 + Salt Optional = Hash
    4 + Salt Optional = Hash

    Hash1 + Hash2 + Hash3 + Hash4 + Salt = Final Hash
    The Final Hash you must save and then you can compare the hash with the user input.

    Features
    • you can use your own Layout on the Header (header.LoadLayout("tst.bal"))
    • background and textcolor color is customizable
    • the Fingerprint icon is just a placeholder for your own function like a Fingerprint or a questionmark for help
    • MD5,SHA-1,SHA-224,SHA-256,SHA-384 and SHA-512 to encrypt the input
    • responsive design, you can rotate the smartphone and it still looks cool :cool:
    • 4 or 8 input length
    • more...
    Author: Alexander Stolte
    Version: 1.1

    • ASPinLocker
      • Events:
        • BaseResize
        • CustomKeyClick
        • PinReady (Value As String)
      • Functions:
        • Class_Globals As String
        • ClearInput As String
          Reset the input
        • Deny As String
          Set the Color of Labels in the Code Area to the Deny Color, to show the user that the input was wrong
        • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
          Base type must be Object
        • getCodeLength As Int
          Get or Set the Code Length (4 or 8)
        • getCodeTextColor As Int
          Get or Set the Code Color (Description Text Color and Code Circels Color)
        • getDenyColor As Int
          Get or Set the Deny Color (Description Text Color and Code Circels Color)
        • getDescription As String
          Get or Sets the Description Text (Enter access code)
        • getDescriptionColor As Int
          Get or Sets the Description Color (Enter access code)
        • getEncryptMethod As String
          Get or Set the Encryption Method Valid: MD5 SHA-1 SHA-224 SHA-256 SHA-384 SHA-512 NONE
        • getHeaderColor As Int
          Get or Sets the Header Background Color
        • getHeaderPanel As B4XView
          Get the Header Panel, to load your own Layout
        • getKeyboardClickColor As Int
          Get or Set the Keyboard Click Color
        • getSalt As String
          Get or Set the Salt Value to Secure your User Input more
        • getSuccessColor As Int
          Get or Set the Success Color (Description Text Color and Code Circels Color)
        • Initialize (Callback As Object, EventName As String) As String
        • IsInitialized As Boolean
          Tests whether the object has been initialized.
        • setCodeLength (Length As Int) As String
          Get or Set the Code Length (4 or 8)
        • setCodeTextColor (Color As Int) As String
          Get or Set the Code Color (Description Text Color and Code Circels Color)
        • setDenyColor (Color As Int) As String
          Get or Set the Deny Color (Description Text Color and Code Circels Color)
        • setDescription (text As String) As String
          Get or Sets the Description Text (Enter access code)
        • setDescriptionColor (Color As Int) As String
          Get or Sets the Description Color (Enter access code)
        • setEncryptMethod (Method As String) As String
          Get or Set the Encryption Method Valid: MD5 SHA-1 SHA-224 SHA-256 SHA-384 SHA-512 NONE
        • setHeaderColor (Color As Int) As String
          Get or Sets the Header Background Color
        • setKeyboardClickColor (Color As Int) As String
          Get or Set the Keyboard Click Color
        • setSalt (Salt As String) As String
          Get or Set the Salt Value to Secure your User Input more
        • setSuccessColor (Color As Int) As String
          Get or Set the Success Color (Description Text Color and Code Circels Color)
        • Success As String
          Set the Color of Labels in the Code Area to the Success Color, to show the user that the input was right
      • Properties:
        • CodeLength As Int
          Get or Set the Code Length (4 or 8)
        • CodeTextColor As Int
          Get or Set the Code Color (Description Text Color and Code Circels Color)
        • DenyColor As Int
          Get or Set the Deny Color (Description Text Color and Code Circels Color)
        • DescriptionColor As Int
          Get or Sets the Description Color (Enter access code)
        • EncryptMethod As String
          Get or Set the Encryption Method Valid: MD5 SHA-1 SHA-224 SHA-256 SHA-384 SHA-512 NONE
        • HeaderColor As Int
          Get or Sets the Header Background Color
        • HeaderPanel As B4XView [read only]
          Get the Header Panel, to load your own Layout
        • KeyboardClickColor As Int
          Get or Set the Keyboard Click Color
        • Salt As String
          Get or Set the Salt Value to Secure your User Input more
        • SuccessColor As Int
          Get or Set the Success Color (Description Text Color and Code Circels Color)
    Change log:
    - V1.1
    • Add Custom Key Click (Fingerprint Key)
    • Add Clear Input to reset the user input
    • Add Explanations on the Subs
    If you like my work, then spend me a coffe or two :)
    [​IMG]
     

    Attached Files:

    Last edited: Apr 29, 2019
  2. itgirl

    itgirl Active Member Licensed User

    Wow looks amazing thanks;)
     
    Alexander Stolte 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