1
0
Fork 0

fixed virtual Backspace not working in limited text fields

This commit is contained in:
sspanak 2024-05-17 12:06:59 +03:00 committed by Dimo Karaivanov
parent 8e7f1c999c
commit 482cde4d5b

View file

@ -2,6 +2,7 @@ package io.github.sspanak.tt9.ui.main.keys;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import io.github.sspanak.tt9.languages.LanguageKind;
import io.github.sspanak.tt9.util.Characters;
@ -27,7 +28,15 @@ public class SoftBackspaceKey extends SoftKey {
@Override
final protected boolean handleHold() {
return validateTT9Handler() && tt9.onBackspace();
if (validateTT9Handler() && !tt9.onBackspace()) {
// Limited or special numeric field (e.g. formatted money or dates) cannot always return
// the text length, therefore onBackspace() seems them as empty and does nothing. This results
// in fallback to the default hardware key action. Here we simulate the hardware BACKSPACE.
tt9.sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
return true;
}
return false;
}
@Override