IrvingRyan/VerifyCodeView

How to clear the previous Entry?

Closed this issue · 5 comments

Hi, Assume the user makes an error how do i clear the numbers.

@ezechinwa do you have any device information?

you can solve the issue by change and add code following :
@OverRide
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
//define keyboard to number keyboard
MyInputConnection fic = new MyInputConnection(this, false);
outAttrs.actionLabel = null;
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER;
outAttrs.imeOptions = EditorInfo.IME_ACTION_NEXT;
return fic;
}

public class MyInputConnection extends BaseInputConnection{
public MyInputConnection(View targetView, boolean fullEditor) {
super(targetView, fullEditor);
}
@OverRide
public boolean sendKeyEvent(KeyEvent event) {
return super.sendKeyEvent(event);
}

    @Override
    public boolean deleteSurroundingText(int beforeLength, int afterLength) {
        return sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DEL))&&sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_DEL));

// return super.deleteSurroundingText(beforeLength, afterLength);
}
}

@mty19901218 thanks, i totally forget the phone which have physical buttons.

@ezechinwa code changed.see the commit 0384bc9