Merge "Update shift state in onSizeChanged()"

This commit is contained in:
Ken Wakasa 2011-08-15 04:12:24 -07:00 committed by Android (Google) Code Review
commit e8bbc54e74
2 changed files with 10 additions and 7 deletions

View file

@ -280,7 +280,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mSymbolsKeyboardId = getKeyboardId(editorInfo, true, false, settingsValues); mSymbolsKeyboardId = getKeyboardId(editorInfo, true, false, settingsValues);
mSymbolsShiftedKeyboardId = getKeyboardId(editorInfo, true, true, settingsValues); mSymbolsShiftedKeyboardId = getKeyboardId(editorInfo, true, true, settingsValues);
setKeyboard(getKeyboard(mSavedKeyboardState.getKeyboardId())); setKeyboard(getKeyboard(mSavedKeyboardState.getKeyboardId()));
updateShiftState();
} catch (RuntimeException e) { } catch (RuntimeException e) {
Log.w(TAG, "loading keyboard failed: " + mMainKeyboardId, e); Log.w(TAG, "loading keyboard failed: " + mMainKeyboardId, e);
LatinImeLogger.logOnException(mMainKeyboardId.toString(), e); LatinImeLogger.logOnException(mMainKeyboardId.toString(), e);
@ -331,6 +330,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
final boolean localeChanged = (oldKeyboard == null) final boolean localeChanged = (oldKeyboard == null)
|| !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale); || !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
mInputMethodService.mHandler.startDisplayLanguageOnSpacebar(localeChanged); mInputMethodService.mHandler.startDisplayLanguageOnSpacebar(localeChanged);
updateShiftState();
} }
private int getSwitchState(KeyboardId id) { private int getSwitchState(KeyboardId id) {
@ -543,11 +543,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
} }
private void setAutomaticTemporaryUpperCase() { private void setAutomaticTemporaryUpperCase() {
LatinKeyboard latinKeyboard = getLatinKeyboard(); if (mKeyboardView == null) return;
if (latinKeyboard != null) { final Keyboard keyboard = mKeyboardView.getKeyboard();
latinKeyboard.setAutomaticTemporaryUpperCase(); if (keyboard != null) {
mKeyboardView.invalidateAllKeys(); keyboard.setAutomaticTemporaryUpperCase();
} }
mKeyboardView.invalidateAllKeys();
} }
/** /**
@ -559,7 +560,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
Log.d(TAG, "updateShiftState:" Log.d(TAG, "updateShiftState:"
+ " autoCaps=" + mInputMethodService.getCurrentAutoCapsState() + " autoCaps=" + mInputMethodService.getCurrentAutoCapsState()
+ " keyboard=" + getLatinKeyboard().getKeyboardShiftState() + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ " shiftKeyState=" + shiftKeyState); + " shiftKeyState=" + shiftKeyState
+ " isAlphabetMode=" + isAlphabetMode()
+ " isShiftLocked=" + isShiftLocked());
if (isAlphabetMode()) { if (isAlphabetMode()) {
if (!isShiftLocked() && !shiftKeyState.isIgnoring()) { if (!isShiftLocked() && !shiftKeyState.isIgnoring()) {
if (shiftKeyState.isReleasing() && mInputMethodService.getCurrentAutoCapsState()) { if (shiftKeyState.isReleasing() && mInputMethodService.getCurrentAutoCapsState()) {

View file

@ -21,7 +21,7 @@ import android.util.Log;
import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.KeyboardSwitcher;
public class KeyboardShiftState { public class KeyboardShiftState {
private static final String TAG = "KeyboardShiftState"; private static final String TAG = KeyboardShiftState.class.getSimpleName();
private static final boolean DEBUG = KeyboardSwitcher.DEBUG_STATE; private static final boolean DEBUG = KeyboardSwitcher.DEBUG_STATE;
private static final int NORMAL = 0; private static final int NORMAL = 0;