PassWordInput Android Library

repository·master·Indexed 43 days ago

https://github.com/ldoublem/passwordinput

An Android library for animated custom password input views. Features include PwdInputView for various input styles, PwdGestureView for pattern and gesture-based passwords, and SignUpInputView for managed multi-step sign-up flows with customizable verification sequences and visual styles.

Tokens
1.1K
Snippets
4
Records
4
Agent score
6%

What's inside PassWordInput

  1. Configure PwdInputView for password entry

    master

    Use PwdInputView to implement various password input styles such as circular rings, underlines, or diagonal lines. You can control whether to show shadow passwords (placeholders), set the visual style type, and adjust the corner radius of the background.

    // Configure shadow password visibility
    mPwdInputView.setShadowPasswords(true);
    // mPwdInputView.setShadowPasswords(true, R.mipmap.icon_pwd); // Show icon
    // mPwdInputView.setShadowPasswords(true, "密"); // Show specific character
    
    // Set the visual style
    mPwdInputView.setPwdInputViewType(PwdInputView.ViewType.DEFAULT); // Default circular
    // mPwdInputView.setPwdInputViewType(PwdInputView.ViewType.UNDERLINE); // Underline
    // mPwdInputView.setPwdInputViewType(PwdInputView.ViewType.BIASLINE); // Diagonal line
    
    // Set background corner radius
    mPwdInputView.setRadiusBg(0);
  2. Customize SignUpInputView visual styles

    master

    You can change the colors of the SignUpInputView components using standard Android Color values to match your application's theme.

    mSignUpInputView.setBgPaintColor(Color.BLACK);
    
    mSignUpInputView.setTextPaintColor(Color.WHITE);
    
    mSignUpInputView.setTitlePaintColor(Color.GRAY);
  3. Implement gesture-based password input with PwdGestureView

    master

    Use PwdGestureView to capture pattern/gesture passwords. You can enable path drawing, set an existing password for verification, and use the startWork method with a GetPwd callback to retrieve the user's input pattern.

    mPwdGestureView.setIsDrawLine(true); // Show the drawn path
    mPwdGestureView.setOldPwd("012543"); // Set the original password for comparison
    
    mPwdGestureView.startWork(new PwdGestureView.GetPwd() {
        @Override
        public void onGetPwd(String pwd) {
            // Handle the retrieved gesture password here
        }
    });
  4. Configure the SignUpInputView multi-step flow

    master

    The SignUpInputView provides a managed multi-step sign-up process. You can customize the icons and titles for each step, set the button text, define the verification sequence using setVerifyTypeStep, and listen for step changes via setOnGetStepInfo.

    // Set icons for each step (e.g., User, Email, Password)
    mSignUpInputView.setSetpIcon(R.mipmap.user, R.mipmap.email, R.mipmap.pwd);
    
    // Set titles for each step
    mSignUpInputView.setSetpName("Name", "Email", "PassWord");
    
    // Set the final action button text
    mSignUpInputView.setmButtonText("Sign up");
    
    // Define the verification sequence
    mSignUpInputView.setVerifyTypeStep(SignUpInputView.VerifyType.NULL,
            SignUpInputView.VerifyType.EMAIL,
            SignUpInputView.VerifyType.PASSWORD);
    
    // Listen for step transitions
    mSignUpInputView.setOnGetStepInfo(new SignUpInputView.GetStepAndText() {
        @Override
        public void GetInfo(int step, String stepName, String text) {
            // Handle step changes
        }
    });