Merge "Add more debug message to KeyboardState"

This commit is contained in:
Tadashi G. Takaoka 2012-01-22 20:15:38 -08:00 committed by Android (Google) Code Review
commit b6357bddd5

View file

@ -87,6 +87,16 @@ public class KeyboardState {
public boolean mIsAlphabetMode; public boolean mIsAlphabetMode;
public boolean mIsShiftLocked; public boolean mIsShiftLocked;
public boolean mIsShifted; public boolean mIsShifted;
public String toString() {
if (!mIsValid) return "INVALID";
if (mIsAlphabetMode) {
if (mIsShiftLocked) return "ALPHABET_SHIFT_LOCKED";
return mIsShifted ? "ALPHABET_SHIFTED" : "ALPHABET";
} else {
return mIsShifted ? "SYMBOLS_SHIFTED" : "SYMBOLS";
}
}
} }
public KeyboardState(SwitchActions switchActions) { public KeyboardState(SwitchActions switchActions) {
@ -95,7 +105,7 @@ public class KeyboardState {
public void onLoadKeyboard(String layoutSwitchBackSymbols) { public void onLoadKeyboard(String layoutSwitchBackSymbols) {
if (DEBUG_EVENT) { if (DEBUG_EVENT) {
Log.d(TAG, "onLoadKeyboard"); Log.d(TAG, "onLoadKeyboard: " + this);
} }
mLayoutSwitchBackSymbols = layoutSwitchBackSymbols; mLayoutSwitchBackSymbols = layoutSwitchBackSymbols;
// Reset alphabet shift state. // Reset alphabet shift state.
@ -120,17 +130,14 @@ public class KeyboardState {
} }
state.mIsValid = true; state.mIsValid = true;
if (DEBUG_EVENT) { if (DEBUG_EVENT) {
Log.d(TAG, "onSaveKeyboardState: alphabet=" + state.mIsAlphabetMode Log.d(TAG, "onSaveKeyboardState: saved=" + state + " " + this);
+ " shiftLocked=" + state.mIsShiftLocked + " shift=" + state.mIsShifted);
} }
} }
private void onRestoreKeyboardState() { private void onRestoreKeyboardState() {
final SavedKeyboardState state = mSavedKeyboardState; final SavedKeyboardState state = mSavedKeyboardState;
if (DEBUG_EVENT) { if (DEBUG_EVENT) {
Log.d(TAG, "onRestoreKeyboardState: valid=" + state.mIsValid Log.d(TAG, "onRestoreKeyboardState: saved=" + state + " " + this);
+ " alphabet=" + state.mIsAlphabetMode
+ " shiftLocked=" + state.mIsShiftLocked + " shift=" + state.mIsShifted);
} }
if (!state.mIsValid || state.mIsAlphabetMode) { if (!state.mIsValid || state.mIsAlphabetMode) {
setAlphabetKeyboard(); setAlphabetKeyboard();