Simple PIN lock implementation for Android.
Under Construction...
Create new activity overriding SimpleRegisterPinLockActivity
.
Function onPinRegistered()
is called if PIN is correctly entered. You must implement a functionality of saving the PIN.
class MyRegisterPinLockActivity : SimpleRegisterPinLockActivity() {
override fun onPinRegistered(pin: String) {
// Save new PIN into SharedPreferenece or other...
}
}
Create new activity overriding SimpleConfirmPinLockActivity
.
Function isPinCorrect()
is called when user enters PIN. You must implement a functionality of checking whether the PIN is correct or not.
class MyConfirmPinLockActivity : SimpleConfirmPinLockActivity() {
override fun isPinCorrect(pin: String): Boolean {
// Check whether PIN is corrent or not...
}
}
if you want to handle results, use startActivityForResult()
, override onActivityResult()
on your activity and receive these result codes.
SimplePinLockActivity.CANCELED
: PIN input has canceled.SimplePinLockActivity.PIN_REGISTERED
PIN has correctly registeredSimplePinLockActivity.PIN_CONFIRMED
: PIN has confirmed.
MIT License