added longer initial repeat delay for the on-screen backspace
This commit is contained in:
parent
d95ad32678
commit
1a1c0ec910
2 changed files with 20 additions and 6 deletions
|
|
@ -17,7 +17,6 @@ class SoftKeyHandler implements View.OnTouchListener {
|
||||||
private final TraditionalT9 tt9;
|
private final TraditionalT9 tt9;
|
||||||
private View view = null;
|
private View view = null;
|
||||||
|
|
||||||
private static final int BACKSPACE_DEBOUNCE_TIME = 40;
|
|
||||||
private long lastBackspaceCall = 0;
|
private long lastBackspaceCall = 0;
|
||||||
|
|
||||||
public SoftKeyHandler(TraditionalT9 tt9) {
|
public SoftKeyHandler(TraditionalT9 tt9) {
|
||||||
|
|
@ -104,18 +103,26 @@ class SoftKeyHandler implements View.OnTouchListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean handleBackspaceHold() {
|
private boolean handleBackspaceHold() {
|
||||||
if (System.currentTimeMillis() - lastBackspaceCall < BACKSPACE_DEBOUNCE_TIME) {
|
if (System.currentTimeMillis() - lastBackspaceCall < tt9.settings.getSoftKeyRepeatDelay()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean handled = tt9.onBackspace();
|
boolean handled = tt9.onBackspace();
|
||||||
lastBackspaceCall = System.currentTimeMillis();
|
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
lastBackspaceCall = lastBackspaceCall == 0 ? tt9.settings.getSoftKeyInitialDelay() + now : now;
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean handleBackspaceUp() {
|
||||||
|
lastBackspaceCall = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
int action = event.getAction();
|
int action = event.getAction();
|
||||||
|
|
@ -131,8 +138,12 @@ class SoftKeyHandler implements View.OnTouchListener {
|
||||||
return view.performClick();
|
return view.performClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonId == R.id.main_right && action == MotionEvent.AXIS_PRESSURE) {
|
if (buttonId == R.id.main_right) {
|
||||||
return handleBackspaceHold();
|
if (action == MotionEvent.AXIS_PRESSURE) {
|
||||||
|
return handleBackspaceHold();
|
||||||
|
} else if (action == MotionEvent.ACTION_UP) {
|
||||||
|
return handleBackspaceUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,9 @@ public class SettingsStore {
|
||||||
public int getSuggestionSelectAnimationDuration() { return 66; }
|
public int getSuggestionSelectAnimationDuration() { return 66; }
|
||||||
public int getSuggestionTranslateAnimationDuration() { return 0; }
|
public int getSuggestionTranslateAnimationDuration() { return 0; }
|
||||||
|
|
||||||
|
public int getSoftKeyInitialDelay() { return 250; /* ms */ }
|
||||||
|
public int getSoftKeyRepeatDelay() { return 40; /* ms */ }
|
||||||
|
|
||||||
|
|
||||||
/************* add word, last word *************/
|
/************* add word, last word *************/
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue