Resolve some InputLogic todo comments.
Change-Id: Ic3d7d11ad90cc09edf62f48aa5362e71d692f7ddmain
parent
5cf457c976
commit
fe716f0f73
|
@ -1386,7 +1386,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdateBatchInput(final InputPointers batchPointers) {
|
public void onUpdateBatchInput(final InputPointers batchPointers) {
|
||||||
mInputLogic.onUpdateBatchInput(mSettings.getCurrent(), batchPointers, mKeyboardSwitcher);
|
mInputLogic.onUpdateBatchInput(batchPointers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1541,7 +1541,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
setSuggestedWords(neutralSuggestions);
|
setSuggestedWords(neutralSuggestions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make this private
|
|
||||||
// Outside LatinIME, only used by the {@link InputTestsBase} test suite.
|
// Outside LatinIME, only used by the {@link InputTestsBase} test suite.
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
void loadKeyboard() {
|
void loadKeyboard() {
|
||||||
|
@ -1772,7 +1771,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: can this be removed somehow without breaking the tests?
|
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
SuggestedWords getSuggestedWordsForTest() {
|
SuggestedWords getSuggestedWordsForTest() {
|
||||||
// You may not use this method for anything else than debug
|
// You may not use this method for anything else than debug
|
||||||
|
|
|
@ -225,9 +225,7 @@ public final class InputLogic {
|
||||||
* @return the complete transaction object
|
* @return the complete transaction object
|
||||||
*/
|
*/
|
||||||
public InputTransaction onTextInput(final SettingsValues settingsValues, final Event event,
|
public InputTransaction onTextInput(final SettingsValues settingsValues, final Event event,
|
||||||
final int keyboardShiftMode,
|
final int keyboardShiftMode, final LatinIME.UIHandler handler) {
|
||||||
// TODO: remove this argument
|
|
||||||
final LatinIME.UIHandler handler) {
|
|
||||||
final String rawText = event.getTextToCommit().toString();
|
final String rawText = event.getTextToCommit().toString();
|
||||||
final InputTransaction inputTransaction = new InputTransaction(settingsValues, event,
|
final InputTransaction inputTransaction = new InputTransaction(settingsValues, event,
|
||||||
SystemClock.uptimeMillis(), mSpaceState,
|
SystemClock.uptimeMillis(), mSpaceState,
|
||||||
|
@ -266,7 +264,6 @@ public final class InputLogic {
|
||||||
// interface
|
// interface
|
||||||
public InputTransaction onPickSuggestionManually(final SettingsValues settingsValues,
|
public InputTransaction onPickSuggestionManually(final SettingsValues settingsValues,
|
||||||
final SuggestedWordInfo suggestionInfo, final int keyboardShiftState,
|
final SuggestedWordInfo suggestionInfo, final int keyboardShiftState,
|
||||||
// TODO: remove these arguments
|
|
||||||
final int currentKeyboardScriptId, final LatinIME.UIHandler handler) {
|
final int currentKeyboardScriptId, final LatinIME.UIHandler handler) {
|
||||||
final SuggestedWords suggestedWords = mSuggestedWords;
|
final SuggestedWords suggestedWords = mSuggestedWords;
|
||||||
final String suggestion = suggestionInfo.mWord;
|
final String suggestion = suggestionInfo.mWord;
|
||||||
|
@ -422,7 +419,6 @@ public final class InputLogic {
|
||||||
*/
|
*/
|
||||||
public InputTransaction onCodeInput(final SettingsValues settingsValues,
|
public InputTransaction onCodeInput(final SettingsValues settingsValues,
|
||||||
@Nonnull final Event event, final int keyboardShiftMode,
|
@Nonnull final Event event, final int keyboardShiftMode,
|
||||||
// TODO: remove these arguments
|
|
||||||
final int currentKeyboardScriptId, final LatinIME.UIHandler handler) {
|
final int currentKeyboardScriptId, final LatinIME.UIHandler handler) {
|
||||||
final Event processedEvent = mWordComposer.processEvent(event);
|
final Event processedEvent = mWordComposer.processEvent(event);
|
||||||
final InputTransaction inputTransaction = new InputTransaction(settingsValues,
|
final InputTransaction inputTransaction = new InputTransaction(settingsValues,
|
||||||
|
@ -469,7 +465,6 @@ public final class InputLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartBatchInput(final SettingsValues settingsValues,
|
public void onStartBatchInput(final SettingsValues settingsValues,
|
||||||
// TODO: remove these arguments
|
|
||||||
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler) {
|
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler) {
|
||||||
mInputLogicHandler.onStartBatchInput();
|
mInputLogicHandler.onStartBatchInput();
|
||||||
handler.showGesturePreviewAndSuggestionStrip(
|
handler.showGesturePreviewAndSuggestionStrip(
|
||||||
|
@ -533,10 +528,7 @@ public final class InputLogic {
|
||||||
* earlier sequence number.
|
* earlier sequence number.
|
||||||
*/
|
*/
|
||||||
private int mAutoCommitSequenceNumber = 1;
|
private int mAutoCommitSequenceNumber = 1;
|
||||||
public void onUpdateBatchInput(final SettingsValues settingsValues,
|
public void onUpdateBatchInput(final InputPointers batchPointers) {
|
||||||
final InputPointers batchPointers,
|
|
||||||
// TODO: remove these arguments
|
|
||||||
final KeyboardSwitcher keyboardSwitcher) {
|
|
||||||
mInputLogicHandler.onUpdateBatchInput(batchPointers, mAutoCommitSequenceNumber);
|
mInputLogicHandler.onUpdateBatchInput(batchPointers, mAutoCommitSequenceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +537,6 @@ public final class InputLogic {
|
||||||
++mAutoCommitSequenceNumber;
|
++mAutoCommitSequenceNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove this argument
|
|
||||||
public void onCancelBatchInput(final LatinIME.UIHandler handler) {
|
public void onCancelBatchInput(final LatinIME.UIHandler handler) {
|
||||||
mInputLogicHandler.onCancelBatchInput();
|
mInputLogicHandler.onCancelBatchInput();
|
||||||
handler.showGesturePreviewAndSuggestionStrip(
|
handler.showGesturePreviewAndSuggestionStrip(
|
||||||
|
@ -621,7 +612,6 @@ public final class InputLogic {
|
||||||
* @param inputTransaction The transaction in progress.
|
* @param inputTransaction The transaction in progress.
|
||||||
*/
|
*/
|
||||||
private void handleFunctionalEvent(final Event event, final InputTransaction inputTransaction,
|
private void handleFunctionalEvent(final Event event, final InputTransaction inputTransaction,
|
||||||
// TODO: remove these arguments
|
|
||||||
final int currentKeyboardScriptId, final LatinIME.UIHandler handler) {
|
final int currentKeyboardScriptId, final LatinIME.UIHandler handler) {
|
||||||
switch (event.mKeyCode) {
|
switch (event.mKeyCode) {
|
||||||
case Constants.CODE_DELETE:
|
case Constants.CODE_DELETE:
|
||||||
|
@ -673,7 +663,6 @@ public final class InputLogic {
|
||||||
// handled in {@link KeyboardState#onEvent(Event,int)}.
|
// handled in {@link KeyboardState#onEvent(Event,int)}.
|
||||||
break;
|
break;
|
||||||
case Constants.CODE_SHIFT_ENTER:
|
case Constants.CODE_SHIFT_ENTER:
|
||||||
// TODO: remove this object
|
|
||||||
final Event tmpEvent = Event.createSoftwareKeypressEvent(Constants.CODE_ENTER,
|
final Event tmpEvent = Event.createSoftwareKeypressEvent(Constants.CODE_ENTER,
|
||||||
event.mKeyCode, event.mX, event.mY, event.isKeyRepeat());
|
event.mKeyCode, event.mX, event.mY, event.isKeyRepeat());
|
||||||
handleNonSpecialCharacterEvent(tmpEvent, inputTransaction, handler);
|
handleNonSpecialCharacterEvent(tmpEvent, inputTransaction, handler);
|
||||||
|
@ -697,7 +686,6 @@ public final class InputLogic {
|
||||||
*/
|
*/
|
||||||
private void handleNonFunctionalEvent(final Event event,
|
private void handleNonFunctionalEvent(final Event event,
|
||||||
final InputTransaction inputTransaction,
|
final InputTransaction inputTransaction,
|
||||||
// TODO: remove this argument
|
|
||||||
final LatinIME.UIHandler handler) {
|
final LatinIME.UIHandler handler) {
|
||||||
inputTransaction.setDidAffectContents();
|
inputTransaction.setDidAffectContents();
|
||||||
switch (event.mCodePoint) {
|
switch (event.mCodePoint) {
|
||||||
|
@ -743,7 +731,6 @@ public final class InputLogic {
|
||||||
*/
|
*/
|
||||||
private void handleNonSpecialCharacterEvent(final Event event,
|
private void handleNonSpecialCharacterEvent(final Event event,
|
||||||
final InputTransaction inputTransaction,
|
final InputTransaction inputTransaction,
|
||||||
// TODO: remove this argument
|
|
||||||
final LatinIME.UIHandler handler) {
|
final LatinIME.UIHandler handler) {
|
||||||
final int codePoint = event.mCodePoint;
|
final int codePoint = event.mCodePoint;
|
||||||
mSpaceState = SpaceState.NONE;
|
mSpaceState = SpaceState.NONE;
|
||||||
|
@ -849,7 +836,6 @@ public final class InputLogic {
|
||||||
* @param inputTransaction The transaction in progress.
|
* @param inputTransaction The transaction in progress.
|
||||||
*/
|
*/
|
||||||
private void handleSeparatorEvent(final Event event, final InputTransaction inputTransaction,
|
private void handleSeparatorEvent(final Event event, final InputTransaction inputTransaction,
|
||||||
// TODO: remove this argument
|
|
||||||
final LatinIME.UIHandler handler) {
|
final LatinIME.UIHandler handler) {
|
||||||
final int codePoint = event.mCodePoint;
|
final int codePoint = event.mCodePoint;
|
||||||
final SettingsValues settingsValues = inputTransaction.mSettingsValues;
|
final SettingsValues settingsValues = inputTransaction.mSettingsValues;
|
||||||
|
@ -957,7 +943,6 @@ public final class InputLogic {
|
||||||
* @param inputTransaction The transaction in progress.
|
* @param inputTransaction The transaction in progress.
|
||||||
*/
|
*/
|
||||||
private void handleBackspaceEvent(final Event event, final InputTransaction inputTransaction,
|
private void handleBackspaceEvent(final Event event, final InputTransaction inputTransaction,
|
||||||
// TODO: remove this argument, put it into settingsValues
|
|
||||||
final int currentKeyboardScriptId) {
|
final int currentKeyboardScriptId) {
|
||||||
mSpaceState = SpaceState.NONE;
|
mSpaceState = SpaceState.NONE;
|
||||||
mDeleteCount++;
|
mDeleteCount++;
|
||||||
|
@ -1161,7 +1146,6 @@ public final class InputLogic {
|
||||||
settingsValues.mSpacingAndPunctuations,
|
settingsValues.mSpacingAndPunctuations,
|
||||||
currentKeyboardScriptId);
|
currentKeyboardScriptId);
|
||||||
if (range == null) {
|
if (range == null) {
|
||||||
// TODO(zivkovic): Check for bad connection before getting this far.
|
|
||||||
// Happens if we don't have an input connection at all.
|
// Happens if we don't have an input connection at all.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1445,7 +1429,6 @@ public final class InputLogic {
|
||||||
* to a cursor move, for example). In ICS, there is a platform bug that we need to work
|
* to a cursor move, for example). In ICS, there is a platform bug that we need to work
|
||||||
* around only when we come here at input start time.
|
* around only when we come here at input start time.
|
||||||
*/
|
*/
|
||||||
// TODO: make this private.
|
|
||||||
public void restartSuggestionsOnWordTouchedByCursor(final SettingsValues settingsValues,
|
public void restartSuggestionsOnWordTouchedByCursor(final SettingsValues settingsValues,
|
||||||
final boolean forStartInput,
|
final boolean forStartInput,
|
||||||
// TODO: remove this argument, put it into settingsValues
|
// TODO: remove this argument, put it into settingsValues
|
||||||
|
@ -1725,7 +1708,6 @@ public final class InputLogic {
|
||||||
* @param nthPreviousWord reverse index of the word to get (1-indexed)
|
* @param nthPreviousWord reverse index of the word to get (1-indexed)
|
||||||
* @return the information of previous words
|
* @return the information of previous words
|
||||||
*/
|
*/
|
||||||
// TODO: Make this private
|
|
||||||
public NgramContext getNgramContextFromNthPreviousWordForSuggestion(
|
public NgramContext getNgramContextFromNthPreviousWordForSuggestion(
|
||||||
final SpacingAndPunctuations spacingAndPunctuations, final int nthPreviousWord) {
|
final SpacingAndPunctuations spacingAndPunctuations, final int nthPreviousWord) {
|
||||||
if (spacingAndPunctuations.mCurrentLanguageHasSpaces) {
|
if (spacingAndPunctuations.mCurrentLanguageHasSpaces) {
|
||||||
|
@ -1955,9 +1937,7 @@ public final class InputLogic {
|
||||||
* @param suggestedWords suggestedWords to use.
|
* @param suggestedWords suggestedWords to use.
|
||||||
*/
|
*/
|
||||||
public void onUpdateTailBatchInputCompleted(final SettingsValues settingsValues,
|
public void onUpdateTailBatchInputCompleted(final SettingsValues settingsValues,
|
||||||
final SuggestedWords suggestedWords,
|
final SuggestedWords suggestedWords, final KeyboardSwitcher keyboardSwitcher) {
|
||||||
// TODO: remove this argument
|
|
||||||
final KeyboardSwitcher keyboardSwitcher) {
|
|
||||||
final String batchInputText = suggestedWords.isEmpty() ? null : suggestedWords.getWord(0);
|
final String batchInputText = suggestedWords.isEmpty() ? null : suggestedWords.getWord(0);
|
||||||
if (TextUtils.isEmpty(batchInputText)) {
|
if (TextUtils.isEmpty(batchInputText)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1990,7 +1970,6 @@ public final class InputLogic {
|
||||||
* @param settingsValues the current values of the settings.
|
* @param settingsValues the current values of the settings.
|
||||||
* @param separatorString the separator that's causing the commit, or NOT_A_SEPARATOR if none.
|
* @param separatorString the separator that's causing the commit, or NOT_A_SEPARATOR if none.
|
||||||
*/
|
*/
|
||||||
// TODO: Make this private
|
|
||||||
public void commitTyped(final SettingsValues settingsValues, final String separatorString) {
|
public void commitTyped(final SettingsValues settingsValues, final String separatorString) {
|
||||||
if (!mWordComposer.isComposingWord()) return;
|
if (!mWordComposer.isComposingWord()) return;
|
||||||
final String typedWord = mWordComposer.getTypedWord();
|
final String typedWord = mWordComposer.getTypedWord();
|
||||||
|
@ -2019,9 +1998,7 @@ public final class InputLogic {
|
||||||
* @param separator the separator that's causing the commit to happen.
|
* @param separator the separator that's causing the commit to happen.
|
||||||
*/
|
*/
|
||||||
private void commitCurrentAutoCorrection(final SettingsValues settingsValues,
|
private void commitCurrentAutoCorrection(final SettingsValues settingsValues,
|
||||||
final String separator,
|
final String separator, final LatinIME.UIHandler handler) {
|
||||||
// TODO: Remove this argument.
|
|
||||||
final LatinIME.UIHandler handler) {
|
|
||||||
// Complete any pending suggestions query first
|
// Complete any pending suggestions query first
|
||||||
if (handler.hasPendingUpdateSuggestions()) {
|
if (handler.hasPendingUpdateSuggestions()) {
|
||||||
handler.cancelUpdateSuggestionStrip();
|
handler.cancelUpdateSuggestionStrip();
|
||||||
|
@ -2110,11 +2087,8 @@ public final class InputLogic {
|
||||||
* @param remainingTries How many times we may try again before giving up.
|
* @param remainingTries How many times we may try again before giving up.
|
||||||
* @return whether true if the caches were successfully reset, false otherwise.
|
* @return whether true if the caches were successfully reset, false otherwise.
|
||||||
*/
|
*/
|
||||||
// TODO: make this private
|
|
||||||
public boolean retryResetCachesAndReturnSuccess(final boolean tryResumeSuggestions,
|
public boolean retryResetCachesAndReturnSuccess(final boolean tryResumeSuggestions,
|
||||||
final int remainingTries,
|
final int remainingTries, final LatinIME.UIHandler handler) {
|
||||||
// TODO: remove these arguments
|
|
||||||
final LatinIME.UIHandler handler) {
|
|
||||||
final boolean shouldFinishComposition = mConnection.hasSelection()
|
final boolean shouldFinishComposition = mConnection.hasSelection()
|
||||||
|| !mConnection.isCursorPositionKnown();
|
|| !mConnection.isCursorPositionKnown();
|
||||||
if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(
|
if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(
|
||||||
|
|
Loading…
Reference in New Issue