Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.9 KB

README.md

File metadata and controls

63 lines (45 loc) · 1.9 KB

EditViewPin

API CircleCI Jitpack


EditTextPin for Android

This is a simple library for android where we can take an OTP input from the user. This library will take only number input for now. The lenght is six digits. This library handles both insering and deleting of numbers. You can get the pin using getPin() function.

Gradle

  • Step 1. Add the JitPack repository to your build file
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Step 2. Add the dependency (only for androidx projects)
dependencies {
        implementation 'com.github.hexdecimal16:EditTextPin:Version'
}

Version:Release

Implement

   <com.dhairytripathi.library.EditTextPin
        android:id="@+id/editTextPin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

Java

EditTextPin editTextPin = findViewById(R.id.editTextPin);
String pin = editTextPin.getPin(); //To get the current entered pin

You're able to further customize or set initial values with styled attributes:

  1. Add res-auto to your xml layout if you haven't yet
xmlns:app="http://schemas.android.com/apk/res-auto"
  1. After that the following attributes will become available:
app:underlineColor="" <!-- To change underline color-->
app:textBackground="" <!-- Add a drawable to Edit Text background (For api 23+) -->