Closed rmaming closed 4 years ago
I tried using the onCompletionListener but somehow could not disable the button when the user decided to hit backspace or re-enter new pin
I'm not entirely sure if the issue is related to the Lib? can you perhaps share a bit more details and also some code snippets of what you are trying to achieve?
I want to detect every change in the OTP for example character remove. And I think the item in the pull request could solve my problem: Replace OnOtpCompletionListener with OnOtpTextChangeListener
When could this be available?
Same problem here...
Hey, I solve this problem with TextWatcher, try in your code bro
etOtp.addTextChangedListener(object : TextWatcher { override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { if(count<=6){ btnSubmitOtp.isEnabled = false } } override fun beforeTextChanged(s: CharSequence,start: Int,count: Int,after: Int) {} override fun afterTextChanged(s: Editable) {} })
hope this can solve your problem too.
@rmaming
Hey, I solve this problem with TextWatcher, try in your code bro
etOtp.addTextChangedListener(object : TextWatcher { override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { if(count<=6){ btnSubmitOtp.isEnabled = false } } override fun beforeTextChanged(s: CharSequence,start: Int,count: Int,after: Int) {} override fun afterTextChanged(s: Editable) {} })
hope this can solve your problem too.
@rmaming
Thank you for this bro. I also this on the pull request: https://github.com/mukeshsolanki/android-otpview-pinview/pull/104. I guess this would also solve our problem.
Subject of the issue
I was trying to enable and disable a button when the user completed the 6 digit input.
Steps to reproduce
I have a button that when the user completed the 6 digit pin should be enable but when it is less than the required pin length should be disable. Is there a way i can do this? I am looking for something like a text change listener?
Expected behaviour
Actual behaviour