Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maksim88/PasswordEditText

A custom EditText with a switchable icon which shows or hides the password
https://github.com/maksim88/PasswordEditText

android android-library material password

Last synced: about 6 hours ago
JSON representation

A custom EditText with a switchable icon which shows or hides the password

Awesome Lists containing this project

README

        

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Password%20EditText-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/3048)
[ ![Download](https://api.bintray.com/packages/maksim88/PasswordEditText/PasswordEditText/images/download.svg) ](https://bintray.com/maksim88/PasswordEditText/PasswordEditText/_latestVersion)
[![](https://jitpack.io/v/maksim88/PasswordEditText.svg)](https://jitpack.io/#maksim88/PasswordEditText)

Deprecated
===========
This library is deprecated now as there is an official way to use the password toggle with the `TextInputLayout` (inside the support library starting with version `24.2.0`).
```

```

You can also wrap `PasswordEditText` inside a `TextInputLayout` to get a material design moving label on top:

```xml


```
Note: be sure to include the design library to use `TextInputLayout`. (for more details see `sample`)

You can also use `TextInputLayout` to achieve an even prettier `setError()` dialog using `setErrorEnabled(true)` on the outer `TextInputLayout`
and then calling `setError()` on it. This underlines the text and shows an error message underneath the text.

Customize
--------

You can add your own custom icons which are shown on the right side of the `EditText`.

Do this by first adding the custom namespace to your root layout, e.g.:
```xml

```

After that you can add the icons with the attributes `app:pet_iconShow` and `app:pet_iconHide`:

```xml

```

You can also set toggle the monospace Font inside the `PasswordEditTexts` with `app:pet_nonMonospaceFont`:

```xml

```

Another customization is to just toggle the visibility of the password when the icon is hovered with `app:pet_hoverShowsPw`:

```xml

```

If you do not like the alpha, that is set to all the icons, you can disable it using `app:pet_disableIconAlpha`

NOTE: alpha values are taken from the material design guidelines (https://www.google.com/design/spec/components/text-fields.html#text-fields-password-input)

```xml

```

For a working example of the different customizations check out the `activity_main.xml` inside the `sample` project.

Download
--------

The library is available from `jcenter()`, so all you need to do is include it in your apps `build.gradle`:

```groovy
dependencies {
compile 'com.maksim88:PasswordEditText:v0.9'
}
```

Alternatively you can use `jitpack.io`:
More info here: https://jitpack.io/#maksim88/PasswordEditText

Questions?
--------
If you have any questions feel free to open a github issue with a 'question' label

License
--------
Licensed under the MIT license. See [LICENSE](LICENSE.md).