Skip to content

Repository files navigation

.github/workflows/main.ymlQuality 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" />
AttributeDescription
maxLengthMaximum length of the password for the PasswordInputView
borderColorBorder color of the password input box for the PasswordInputView
pwdColorColor of the password for the PasswordInputView
inputBorderColorBorder color of the password input box after the input for the PasswordInputView
asteriskDisplay of ciphertext as dots, asterisks, or any characters for the PasswordInputView
radiusRadius of the password input box for the PasswordInputView
spacingSpacing between the input box of the password for the PasswordInputView
borderStyleBorder style of the input box for the PasswordInputView
pwdStylePassword style for the PasswordInputView

Set up the listener:

passwordView.setInputListener(newPasswordInputView.InputListener() {
@OverridepublicvoidonInputCompleted(Stringtext) {
// Call back after input is complete
}
});

About

A password (captcha) input box that supports multiple styles.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages