Code Monkey home page Code Monkey logo

passwordinputview's Introduction

.github/workflows/main.yml Quality Gate Status

PasswordInputView

A HMOS library of custom password (verification code) input box that supports multiple styles.

Source

Inspired by yu1tiao/PasswordInputView

Features

  1. This library can display plaintext or ciphertext, ciphertext supports displaying dots, asterisks, or any characters.
  2. The user can set the color of the border of the input box and password.
  3. The color of the input box changes after providing input.
  4. The user can set the password style as asterisk, plaintext and circle.
  5. The user can set the border style line and box.
  6. The user can set the maximum length of the password.
  7. You can set the interval and rounded corners between the password boxes.
  8. You can configure the radius for the input boxes.

Dependency

  1. For using passwordinputview module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/support.har.
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
    testImplementation 'junit:junit:4.13.1'
    implementation project(path: ':passwordinputview')
    ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200'
}
  1. For using passwordinputview in separate application using har file, add the har file in the entry/libs folder and add the dependencies in entry/build.gradle file.
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.har'])
    testImplementation 'junit:junit:4.13'
}
  1. For using passwordinputview from a remote repository in separate application, add the below dependencies in entry/build.gradle file.
dependencies {
    implementation 'dev.applibgroup:passwordinputview:1.0.0'
    testImplementation 'junit:junit:4.13'
}

Usage

Include following code in your layout:

    <com.matthew.passwordinput.lib.PasswordInputView
         ohos:id="$+id:passwordView"
         ohos:width="match_parent"
         ohos:height="50vp"
         ohos:top_margin="10vp"
         ohos:text_input_type="pattern_number"
         ohos:padding="1vp"
         ohos:text="12"
         ohos:text_size="32fp"
         app:pwv_borderColor="$color:colorPrimary"
         app:pwv_haveInputBorderColor="$color:colorAccent"
         app:pwv_pwdColor="$color:colorAccent"
         app:pwv_pwdStyle="plaintext"
         app:pwv_asterisk="\@"
         app:pwv_radius="10vp"
         app:pwv_borderStyle="line"
         app:pwv_maxLength="4"
         app:pwv_spacing="12vp" />
Attribute Description
maxLength Maximum length of the password for the PasswordInputView
borderColor Border color of the password input box for the PasswordInputView
pwdColor Color of the password for the PasswordInputView
inputBorderColor Border color of the password input box after the input for the PasswordInputView
asterisk Display of ciphertext as dots, asterisks, or any characters for the PasswordInputView
radius Radius of the password input box for the PasswordInputView
spacing Spacing between the input box of the password for the PasswordInputView
borderStyle Border style of the input box for the PasswordInputView
pwdStyle Password style for the PasswordInputView

Set up the listener:

      passwordView.setInputListener(new PasswordInputView.InputListener() {
          @Override
          public void onInputCompleted(String text) {
              // Call back after input is complete
          }
      });

passwordinputview's People

Contributors

arpithakori avatar gleelakrishna avatar

Watchers

Sharath KS avatar

Forkers

arpithakori

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.