GithubHelp home page GithubHelp logo

sathiamour / passwordedittext Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maksim88/passwordedittext

0.0 2.0 0.0 6.69 MB

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

License: MIT License

Java 100.00%

passwordedittext's Introduction

Android Arsenal

Password EditText

A simple extension to the standard Android EditText which shows an icon on the right side of the field and lets the user toggle the visibility of the password he puts in.

How does it look like?

alt tag

Usage

For a complete sample you can check out the sample project provided within.

In short: Just include the PasswordEditText instead of the standard EditText and you are good to go.

<com.maksim88.passwordedittext.PasswordEditText
            android:id="@+id/input_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:hint="Password" />

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

<android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.maksim88.passwordedittext.PasswordEditText
            android:id="@+id/input_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:hint="Password" />
    </android.support.design.widget.TextInputLayout>

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

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.:

<LinearLayout
    [...]
    xmlns:app="http://schemas.android.com/apk/res-auto"
    [...]>
</Linearlayout>

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

<com.maksim88.passwordedittext.PasswordEditText
    [...]
    app:pet_iconShow="@drawable/..."
    app:pet_iconHide="@drawable/..."
    [...]
/>

For a working example check out the activity_main.xml inside the sample project.

Download

Just include jitpack.io inside of your root project build.gradle:

allprojects {
		repositories {
			...
			maven { url "https://jitpack.io" }
		}
	}

After that you can easily include the library in your app build.gradle:

dependencies {
	        compile 'com.github.maksim88:PasswordEditText:v0.4'
	}

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.

passwordedittext's People

Contributors

maksim88 avatar

Watchers

James Cloos avatar sathiamour avatar

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.