Skip to content

jbc25/NewPasswordView

Repository files navigation

NewPasswordView

With this small library you will be able to include the common used "new password" view in your app very easily. Use it directly on your layout or make it easier using it NewPasswordDialog!

There is also a sample showing how it works

Features

  • Passwords check: minimum length and match showing errors if proceed
  • Password encryption
  • English and spanish translation
  • Soft keyboard IME options friendly
  • Configurable: minimum lenght and "Check" button visibility

Getting started

To use it, just include in your layout:

<com.triskelapps.newpasswordview.NewPasswordView
        android:id="@+id/view_new_pass"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

Take the reference, or create it directly in java:

viewNewPassword = (NewPasswordView) findViewById(R.id.view_new_pass);
or
NewPasswordView viewNewPassword = new NewPasswordView(context);

Then set the callback:

viewNewPassword.setOnPasswordCheckListener(new NewPasswordView.OnPasswordCheckListener() {

    @Override
    public void onPasswordCorrect(String password) {
                
    }

    @Override
    public void onPasswordError(String reason) {

    }
});

view

Optionally, some configurations:

viewNewPassword.digestPassword("SHA-1");
viewNewPassword.setMinimumLength(4);

Also you can handle Check action by yourself:

viewNewPassword.setButtonCheckVisible(false);
...
viewNewPassword.performButtonCheckClick();

DIALOG

To simplify even more this functionality, use a Dialog!:

NewPasswordDialog dialog = NewPasswordDialog.newInstance();
        dialog.configure(getString(R.string.enter_new_password), new NewPasswordDialog.NewPasswordDialogListener() {
            @Override
            public void onAccept(String text) {

                // User clicked dialog Ok and password is correct, so do what you want with it! 
            }
        });

        dialog.show(getSupportFragmentManager(), null);

view

Want to test it by yourself? Install the APK

Enjoy!

About

This library makes very easy to include the common "new password" view in yout app.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages