GoodPinKeyPad is an android Custume View design to provide a User Interface for users to enter their PIN.
White Style | Dark Sytle |
---|---|
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.Karikari:GoodPinKeyPad:latest-version'
}
- Add the View to your layout
<com.karikari.goodpinkeypad.GoodPinKeyPad
android:id="@+id/key"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
app:keyPadStyle="dark_border" // style availble are "dark, white, white_border and dark_border"
app:backgroundColor="@color/white"
app:textColor="@color/eeirie_black"
app:marginTop="20dp"
app:pinEntry="four"/> // You can set it to five and six default is four
- Add the Code
GoodPinKeyPad keyPad = findViewById(R.id.key);
keyPad.setKeyPadListener(new KeyPadListerner() {
@Override
public void onKeyPadPressed(String value) {
Log.d(TAG, "Pin : "+ value);
}
@Override
public void onKeyBackPressed() {
//implement your code
}
@Override
public void onClear() {
}
});