Pinview icon indicating copy to clipboard operation
Pinview copied to clipboard

Delete/BackSpace Key is not working in some keyboards!

Open imidhuntv opened this issue 6 years ago • 5 comments

The problem is that on several keyboards onKey() method is not getting called for key event KEYCODE_DEL on pressing Backspace/Delete. This seems to be a serious bug since user can't type a new pin if he has entered a wrong one.

imidhuntv avatar Nov 05 '17 18:11 imidhuntv

Hi @imidhuntv Yes this is a known issue. Also mentioned in the documentation. Note : This library cannot be assured to work on 3rd party keyboards (especially when the cursor is off). It works as expected on google keyboards. We will be adding a work-around in the future releases.

So this works on all google keyboards and 3rd party keyboards which are built on top of it (like swift). We cannot assure other 3rd party libraries because we are not sure how they are handling events. We are going to fix this soon (we are caught up with work so its delayed a bit )and this issue is open for everyone. Anyone who thinks has a valid solution for this can do a pull request or suggest possible solutions. Sorry for the inconvenience caused. Team GoodieBag.

Vatican-Cameos avatar Nov 07 '17 04:11 Vatican-Cameos

This method can be used to solve this problem. https://blog.csdn.net/yanghuiyu38/article/details/53638601

QianChaoha avatar Dec 27 '18 09:12 QianChaoha

This code update might work: (to PinView.onKey) //Takes it back one tile editTextList.get(currentTag - 1).setEnabled(true); editTextList.get(currentTag - 1).requestFocus();

adamwearsafe avatar May 02 '19 19:05 adamwearsafe

Was there ever any solution created for this? Or good workaround?

joreilly avatar Oct 24 '22 09:10 joreilly

Hi @imidhuntv Yes this is a known issue. Also mentioned in the documentation. Note : This library cannot be assured to work on 3rd party keyboards (especially when the cursor is off). It works as expected on google keyboards. We will be adding a work-around in the future releases.

So this works on all google keyboards and 3rd party keyboards which are built on top of it (like swift). We cannot assure other 3rd party libraries because we are not sure how they are handling events. We are going to fix this soon (we are caught up with work so its delayed a bit )and this issue is open for everyone. Anyone who thinks has a valid solution for this can do a pull request or suggest possible solutions. Sorry for the inconvenience caused. Team GoodieBag.

    pinview.setPinViewEventListener(new Pinview.PinViewEventListener() {
        @Override
        public void onDataEntered(Pinview pinview, boolean fromUser) {

        }

// Can You Add This

        @Override
        public void onDelete(Pinview pinview) {
            // Handle backspace key press
            String currentPin = pinview.getValue();
            if (!TextUtils.isEmpty(currentPin)) {
                // Remove the last character from the PIN
                pinview.setValue(currentPin.substring(0, currentPin.length() - 1));
            }
        }

    });

abdullah-al-shafi avatar Oct 09 '23 12:10 abdullah-al-shafi