Merge "[HW1] Fix some bugs with event handling"
This commit is contained in:
commit
310bb2c76f
3 changed files with 9 additions and 2 deletions
|
@ -225,6 +225,13 @@ public class Event {
|
||||||
null /* suggestedWordInfo */, FLAG_NONE, null);
|
null /* suggestedWordInfo */, FLAG_NONE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns whether this is a function key like backspace, ctrl, settings... as opposed to keys
|
||||||
|
// that result in input like letters or space.
|
||||||
|
public boolean isFunctionalKeyEvent() {
|
||||||
|
// This logic may need to be refined in the future
|
||||||
|
return NOT_A_CODE_POINT == mCodePoint;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns whether this event is for a dead character. @see {@link #FLAG_DEAD}
|
// Returns whether this event is for a dead character. @see {@link #FLAG_DEAD}
|
||||||
public boolean isDead() {
|
public boolean isDead() {
|
||||||
return 0 != (FLAG_DEAD & mFlags);
|
return 0 != (FLAG_DEAD & mFlags);
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class HardwareKeyboardEventDecoder implements HardwareEventDecoder {
|
||||||
}
|
}
|
||||||
// If not Enter, then this is just a regular keypress event for a normal character
|
// If not Enter, then this is just a regular keypress event for a normal character
|
||||||
// that can be committed right away, taking into account the current state.
|
// that can be committed right away, taking into account the current state.
|
||||||
return Event.createHardwareKeypressEvent(keyCode, codePointAndFlags, null /* next */,
|
return Event.createHardwareKeypressEvent(codePointAndFlags, keyCode, null /* next */,
|
||||||
isKeyRepeat);
|
isKeyRepeat);
|
||||||
}
|
}
|
||||||
return Event.createNotHandledEvent();
|
return Event.createNotHandledEvent();
|
||||||
|
|
|
@ -399,7 +399,7 @@ public final class InputLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean didAutoCorrect = false;
|
boolean didAutoCorrect = false;
|
||||||
if (Event.NOT_A_KEY_CODE != event.mKeyCode) {
|
if (event.isFunctionalKeyEvent()) {
|
||||||
// A special key, like delete, shift, emoji, or the settings key.
|
// A special key, like delete, shift, emoji, or the settings key.
|
||||||
switch (event.mKeyCode) {
|
switch (event.mKeyCode) {
|
||||||
case Constants.CODE_DELETE:
|
case Constants.CODE_DELETE:
|
||||||
|
|
Loading…
Reference in a new issue