am 1284e556: [IL70] Remove unused arguments
* commit '1284e556f4ec998c6f3ea80905d690cbb4c9dc82': [IL70] Remove unused argumentsmain
commit
4b68386775
|
@ -205,7 +205,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
case MSG_RESUME_SUGGESTIONS:
|
case MSG_RESUME_SUGGESTIONS:
|
||||||
latinIme.mInputLogic.restartSuggestionsOnWordTouchedByCursor(
|
latinIme.mInputLogic.restartSuggestionsOnWordTouchedByCursor(
|
||||||
latinIme.mSettings.getCurrent(),
|
latinIme.mSettings.getCurrent(),
|
||||||
false /* includeResumedWordInSuggestions */, latinIme.mKeyboardSwitcher);
|
false /* includeResumedWordInSuggestions */);
|
||||||
break;
|
break;
|
||||||
case MSG_REOPEN_DICTIONARIES:
|
case MSG_REOPEN_DICTIONARIES:
|
||||||
latinIme.initSuggest();
|
latinIme.initSuggest();
|
||||||
|
|
|
@ -300,11 +300,9 @@ public final class WordComposer {
|
||||||
* @param coordinates the x, y coordinates of the key in the CoordinateUtils format
|
* @param coordinates the x, y coordinates of the key in the CoordinateUtils format
|
||||||
* @param previousWord the previous word, to use as context for suggestions. Can be null if
|
* @param previousWord the previous word, to use as context for suggestions. Can be null if
|
||||||
* the context is nil (typically, at start of text).
|
* the context is nil (typically, at start of text).
|
||||||
* @param keyboard the keyboard this is typed on, for coordinate info/proximity.
|
|
||||||
*/
|
*/
|
||||||
// TODO[IL]: the Keyboard argument is now unused. Remove it.
|
|
||||||
public void setComposingWord(final int[] codePoints, final int[] coordinates,
|
public void setComposingWord(final int[] codePoints, final int[] coordinates,
|
||||||
final CharSequence previousWord, final Keyboard keyboard) {
|
final CharSequence previousWord) {
|
||||||
reset();
|
reset();
|
||||||
final int length = codePoints.length;
|
final int length = codePoints.length;
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
|
|
|
@ -703,7 +703,7 @@ public final class InputLogic {
|
||||||
if (settingsValues.mIsInternal) {
|
if (settingsValues.mIsInternal) {
|
||||||
LatinImeLoggerUtils.onAutoCorrectionCancellation();
|
LatinImeLoggerUtils.onAutoCorrectionCancellation();
|
||||||
}
|
}
|
||||||
revertCommit(settingsValues, keyboardSwitcher, handler);
|
revertCommit(settingsValues, handler);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) {
|
if (mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) {
|
||||||
|
@ -799,7 +799,7 @@ public final class InputLogic {
|
||||||
&& !mConnection.isCursorFollowedByWordCharacter(
|
&& !mConnection.isCursorFollowedByWordCharacter(
|
||||||
settingsValues.mSpacingAndPunctuations)) {
|
settingsValues.mSpacingAndPunctuations)) {
|
||||||
restartSuggestionsOnWordTouchedByCursor(settingsValues,
|
restartSuggestionsOnWordTouchedByCursor(settingsValues,
|
||||||
true /* includeResumedWordInSuggestions */, keyboardSwitcher);
|
true /* includeResumedWordInSuggestions */);
|
||||||
}
|
}
|
||||||
// We just removed at least one character. We need to update the auto-caps state.
|
// We just removed at least one character. We need to update the auto-caps state.
|
||||||
keyboardSwitcher.updateShiftState();
|
keyboardSwitcher.updateShiftState();
|
||||||
|
@ -1037,9 +1037,7 @@ public final class InputLogic {
|
||||||
*/
|
*/
|
||||||
// TODO: make this private.
|
// TODO: make this private.
|
||||||
public void restartSuggestionsOnWordTouchedByCursor(final SettingsValues settingsValues,
|
public void restartSuggestionsOnWordTouchedByCursor(final SettingsValues settingsValues,
|
||||||
final boolean includeResumedWordInSuggestions,
|
final boolean includeResumedWordInSuggestions) {
|
||||||
// TODO: Remove this argument.
|
|
||||||
final KeyboardSwitcher keyboardSwitcher) {
|
|
||||||
// HACK: We may want to special-case some apps that exhibit bad behavior in case of
|
// HACK: We may want to special-case some apps that exhibit bad behavior in case of
|
||||||
// recorrection. This is a temporary, stopgap measure that will be removed later.
|
// recorrection. This is a temporary, stopgap measure that will be removed later.
|
||||||
// TODO: remove this.
|
// TODO: remove this.
|
||||||
|
@ -1093,8 +1091,7 @@ public final class InputLogic {
|
||||||
// We want the previous word for suggestion. If we have chars in the word
|
// We want the previous word for suggestion. If we have chars in the word
|
||||||
// before the cursor, then we want the word before that, hence 2; otherwise,
|
// before the cursor, then we want the word before that, hence 2; otherwise,
|
||||||
// we want the word immediately before the cursor, hence 1.
|
// we want the word immediately before the cursor, hence 1.
|
||||||
0 == numberOfCharsInWordBeforeCursor ? 1 : 2),
|
0 == numberOfCharsInWordBeforeCursor ? 1 : 2));
|
||||||
keyboardSwitcher.getKeyboard());
|
|
||||||
mWordComposer.setCursorPositionWithinWord(
|
mWordComposer.setCursorPositionWithinWord(
|
||||||
typedWord.codePointCount(0, numberOfCharsInWordBeforeCursor));
|
typedWord.codePointCount(0, numberOfCharsInWordBeforeCursor));
|
||||||
mConnection.setComposingRegion(expectedCursorPosition - numberOfCharsInWordBeforeCursor,
|
mConnection.setComposingRegion(expectedCursorPosition - numberOfCharsInWordBeforeCursor,
|
||||||
|
@ -1149,8 +1146,8 @@ public final class InputLogic {
|
||||||
* @param settingsValues the current settings values.
|
* @param settingsValues the current settings values.
|
||||||
*/
|
*/
|
||||||
private void revertCommit(final SettingsValues settingsValues,
|
private void revertCommit(final SettingsValues settingsValues,
|
||||||
// TODO: remove these arguments
|
// TODO: remove this argument
|
||||||
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler) {
|
final LatinIME.UIHandler handler) {
|
||||||
final String previousWord = mLastComposedWord.mPrevWord;
|
final String previousWord = mLastComposedWord.mPrevWord;
|
||||||
final CharSequence originallyTypedWord = mLastComposedWord.mTypedWord;
|
final CharSequence originallyTypedWord = mLastComposedWord.mTypedWord;
|
||||||
final CharSequence committedWord = mLastComposedWord.mCommittedWord;
|
final CharSequence committedWord = mLastComposedWord.mCommittedWord;
|
||||||
|
@ -1213,8 +1210,7 @@ public final class InputLogic {
|
||||||
// with the typed word, so we need to resume suggestions right away.
|
// with the typed word, so we need to resume suggestions right away.
|
||||||
final int[] codePoints = StringUtils.toCodePointArray(stringToCommit);
|
final int[] codePoints = StringUtils.toCodePointArray(stringToCommit);
|
||||||
mWordComposer.setComposingWord(codePoints,
|
mWordComposer.setComposingWord(codePoints,
|
||||||
mLatinIME.getCoordinatesForCurrentKeyboard(codePoints),
|
mLatinIME.getCoordinatesForCurrentKeyboard(codePoints), previousWord);
|
||||||
previousWord, keyboardSwitcher.getKeyboard());
|
|
||||||
mConnection.setComposingText(textToCommit, 1);
|
mConnection.setComposingText(textToCommit, 1);
|
||||||
}
|
}
|
||||||
if (settingsValues.mIsInternal) {
|
if (settingsValues.mIsInternal) {
|
||||||
|
|
|
@ -316,7 +316,7 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
||||||
final int[] codePoints = StringUtils.toCodePointArray(text);
|
final int[] codePoints = StringUtils.toCodePointArray(text);
|
||||||
composer.setComposingWord(codePoints,
|
composer.setComposingWord(codePoints,
|
||||||
LatinIME.getCoordinatesForKeyboard(codePoints, dictInfo.mKeyboard),
|
LatinIME.getCoordinatesForKeyboard(codePoints, dictInfo.mKeyboard),
|
||||||
null /* previousWord */, dictInfo.mKeyboard);
|
null /* previousWord */);
|
||||||
// TODO: make a spell checker option to block offensive words or not
|
// TODO: make a spell checker option to block offensive words or not
|
||||||
final ArrayList<SuggestedWordInfo> suggestions =
|
final ArrayList<SuggestedWordInfo> suggestions =
|
||||||
dictInfo.mDictionary.getSuggestions(composer, prevWord,
|
dictInfo.mDictionary.getSuggestions(composer, prevWord,
|
||||||
|
|
|
@ -39,8 +39,7 @@ public class WordComposerTests extends AndroidTestCase {
|
||||||
final int[] COORDINATES_WITHIN_BMP =
|
final int[] COORDINATES_WITHIN_BMP =
|
||||||
LatinIME.getCoordinatesForKeyboard(CODEPOINTS_WITHIN_BMP, null);
|
LatinIME.getCoordinatesForKeyboard(CODEPOINTS_WITHIN_BMP, null);
|
||||||
final String PREVWORD = "prevword";
|
final String PREVWORD = "prevword";
|
||||||
wc.setComposingWord(CODEPOINTS_WITHIN_BMP, COORDINATES_WITHIN_BMP,
|
wc.setComposingWord(CODEPOINTS_WITHIN_BMP, COORDINATES_WITHIN_BMP, PREVWORD);
|
||||||
PREVWORD, null /* keyboard */);
|
|
||||||
assertEquals(wc.size(),
|
assertEquals(wc.size(),
|
||||||
STR_WITHIN_BMP.codePointCount(0, STR_WITHIN_BMP.length()));
|
STR_WITHIN_BMP.codePointCount(0, STR_WITHIN_BMP.length()));
|
||||||
assertFalse(wc.isCursorFrontOrMiddleOfComposingWord());
|
assertFalse(wc.isCursorFrontOrMiddleOfComposingWord());
|
||||||
|
@ -73,7 +72,7 @@ public class WordComposerTests extends AndroidTestCase {
|
||||||
final int[] COORDINATES_WITH_SUPPLEMENTARY_CHAR = LatinIME.getCoordinatesForKeyboard(
|
final int[] COORDINATES_WITH_SUPPLEMENTARY_CHAR = LatinIME.getCoordinatesForKeyboard(
|
||||||
CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, null);
|
CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, null);
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
null /* previousWord */, null /* keyboard */);
|
null /* previousWord */);
|
||||||
assertEquals(wc.size(), CODEPOINTS_WITH_SUPPLEMENTARY_CHAR.length);
|
assertEquals(wc.size(), CODEPOINTS_WITH_SUPPLEMENTARY_CHAR.length);
|
||||||
assertFalse(wc.isCursorFrontOrMiddleOfComposingWord());
|
assertFalse(wc.isCursorFrontOrMiddleOfComposingWord());
|
||||||
wc.setCursorPositionWithinWord(3);
|
wc.setCursorPositionWithinWord(3);
|
||||||
|
@ -85,45 +84,45 @@ public class WordComposerTests extends AndroidTestCase {
|
||||||
assertNull(wc.getPreviousWordForSuggestion());
|
assertNull(wc.getPreviousWordForSuggestion());
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
STR_WITHIN_BMP, null /* keyboard */);
|
STR_WITHIN_BMP);
|
||||||
wc.setCursorPositionWithinWord(3);
|
wc.setCursorPositionWithinWord(3);
|
||||||
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(7));
|
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(7));
|
||||||
assertEquals(STR_WITHIN_BMP, wc.getPreviousWordForSuggestion());
|
assertEquals(STR_WITHIN_BMP, wc.getPreviousWordForSuggestion());
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
STR_WITH_SUPPLEMENTARY_CHAR, null /* keyboard */);
|
STR_WITH_SUPPLEMENTARY_CHAR);
|
||||||
wc.setCursorPositionWithinWord(3);
|
wc.setCursorPositionWithinWord(3);
|
||||||
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(7));
|
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(7));
|
||||||
assertEquals(STR_WITH_SUPPLEMENTARY_CHAR, wc.getPreviousWordForSuggestion());
|
assertEquals(STR_WITH_SUPPLEMENTARY_CHAR, wc.getPreviousWordForSuggestion());
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
STR_WITHIN_BMP, null /* keyboard */);
|
STR_WITHIN_BMP);
|
||||||
wc.setCursorPositionWithinWord(3);
|
wc.setCursorPositionWithinWord(3);
|
||||||
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(-3));
|
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(-3));
|
||||||
assertFalse(wc.moveCursorByAndReturnIfInsideComposingWord(-1));
|
assertFalse(wc.moveCursorByAndReturnIfInsideComposingWord(-1));
|
||||||
assertEquals(STR_WITHIN_BMP, wc.getPreviousWordForSuggestion());
|
assertEquals(STR_WITHIN_BMP, wc.getPreviousWordForSuggestion());
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
null /* previousWord */, null /* keyboard */);
|
null /* previousWord */);
|
||||||
wc.setCursorPositionWithinWord(3);
|
wc.setCursorPositionWithinWord(3);
|
||||||
assertFalse(wc.moveCursorByAndReturnIfInsideComposingWord(-9));
|
assertFalse(wc.moveCursorByAndReturnIfInsideComposingWord(-9));
|
||||||
assertNull(wc.getPreviousWordForSuggestion());
|
assertNull(wc.getPreviousWordForSuggestion());
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
STR_WITH_SUPPLEMENTARY_CHAR, null /* keyboard */);
|
STR_WITH_SUPPLEMENTARY_CHAR);
|
||||||
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(-10));
|
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(-10));
|
||||||
assertEquals(STR_WITH_SUPPLEMENTARY_CHAR, wc.getPreviousWordForSuggestion());
|
assertEquals(STR_WITH_SUPPLEMENTARY_CHAR, wc.getPreviousWordForSuggestion());
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
null /* previousWord */, null /* keyboard */);
|
null /* previousWord */);
|
||||||
assertFalse(wc.moveCursorByAndReturnIfInsideComposingWord(-11));
|
assertFalse(wc.moveCursorByAndReturnIfInsideComposingWord(-11));
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
null /* previousWord */, null /* keyboard */);
|
null /* previousWord */);
|
||||||
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(0));
|
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(0));
|
||||||
|
|
||||||
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
wc.setComposingWord(CODEPOINTS_WITH_SUPPLEMENTARY_CHAR, COORDINATES_WITH_SUPPLEMENTARY_CHAR,
|
||||||
null /* previousWord */, null /* keyboard */);
|
null /* previousWord */);
|
||||||
wc.setCursorPositionWithinWord(2);
|
wc.setCursorPositionWithinWord(2);
|
||||||
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(0));
|
assertTrue(wc.moveCursorByAndReturnIfInsideComposingWord(0));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue