am 83d81f2e: Fix sliding shift input in caps lock mode

* commit '83d81f2e34b28e56bb0f8505d2315ae53c8f9eef':
  Fix sliding shift input in caps lock mode
main
Tadashi G. Takaoka 2012-01-24 01:02:14 -08:00 committed by Android Git Automerger
commit 9921df9079
2 changed files with 7 additions and 6 deletions

View File

@ -383,12 +383,16 @@ public class KeyboardState {
if (mIsAlphabetMode) { if (mIsAlphabetMode) {
final boolean isShiftLocked = mAlphabetShiftState.isShiftLocked(); final boolean isShiftLocked = mAlphabetShiftState.isShiftLocked();
if (mShiftKeyState.isMomentary()) { if (mShiftKeyState.isMomentary()) {
// After chording input while normal state.
if (mAlphabetShiftState.isShiftLockShifted()) { if (mAlphabetShiftState.isShiftLockShifted()) {
// After chording input while caps lock state.
setShiftLocked(true); setShiftLocked(true);
} else { } else {
// After chording input while normal state.
setShifted(UNSHIFT); setShifted(UNSHIFT);
} }
} else if (mAlphabetShiftState.isShiftLockShifted() && withSliding) {
// In caps lock state, shift has been pressed and slid out to other key.
setShiftLocked(true);
} else if (isShiftLocked && !mAlphabetShiftState.isShiftLockShifted() } else if (isShiftLocked && !mAlphabetShiftState.isShiftLockShifted()
&& (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted()) && (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted())
&& !withSliding) { && !withSliding) {

View File

@ -375,12 +375,9 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Alphabet shift locked -> "?123" key + letter -> alphabet shift locked. // Alphabet shift locked -> "?123" key + letter -> alphabet shift locked.
// Press and slide from shift key, enter alphabet shifted. // Press and slide from shift key, enter alphabet shifted.
pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED); pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
// Enter/release letter key, switch back to shift locked. // Enter/release letter key, switch back to shift locked.
// TODO: This test fails due to bug, though the external behavior is correct. pressAndReleaseKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
// TODO: Replace this with the above line once the bug fixed.
pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
} }
// Sliding input in symbols. // Sliding input in symbols.