A very lightweight library which serves the purpose of entering a 6 digit pix like OTP from an SMS. Uses latest Material IO and theming is picked up from whatever is set in the app.
:sixdigitpinview
Not really got around uploading to maven :D
Include it in the layout as follows:
<com.wonderquill.sixdigitpinview.SixDigitPinView
android:id=@+id/sixDigitPinView
android:layout_width=0dp
android:layout_height=wrap_content/>
val pinView = findViewById<SixDigitPinView>(R.id.sixDigitPinView)
val pin = pinView.getEnteredPin()
I purposely didn’t implement fetching data from the clip board service since sometimes you might want to auto detect the sms and paste it.
pinView.pastePin("123456")
val clipboardManager = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
clipboardManager.primaryClip?.let.{
if(it.itemCount> 0)
pinView.pastePin(it.getItemAt(0).text.toString())
}
You can use your own button and call
pinView.reset()
to reset the entered pin
To Enable the built in reset button, use
app:show_reset_button=true
It is disabled by default.
Feel free to fork it, clone it, edit it!