Remove KeyboardSwicther.toggleCapslock

Change-Id: Id613c06e2df770659095d78d42637aed063d0c70
main
Tadashi G. Takaoka 2012-01-17 18:45:04 +09:00
parent 2a88440419
commit 5731b939c7
6 changed files with 17 additions and 38 deletions

View File

@ -256,13 +256,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
}
}
/**
* Toggle caps lock state triggered by user touch event.
*/
public void toggleCapsLock() {
mState.onToggleCapsLock();
}
/**
* Update keyboard shift state triggered by connected EditText status change.
*/

View File

@ -29,7 +29,7 @@ import com.android.inputmethod.keyboard.Keyboard;
* The input events are {@link #onLoadKeyboard(String, boolean)}, {@link #onSaveKeyboardState()},
* {@link #onPressKey(int)}, {@link #onReleaseKey(int, boolean)},
* {@link #onCodeInput(int, boolean, boolean)}, {@link #onCancelInput(boolean)},
* {@link #onUpdateShiftState(boolean)}, and {@link #onToggleCapsLock()}.
* {@link #onUpdateShiftState(boolean)}.
*
* The actions are {@link SwitchActions}'s methods.
*/
@ -403,6 +403,18 @@ public class KeyboardState {
+ " single=" + isSinglePointer
+ " autoCaps=" + autoCaps + " " + this);
}
if (mIsAlphabetMode && code == Keyboard.CODE_CAPSLOCK) {
if (mKeyboardShiftState.isShiftLocked()) {
setShiftLocked(false);
// Shift key is long pressed or double tapped while caps lock state, we will
// toggle back to normal state. And mark as if shift key is released.
mShiftKeyState.onRelease();
} else {
setShiftLocked(true);
}
}
switch (mSwitchState) {
case SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL:
// Only distinct multi touch devices can be in this state.
@ -471,22 +483,6 @@ public class KeyboardState {
}
}
public void onToggleCapsLock() {
if (DEBUG_EVENT) {
Log.d(TAG, "onToggleCapsLock: " + this);
}
if (mIsAlphabetMode) {
if (mKeyboardShiftState.isShiftLocked()) {
setShiftLocked(false);
// Shift key is long pressed while caps lock state, we will toggle back to normal
// state. And mark as if shift key is released.
mShiftKeyState.onRelease();
} else {
setShiftLocked(true);
}
}
}
private static String shiftModeToString(int shiftMode) {
switch (shiftMode) {
case SwitchActions.UNSHIFT: return "UNSHIFT";

View File

@ -1267,7 +1267,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
onSettingsKeyPressed();
break;
case Keyboard.CODE_CAPSLOCK:
switcher.toggleCapsLock();
// Caps lock code is handled in KeyboardSwitcher.onCodeInput() below.
hapticAndAudioFeedback(primaryCode);
break;
case Keyboard.CODE_SHORTCUT:

View File

@ -342,8 +342,6 @@ public class KeyboardStateNonDistinctTests extends AndroidTestCase
mSwitcher.onPressKey(CODE_SHIFT);
assertAlphabetManualShifted();
// Long press recognized in LatinKeyboardView.KeyTimerHandler.
mSwitcher.toggleCapsLock();
assertAlphabetShiftLocked();
mSwitcher.onCodeInput(CODE_CAPSLOCK);
assertAlphabetShiftLocked();
mSwitcher.onReleaseKey(CODE_SHIFT);
@ -355,8 +353,6 @@ public class KeyboardStateNonDistinctTests extends AndroidTestCase
mSwitcher.onPressKey(CODE_SHIFT);
assertAlphabetManualShifted();
// Long press recognized in LatinKeyboardView.KeyTimerHandler.
mSwitcher.toggleCapsLock();
assertAlphabetNormal();
mSwitcher.onCodeInput(CODE_CAPSLOCK);
assertAlphabetNormal();
mSwitcher.onReleaseKey(CODE_SHIFT);
@ -396,8 +392,6 @@ public class KeyboardStateNonDistinctTests extends AndroidTestCase
assertAlphabetManualShifted();
// Second shift key tap.
// Double tap recognized in LatinKeyboardView.KeyTimerHandler.
mSwitcher.toggleCapsLock();
assertAlphabetShiftLocked();
mSwitcher.onCodeInput(CODE_CAPSLOCK);
assertAlphabetShiftLocked();

View File

@ -16,8 +16,6 @@
package com.android.inputmethod.keyboard.internal;
import com.android.inputmethod.keyboard.Keyboard;
public class KeyboardStateTests extends KeyboardStateNonDistinctTests {
@Override
public boolean hasDistinctMultitouch() {
@ -27,7 +25,7 @@ public class KeyboardStateTests extends KeyboardStateNonDistinctTests {
// Shift key chording input.
public void testShiftChording() {
// Press shift key and hold, enter into choring shift state.
mSwitcher.onPressKey(Keyboard.CODE_SHIFT);
mSwitcher.onPressKey(CODE_SHIFT);
assertAlphabetManualShifted();
// Press/release letter keys.
@ -114,4 +112,6 @@ public class KeyboardStateTests extends KeyboardStateNonDistinctTests {
}
// TODO: Multitouch test
// TODO: n-Keys roll over test
}

View File

@ -121,10 +121,6 @@ public class MockKeyboardSwitcher implements KeyboardState.SwitchActions {
mState.onUpdateShiftState(mAutoCapsMode && mAutoCapsState);
}
public void toggleCapsLock() {
mState.onToggleCapsLock();
}
public void updateShiftState() {
mState.onUpdateShiftState(mAutoCapsMode && mAutoCapsState);
}