am 8736f2d7: Merge "Fix oscillations on ICS"
* commit '8736f2d719940b18b931ad18b7b436ecbd28d222': Fix oscillations on ICSmain
commit
497572d542
|
@ -201,8 +201,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private static final int MSG_RESET_CACHES = 7;
|
private static final int MSG_RESET_CACHES = 7;
|
||||||
private static final int MSG_WAIT_FOR_DICTIONARY_LOAD = 8;
|
private static final int MSG_WAIT_FOR_DICTIONARY_LOAD = 8;
|
||||||
private static final int MSG_DEALLOCATE_MEMORY = 9;
|
private static final int MSG_DEALLOCATE_MEMORY = 9;
|
||||||
|
private static final int MSG_RESUME_SUGGESTIONS_FOR_START_INPUT = 10;
|
||||||
// Update this when adding new messages
|
// Update this when adding new messages
|
||||||
private static final int MSG_LAST = MSG_DEALLOCATE_MEMORY;
|
private static final int MSG_LAST = MSG_RESUME_SUGGESTIONS_FOR_START_INPUT;
|
||||||
|
|
||||||
private static final int ARG1_NOT_GESTURE_INPUT = 0;
|
private static final int ARG1_NOT_GESTURE_INPUT = 0;
|
||||||
private static final int ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 1;
|
private static final int ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 1;
|
||||||
|
@ -257,7 +258,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
break;
|
break;
|
||||||
case MSG_RESUME_SUGGESTIONS:
|
case MSG_RESUME_SUGGESTIONS:
|
||||||
latinIme.mInputLogic.restartSuggestionsOnWordTouchedByCursor(
|
latinIme.mInputLogic.restartSuggestionsOnWordTouchedByCursor(
|
||||||
latinIme.mSettings.getCurrent(),
|
latinIme.mSettings.getCurrent(), false /* forStartInput */,
|
||||||
|
latinIme.mKeyboardSwitcher.getCurrentKeyboardScriptId());
|
||||||
|
break;
|
||||||
|
case MSG_RESUME_SUGGESTIONS_FOR_START_INPUT:
|
||||||
|
latinIme.mInputLogic.restartSuggestionsOnWordTouchedByCursor(
|
||||||
|
latinIme.mSettings.getCurrent(), true /* forStartInput */,
|
||||||
latinIme.mKeyboardSwitcher.getCurrentKeyboardScriptId());
|
latinIme.mKeyboardSwitcher.getCurrentKeyboardScriptId());
|
||||||
break;
|
break;
|
||||||
case MSG_REOPEN_DICTIONARIES:
|
case MSG_REOPEN_DICTIONARIES:
|
||||||
|
@ -303,7 +309,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
sendMessage(obtainMessage(MSG_REOPEN_DICTIONARIES));
|
sendMessage(obtainMessage(MSG_REOPEN_DICTIONARIES));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postResumeSuggestions(final boolean shouldDelay) {
|
private void postResumeSuggestionsInternal(final boolean shouldDelay,
|
||||||
|
final boolean forStartInput) {
|
||||||
final LatinIME latinIme = getOwnerInstance();
|
final LatinIME latinIme = getOwnerInstance();
|
||||||
if (latinIme == null) {
|
if (latinIme == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -312,14 +319,25 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeMessages(MSG_RESUME_SUGGESTIONS);
|
removeMessages(MSG_RESUME_SUGGESTIONS);
|
||||||
|
removeMessages(MSG_RESUME_SUGGESTIONS_FOR_START_INPUT);
|
||||||
|
final int message = forStartInput ? MSG_RESUME_SUGGESTIONS_FOR_START_INPUT
|
||||||
|
: MSG_RESUME_SUGGESTIONS;
|
||||||
if (shouldDelay) {
|
if (shouldDelay) {
|
||||||
sendMessageDelayed(obtainMessage(MSG_RESUME_SUGGESTIONS),
|
sendMessageDelayed(obtainMessage(message),
|
||||||
mDelayInMillisecondsToUpdateSuggestions);
|
mDelayInMillisecondsToUpdateSuggestions);
|
||||||
} else {
|
} else {
|
||||||
sendMessage(obtainMessage(MSG_RESUME_SUGGESTIONS));
|
sendMessage(obtainMessage(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postResumeSuggestions(final boolean shouldDelay) {
|
||||||
|
postResumeSuggestionsInternal(shouldDelay, false /* forStartInput */);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postResumeSuggestionsForStartInput(final boolean shouldDelay) {
|
||||||
|
postResumeSuggestionsInternal(shouldDelay, true /* forStartInput */);
|
||||||
|
}
|
||||||
|
|
||||||
public void postResetCaches(final boolean tryResumeSuggestions, final int remainingTries) {
|
public void postResetCaches(final boolean tryResumeSuggestions, final int remainingTries) {
|
||||||
removeMessages(MSG_RESET_CACHES);
|
removeMessages(MSG_RESET_CACHES);
|
||||||
sendMessage(obtainMessage(MSG_RESET_CACHES, tryResumeSuggestions ? 1 : 0,
|
sendMessage(obtainMessage(MSG_RESET_CACHES, tryResumeSuggestions ? 1 : 0,
|
||||||
|
@ -969,7 +987,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// initialSelStart and initialSelEnd sometimes are lying. Make a best effort to
|
// initialSelStart and initialSelEnd sometimes are lying. Make a best effort to
|
||||||
// work around this bug.
|
// work around this bug.
|
||||||
mInputLogic.mConnection.tryFixLyingCursorPosition();
|
mInputLogic.mConnection.tryFixLyingCursorPosition();
|
||||||
mHandler.postResumeSuggestions(true /* shouldDelay */);
|
mHandler.postResumeSuggestionsForStartInput(true /* shouldDelay */);
|
||||||
needToCallLoadKeyboardLater = false;
|
needToCallLoadKeyboardLater = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1178,14 +1178,13 @@ public final class InputLogic {
|
||||||
StatsUtils.onBackspacePressed(totalDeletedLength);
|
StatsUtils.onBackspacePressed(totalDeletedLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inputTransaction.mSettingsValues
|
if (inputTransaction.mSettingsValues.isSuggestionsEnabledPerUserSettings()
|
||||||
.isSuggestionsEnabledPerUserSettings()
|
|
||||||
&& inputTransaction.mSettingsValues.mSpacingAndPunctuations
|
&& inputTransaction.mSettingsValues.mSpacingAndPunctuations
|
||||||
.mCurrentLanguageHasSpaces
|
.mCurrentLanguageHasSpaces
|
||||||
&& !mConnection.isCursorFollowedByWordCharacter(
|
&& !mConnection.isCursorFollowedByWordCharacter(
|
||||||
inputTransaction.mSettingsValues.mSpacingAndPunctuations)) {
|
inputTransaction.mSettingsValues.mSpacingAndPunctuations)) {
|
||||||
restartSuggestionsOnWordTouchedByCursor(inputTransaction.mSettingsValues,
|
restartSuggestionsOnWordTouchedByCursor(inputTransaction.mSettingsValues,
|
||||||
currentKeyboardScriptId);
|
false /* forStartInput */, currentKeyboardScriptId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1441,10 +1440,13 @@ public final class InputLogic {
|
||||||
* do nothing.
|
* do nothing.
|
||||||
*
|
*
|
||||||
* @param settingsValues the current values of the settings.
|
* @param settingsValues the current values of the settings.
|
||||||
* suggestions in the suggestion list.
|
* @param forStartInput whether we're doing this in answer to starting the input (as opposed
|
||||||
|
* 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.
|
||||||
*/
|
*/
|
||||||
// TODO: make this private.
|
// TODO: make this private.
|
||||||
public void restartSuggestionsOnWordTouchedByCursor(final SettingsValues settingsValues,
|
public void restartSuggestionsOnWordTouchedByCursor(final SettingsValues settingsValues,
|
||||||
|
final boolean forStartInput,
|
||||||
// TODO: remove this argument, put it into settingsValues
|
// TODO: remove this argument, put it into settingsValues
|
||||||
final int currentKeyboardScriptId) {
|
final int currentKeyboardScriptId) {
|
||||||
// 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
|
||||||
|
@ -1520,7 +1522,9 @@ public final class InputLogic {
|
||||||
mLatinIME.getCoordinatesForCurrentKeyboard(codePoints));
|
mLatinIME.getCoordinatesForCurrentKeyboard(codePoints));
|
||||||
mWordComposer.setCursorPositionWithinWord(
|
mWordComposer.setCursorPositionWithinWord(
|
||||||
typedWord.codePointCount(0, numberOfCharsInWordBeforeCursor));
|
typedWord.codePointCount(0, numberOfCharsInWordBeforeCursor));
|
||||||
mConnection.maybeMoveTheCursorAroundAndRestoreToWorkaroundABug();
|
if (forStartInput) {
|
||||||
|
mConnection.maybeMoveTheCursorAroundAndRestoreToWorkaroundABug();
|
||||||
|
}
|
||||||
mConnection.setComposingRegion(expectedCursorPosition - numberOfCharsInWordBeforeCursor,
|
mConnection.setComposingRegion(expectedCursorPosition - numberOfCharsInWordBeforeCursor,
|
||||||
expectedCursorPosition + range.getNumberOfCharsInWordAfterCursor());
|
expectedCursorPosition + range.getNumberOfCharsInWordAfterCursor());
|
||||||
if (suggestions.size() <= 1) {
|
if (suggestions.size() <= 1) {
|
||||||
|
|
Loading…
Reference in New Issue