Merge "[IL132] Remove some calls that let a value escape."

main
Jean Chalard 2014-04-04 13:33:25 +00:00 committed by Android (Google) Code Review
commit f9516b00ec
3 changed files with 16 additions and 23 deletions

View File

@ -219,22 +219,15 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
return null;
}
/**
* Update keyboard shift state triggered by connected EditText status change.
*/
public void updateShiftState() {
mState.onUpdateShiftState(mLatinIME.getCurrentAutoCapsState(),
mLatinIME.getCurrentRecapitalizeState());
}
// TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
// when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
public void resetKeyboardStateToAlphabet() {
mState.onResetKeyboardStateToAlphabet();
}
public void onPressKey(final int code, final boolean isSinglePointer) {
mState.onPressKey(code, isSinglePointer, mLatinIME.getCurrentAutoCapsState());
public void onPressKey(final int code, final boolean isSinglePointer,
final int currentAutoCapsState) {
mState.onPressKey(code, isSinglePointer, currentAutoCapsState);
}
public void onReleaseKey(final int code, final boolean withSliding) {
@ -338,8 +331,8 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
/**
* Updates state machine to figure out when to automatically switch back to the previous mode.
*/
public void onCodeInput(final int code) {
mState.onCodeInput(code, mLatinIME.getCurrentAutoCapsState());
public void onCodeInput(final int code, final int currentAutoCapsState) {
mState.onCodeInput(code, currentAutoCapsState);
}
public boolean isShowingEmojiPalettes() {

View File

@ -198,7 +198,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
latinIme.mSettings.getCurrent());
break;
case MSG_UPDATE_SHIFT_STATE:
switcher.updateShiftState();
switcher.requestUpdatingShiftState();
break;
case MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP:
if (msg.arg1 == ARG1_NOT_GESTURE_INPUT) {
@ -834,7 +834,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// we need to re-evaluate the shift state, but not the whole layout which would be
// disruptive.
// Space state must be updated before calling updateShiftState
switcher.updateShiftState();
switcher.requestUpdatingShiftState();
}
// This will set the punctuation suggestions if next word suggestion is off;
// otherwise it will clear the suggestion strip.
@ -913,7 +913,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// TODO: find a better way to simulate actual execution.
if (isInputViewShown() &&
mInputLogic.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd)) {
mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.requestUpdatingShiftState();
}
mSubtypeState.currentSubtypeUsed();
@ -1232,7 +1232,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mInputLogic.onCodeInput(mSettings.getCurrent(), event,
mKeyboardSwitcher.getKeyboardShiftMode(), mHandler);
updateStateAfterInputTransaction(completeInputTransaction);
mKeyboardSwitcher.onCodeInput(codePoint);
mKeyboardSwitcher.onCodeInput(codePoint, getCurrentAutoCapsState());
}
// A helper method to split the code point and the key code. Ultimately, they should not be
@ -1257,8 +1257,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// TODO: have the keyboard pass the correct key code when we need it.
final Event event = Event.createSoftwareTextEvent(rawText, Event.NOT_A_KEY_CODE);
mInputLogic.onTextInput(mSettings.getCurrent(), event, mHandler);
mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.onCodeInput(Constants.CODE_OUTPUT_TEXT);
mKeyboardSwitcher.requestUpdatingShiftState();
mKeyboardSwitcher.onCodeInput(Constants.CODE_OUTPUT_TEXT, getCurrentAutoCapsState());
}
@Override
@ -1501,7 +1501,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler.postUpdateShiftState();
break;
case InputTransaction.SHIFT_UPDATE_NOW:
mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.requestUpdatingShiftState();
break;
default: // SHIFT_NO_UPDATE
}
@ -1541,7 +1541,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onPressKey(final int primaryCode, final int repeatCount,
final boolean isSinglePointer) {
mKeyboardSwitcher.onPressKey(primaryCode, isSinglePointer);
mKeyboardSwitcher.onPressKey(primaryCode, isSinglePointer, getCurrentAutoCapsState());
hapticAndAudioFeedback(primaryCode, repeatCount);
}

View File

@ -537,7 +537,7 @@ public final class InputLogic {
// after typing some letters and a period, then gesturing; the keyboard is not in
// caps mode yet, but since a gesture is starting, it should go in caps mode,
// unless the user explictly said it should not.
keyboardSwitcher.updateShiftState();
keyboardSwitcher.requestUpdatingShiftState();
}
}
mConnection.endBatchEdit();
@ -579,7 +579,7 @@ public final class InputLogic {
promotePhantomSpace(settingsValues);
mConnection.commitText(commitParts[0], 0);
mSpaceState = SpaceState.PHANTOM;
keyboardSwitcher.updateShiftState();
keyboardSwitcher.requestUpdatingShiftState();
mWordComposer.setCapitalizedModeAndPreviousWordAtStartComposingTime(
getActualCapsMode(settingsValues,
keyboardSwitcher.getKeyboardShiftMode()), commitParts[0]);
@ -1819,7 +1819,7 @@ public final class InputLogic {
}
// Space state must be updated before calling updateShiftState
mSpaceState = SpaceState.PHANTOM;
keyboardSwitcher.updateShiftState();
keyboardSwitcher.requestUpdatingShiftState();
}
/**