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

* commit 'f9516b00ecf25e634e2ebfe8ea35eb09bbcf5ca9':
  [IL132] Remove some calls that let a value escape.
main
Jean Chalard 2014-04-04 13:38:17 +00:00 committed by Android Git Automerger
commit 40f33edaf1
3 changed files with 16 additions and 23 deletions

View File

@ -219,22 +219,15 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
return null; 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 // 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(). // when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
public void resetKeyboardStateToAlphabet() { public void resetKeyboardStateToAlphabet() {
mState.onResetKeyboardStateToAlphabet(); mState.onResetKeyboardStateToAlphabet();
} }
public void onPressKey(final int code, final boolean isSinglePointer) { public void onPressKey(final int code, final boolean isSinglePointer,
mState.onPressKey(code, isSinglePointer, mLatinIME.getCurrentAutoCapsState()); final int currentAutoCapsState) {
mState.onPressKey(code, isSinglePointer, currentAutoCapsState);
} }
public void onReleaseKey(final int code, final boolean withSliding) { 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. * Updates state machine to figure out when to automatically switch back to the previous mode.
*/ */
public void onCodeInput(final int code) { public void onCodeInput(final int code, final int currentAutoCapsState) {
mState.onCodeInput(code, mLatinIME.getCurrentAutoCapsState()); mState.onCodeInput(code, currentAutoCapsState);
} }
public boolean isShowingEmojiPalettes() { public boolean isShowingEmojiPalettes() {

View File

@ -198,7 +198,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
latinIme.mSettings.getCurrent()); latinIme.mSettings.getCurrent());
break; break;
case MSG_UPDATE_SHIFT_STATE: case MSG_UPDATE_SHIFT_STATE:
switcher.updateShiftState(); switcher.requestUpdatingShiftState();
break; break;
case MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP: case MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP:
if (msg.arg1 == ARG1_NOT_GESTURE_INPUT) { 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 // we need to re-evaluate the shift state, but not the whole layout which would be
// disruptive. // disruptive.
// Space state must be updated before calling updateShiftState // Space state must be updated before calling updateShiftState
switcher.updateShiftState(); switcher.requestUpdatingShiftState();
} }
// This will set the punctuation suggestions if next word suggestion is off; // This will set the punctuation suggestions if next word suggestion is off;
// otherwise it will clear the suggestion strip. // 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. // TODO: find a better way to simulate actual execution.
if (isInputViewShown() && if (isInputViewShown() &&
mInputLogic.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd)) { mInputLogic.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd)) {
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.requestUpdatingShiftState();
} }
mSubtypeState.currentSubtypeUsed(); mSubtypeState.currentSubtypeUsed();
@ -1232,7 +1232,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mInputLogic.onCodeInput(mSettings.getCurrent(), event, mInputLogic.onCodeInput(mSettings.getCurrent(), event,
mKeyboardSwitcher.getKeyboardShiftMode(), mHandler); mKeyboardSwitcher.getKeyboardShiftMode(), mHandler);
updateStateAfterInputTransaction(completeInputTransaction); 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 // 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. // TODO: have the keyboard pass the correct key code when we need it.
final Event event = Event.createSoftwareTextEvent(rawText, Event.NOT_A_KEY_CODE); final Event event = Event.createSoftwareTextEvent(rawText, Event.NOT_A_KEY_CODE);
mInputLogic.onTextInput(mSettings.getCurrent(), event, mHandler); mInputLogic.onTextInput(mSettings.getCurrent(), event, mHandler);
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.requestUpdatingShiftState();
mKeyboardSwitcher.onCodeInput(Constants.CODE_OUTPUT_TEXT); mKeyboardSwitcher.onCodeInput(Constants.CODE_OUTPUT_TEXT, getCurrentAutoCapsState());
} }
@Override @Override
@ -1501,7 +1501,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler.postUpdateShiftState(); mHandler.postUpdateShiftState();
break; break;
case InputTransaction.SHIFT_UPDATE_NOW: case InputTransaction.SHIFT_UPDATE_NOW:
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.requestUpdatingShiftState();
break; break;
default: // SHIFT_NO_UPDATE default: // SHIFT_NO_UPDATE
} }
@ -1541,7 +1541,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override @Override
public void onPressKey(final int primaryCode, final int repeatCount, public void onPressKey(final int primaryCode, final int repeatCount,
final boolean isSinglePointer) { final boolean isSinglePointer) {
mKeyboardSwitcher.onPressKey(primaryCode, isSinglePointer); mKeyboardSwitcher.onPressKey(primaryCode, isSinglePointer, getCurrentAutoCapsState());
hapticAndAudioFeedback(primaryCode, repeatCount); 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 // 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, // caps mode yet, but since a gesture is starting, it should go in caps mode,
// unless the user explictly said it should not. // unless the user explictly said it should not.
keyboardSwitcher.updateShiftState(); keyboardSwitcher.requestUpdatingShiftState();
} }
} }
mConnection.endBatchEdit(); mConnection.endBatchEdit();
@ -579,7 +579,7 @@ public final class InputLogic {
promotePhantomSpace(settingsValues); promotePhantomSpace(settingsValues);
mConnection.commitText(commitParts[0], 0); mConnection.commitText(commitParts[0], 0);
mSpaceState = SpaceState.PHANTOM; mSpaceState = SpaceState.PHANTOM;
keyboardSwitcher.updateShiftState(); keyboardSwitcher.requestUpdatingShiftState();
mWordComposer.setCapitalizedModeAndPreviousWordAtStartComposingTime( mWordComposer.setCapitalizedModeAndPreviousWordAtStartComposingTime(
getActualCapsMode(settingsValues, getActualCapsMode(settingsValues,
keyboardSwitcher.getKeyboardShiftMode()), commitParts[0]); keyboardSwitcher.getKeyboardShiftMode()), commitParts[0]);
@ -1819,7 +1819,7 @@ public final class InputLogic {
} }
// Space state must be updated before calling updateShiftState // Space state must be updated before calling updateShiftState
mSpaceState = SpaceState.PHANTOM; mSpaceState = SpaceState.PHANTOM;
keyboardSwitcher.updateShiftState(); keyboardSwitcher.requestUpdatingShiftState();
} }
/** /**