am dc52e7c6: Remove current keyboard id variable

* commit 'dc52e7c646bafb00898c3f2ebec064a5920e58fc':
  Remove current keyboard id variable
main
Tadashi G. Takaoka 2011-12-13 05:48:17 -08:00 committed by Android Git Automerger
commit c635a8c3db
1 changed files with 3 additions and 5 deletions

View File

@ -74,7 +74,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
private KeyboardId mSymbolsKeyboardId; private KeyboardId mSymbolsKeyboardId;
private KeyboardId mSymbolsShiftedKeyboardId; private KeyboardId mSymbolsShiftedKeyboardId;
private KeyboardId mCurrentId;
private final HashMap<KeyboardId, SoftReference<LatinKeyboard>> mKeyboardCache = private final HashMap<KeyboardId, SoftReference<LatinKeyboard>> mKeyboardCache =
new HashMap<KeyboardId, SoftReference<LatinKeyboard>>(); new HashMap<KeyboardId, SoftReference<LatinKeyboard>>();
@ -152,7 +151,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
} }
public void saveKeyboardState() { public void saveKeyboardState() {
if (mCurrentId != null) { if (isKeyboardAvailable()) {
mState.onSaveKeyboardState(); mState.onSaveKeyboardState();
} }
} }
@ -169,7 +168,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
final Keyboard oldKeyboard = mKeyboardView.getKeyboard(); final Keyboard oldKeyboard = mKeyboardView.getKeyboard();
mKeyboardView.setKeyboard(keyboard); mKeyboardView.setKeyboard(keyboard);
mCurrentInputView.setKeyboardGeometry(keyboard.mTopPadding); mCurrentInputView.setKeyboardGeometry(keyboard.mTopPadding);
mCurrentId = keyboard.mId;
updateShiftLockState(keyboard); updateShiftLockState(keyboard);
mKeyboardView.setKeyPreviewPopupEnabled( mKeyboardView.setKeyPreviewPopupEnabled(
SettingsValues.isKeyPreviewPopupEnabled(mPrefs, mResources), SettingsValues.isKeyPreviewPopupEnabled(mPrefs, mResources),
@ -181,12 +179,12 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
} }
private void updateShiftLockState(Keyboard keyboard) { private void updateShiftLockState(Keyboard keyboard) {
if (mCurrentId.equals(mSymbolsShiftedKeyboardId)) { if (keyboard.mId.equals(mSymbolsShiftedKeyboardId)) {
// Symbol keyboard may have an ALT key that has a caps lock style indicator (a.k.a. // Symbol keyboard may have an ALT key that has a caps lock style indicator (a.k.a.
// sticky shift key). To show or dismiss the indicator, we need to call setShiftLocked() // sticky shift key). To show or dismiss the indicator, we need to call setShiftLocked()
// that takes care of the current keyboard having such ALT key or not. // that takes care of the current keyboard having such ALT key or not.
keyboard.setShiftLocked(keyboard.hasShiftLockKey()); keyboard.setShiftLocked(keyboard.hasShiftLockKey());
} else if (mCurrentId.equals(mSymbolsKeyboardId)) { } else if (keyboard.mId.equals(mSymbolsKeyboardId)) {
// Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the // Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the
// indicator, we need to call setShiftLocked(false). // indicator, we need to call setShiftLocked(false).
keyboard.setShiftLocked(false); keyboard.setShiftLocked(false);