am 3892991b: Merge "[IL124] Remove the KeyboardSwitcher arg to onCodeInput"

* commit '3892991b80b1962454789f7233171620f70fb22b':
  [IL124] Remove the KeyboardSwitcher arg to onCodeInput
main
Jean Chalard 2014-03-06 01:37:47 -08:00 committed by Android Git Automerger
commit 2f8258e3ea
2 changed files with 25 additions and 18 deletions

View File

@ -59,6 +59,7 @@ import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.compat.InputMethodServiceCompatUtils; import com.android.inputmethod.compat.InputMethodServiceCompatUtils;
import com.android.inputmethod.dictionarypack.DictionaryPackConstants; import com.android.inputmethod.dictionarypack.DictionaryPackConstants;
import com.android.inputmethod.event.InputTransaction;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener; import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.keyboard.KeyboardId;
@ -1265,8 +1266,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mSubtypeSwitcher.switchToShortcutIME(this); mSubtypeSwitcher.switchToShortcutIME(this);
// Still call the *#onCodeInput methods for readability. // Still call the *#onCodeInput methods for readability.
} }
mInputLogic.onCodeInput(codeToSend, keyX, keyY, mSettings.getCurrent(), mHandler, final InputTransaction completeInputTransaction =
mKeyboardSwitcher); mInputLogic.onCodeInput(mSettings.getCurrent(), codeToSend, keyX, keyY,
mKeyboardSwitcher.getKeyboardShiftMode(), mHandler);
switch (completeInputTransaction.getRequiredShiftUpdate()) {
case InputTransaction.SHIFT_UPDATE_LATER:
mHandler.postUpdateShiftState();
break;
case InputTransaction.SHIFT_UPDATE_NOW:
mKeyboardSwitcher.updateShiftState();
break;
default: // SHIFT_NO_UPDATE
}
mKeyboardSwitcher.onCodeInput(codePoint); mKeyboardSwitcher.onCodeInput(codePoint);
} }

View File

@ -205,9 +205,9 @@ public final class InputLogic {
LatinImeLogger.logOnManualSuggestion("", suggestion, index, suggestedWords); LatinImeLogger.logOnManualSuggestion("", suggestion, index, suggestedWords);
// Rely on onCodeInput to do the complicated swapping/stripping logic consistently. // Rely on onCodeInput to do the complicated swapping/stripping logic consistently.
final int primaryCode = suggestion.charAt(0); final int primaryCode = suggestion.charAt(0);
onCodeInput(primaryCode, onCodeInput(settingsValues, primaryCode,
Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE,
settingsValues, handler, keyboardSwitcher); keyboardSwitcher.getKeyboardShiftMode(), handler);
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, ResearchLogger.latinIME_punctuationSuggestion(index, suggestion,
false /* isBatchMode */, suggestedWords.mIsPrediction); false /* isBatchMode */, suggestedWords.mIsPrediction);
@ -353,17 +353,21 @@ public final class InputLogic {
* Typically, this is called whenever a key is pressed on the software keyboard. This is not * Typically, this is called whenever a key is pressed on the software keyboard. This is not
* the entry point for gesture input; see the onBatchInput* family of functions for this. * the entry point for gesture input; see the onBatchInput* family of functions for this.
* *
* @param settingsValues the current settings values.
* @param code the code to handle. It may be a code point, or an internal key code. * @param code the code to handle. It may be a code point, or an internal key code.
* @param x the x-coordinate where the user pressed the key, or NOT_A_COORDINATE. * @param x the x-coordinate where the user pressed the key, or NOT_A_COORDINATE.
* @param y the y-coordinate where the user pressed the key, or NOT_A_COORDINATE. * @param y the y-coordinate where the user pressed the key, or NOT_A_COORDINATE.
* @param keyboardShiftMode the current shift mode of the keyboard, as returned by
* {@link com.android.inputmethod.keyboard.KeyboardSwitcher#getKeyboardShiftMode()}
* @return the complete transaction object
*/ */
public void onCodeInput(final int code, final int x, final int y, public InputTransaction onCodeInput(final SettingsValues settingsValues, final int code,
final SettingsValues settingsValues, final int x, final int y, final int keyboardShiftMode,
// TODO: remove these two arguments // TODO: remove this argument
final LatinIME.UIHandler handler, final KeyboardSwitcher keyboardSwitcher) { final LatinIME.UIHandler handler) {
final InputTransaction inputTransaction = new InputTransaction(settingsValues, code, x, y, final InputTransaction inputTransaction = new InputTransaction(settingsValues, code, x, y,
SystemClock.uptimeMillis(), mSpaceState, SystemClock.uptimeMillis(), mSpaceState,
getActualCapsMode(settingsValues, keyboardSwitcher.getKeyboardShiftMode())); getActualCapsMode(settingsValues, keyboardShiftMode));
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onCodeInput(inputTransaction.mKeyCode, ResearchLogger.latinIME_onCodeInput(inputTransaction.mKeyCode,
inputTransaction.mX, inputTransaction.mY); inputTransaction.mX, inputTransaction.mY);
@ -473,15 +477,7 @@ public final class InputLogic {
mEnteredText = null; mEnteredText = null;
} }
mConnection.endBatchEdit(); mConnection.endBatchEdit();
switch (inputTransaction.getRequiredShiftUpdate()) { return inputTransaction;
case InputTransaction.SHIFT_UPDATE_LATER:
mLatinIME.mHandler.postUpdateShiftState();
break;
case InputTransaction.SHIFT_UPDATE_NOW:
keyboardSwitcher.updateShiftState();
break;
default: // SHIFT_NO_UPDATE
}
} }
public void onStartBatchInput(final SettingsValues settingsValues, public void onStartBatchInput(final SettingsValues settingsValues,