am 0e9419d0: Add word commit methods to StatsUtils
* commit '0e9419d014c859252584a37a2242def51f88294f': Add word commit methods to StatsUtilsmain
commit
c64cbfc932
|
@ -69,4 +69,14 @@ public final class StatsUtils {
|
||||||
public static void onAutoCorrection(final String typedWord, final String autoCorrectionWord,
|
public static void onAutoCorrection(final String typedWord, final String autoCorrectionWord,
|
||||||
final boolean isBatchInput, @Nullable final String dictionaryType) {
|
final boolean isBatchInput, @Nullable final String dictionaryType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onWordCommitUserTyped(final String commitWord, final boolean isBatchMode) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onWordCommitAutoCorrect(final String commitWord, final boolean isBatchMode) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onWordCommitSuggestionPickedManually(
|
||||||
|
final String commitWord, final boolean isBatchMode) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,8 @@ public final class InputLogic {
|
||||||
public void finishInput() {
|
public void finishInput() {
|
||||||
if (mWordComposer.isComposingWord()) {
|
if (mWordComposer.isComposingWord()) {
|
||||||
mConnection.finishComposingText();
|
mConnection.finishComposingText();
|
||||||
|
StatsUtils.onWordCommitUserTyped(
|
||||||
|
mWordComposer.getTypedWord(), mWordComposer.isBatchMode());
|
||||||
}
|
}
|
||||||
resetComposingState(true /* alsoResetLastComposedWord */);
|
resetComposingState(true /* alsoResetLastComposedWord */);
|
||||||
mInputLogicHandler.reset();
|
mInputLogicHandler.reset();
|
||||||
|
@ -251,6 +253,7 @@ public final class InputLogic {
|
||||||
promotePhantomSpace(settingsValues);
|
promotePhantomSpace(settingsValues);
|
||||||
}
|
}
|
||||||
mConnection.commitText(text, 1);
|
mConnection.commitText(text, 1);
|
||||||
|
StatsUtils.onWordCommitUserTyped(mEnteredText, mWordComposer.isBatchMode());
|
||||||
mConnection.endBatchEdit();
|
mConnection.endBatchEdit();
|
||||||
// Space state must be updated before calling updateShiftState
|
// Space state must be updated before calling updateShiftState
|
||||||
mSpaceState = SpaceState.NONE;
|
mSpaceState = SpaceState.NONE;
|
||||||
|
@ -350,6 +353,8 @@ public final class InputLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
StatsUtils.onPickSuggestionManually(mSuggestedWords, suggestionInfo);
|
StatsUtils.onPickSuggestionManually(mSuggestedWords, suggestionInfo);
|
||||||
|
StatsUtils.onWordCommitSuggestionPickedManually(
|
||||||
|
suggestionInfo.mWord, mWordComposer.isBatchMode());
|
||||||
return inputTransaction;
|
return inputTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,6 +578,7 @@ public final class InputLogic {
|
||||||
batchPointers.shift(candidate.mIndexOfTouchPointOfSecondWord);
|
batchPointers.shift(candidate.mIndexOfTouchPointOfSecondWord);
|
||||||
promotePhantomSpace(settingsValues);
|
promotePhantomSpace(settingsValues);
|
||||||
mConnection.commitText(commitParts[0], 0);
|
mConnection.commitText(commitParts[0], 0);
|
||||||
|
StatsUtils.onWordCommitUserTyped(commitParts[0], mWordComposer.isBatchMode());
|
||||||
mSpaceState = SpaceState.PHANTOM;
|
mSpaceState = SpaceState.PHANTOM;
|
||||||
keyboardSwitcher.requestUpdatingShiftState(
|
keyboardSwitcher.requestUpdatingShiftState(
|
||||||
getCurrentAutoCapsState(settingsValues), getCurrentRecapitalizeState());
|
getCurrentAutoCapsState(settingsValues), getCurrentRecapitalizeState());
|
||||||
|
@ -1064,8 +1070,10 @@ public final class InputLogic {
|
||||||
inputTransaction.setRequiresUpdateSuggestions();
|
inputTransaction.setRequiresUpdateSuggestions();
|
||||||
} else {
|
} else {
|
||||||
if (mLastComposedWord.canRevertCommit()) {
|
if (mLastComposedWord.canRevertCommit()) {
|
||||||
|
final String lastComposedWord = mLastComposedWord.mTypedWord;
|
||||||
revertCommit(inputTransaction, inputTransaction.mSettingsValues);
|
revertCommit(inputTransaction, inputTransaction.mSettingsValues);
|
||||||
StatsUtils.onRevertAutoCorrect();
|
StatsUtils.onRevertAutoCorrect();
|
||||||
|
StatsUtils.onWordCommitUserTyped(lastComposedWord, mWordComposer.isBatchMode());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) {
|
if (mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) {
|
||||||
|
@ -2001,6 +2009,8 @@ public final class InputLogic {
|
||||||
final int indexOfLastSpace = batchInputText.lastIndexOf(Constants.CODE_SPACE) + 1;
|
final int indexOfLastSpace = batchInputText.lastIndexOf(Constants.CODE_SPACE) + 1;
|
||||||
if (0 != indexOfLastSpace) {
|
if (0 != indexOfLastSpace) {
|
||||||
mConnection.commitText(batchInputText.substring(0, indexOfLastSpace), 1);
|
mConnection.commitText(batchInputText.substring(0, indexOfLastSpace), 1);
|
||||||
|
StatsUtils.onWordCommitUserTyped(
|
||||||
|
batchInputText.substring(0, indexOfLastSpace), mWordComposer.isBatchMode());
|
||||||
final SuggestedWords suggestedWordsForLastWordOfPhraseGesture =
|
final SuggestedWords suggestedWordsForLastWordOfPhraseGesture =
|
||||||
suggestedWords.getSuggestedWordsForLastWordOfPhraseGesture();
|
suggestedWords.getSuggestedWordsForLastWordOfPhraseGesture();
|
||||||
mLatinIME.showSuggestionStrip(suggestedWordsForLastWordOfPhraseGesture);
|
mLatinIME.showSuggestionStrip(suggestedWordsForLastWordOfPhraseGesture);
|
||||||
|
@ -2039,8 +2049,10 @@ public final class InputLogic {
|
||||||
if (!mWordComposer.isComposingWord()) return;
|
if (!mWordComposer.isComposingWord()) return;
|
||||||
final String typedWord = mWordComposer.getTypedWord();
|
final String typedWord = mWordComposer.getTypedWord();
|
||||||
if (typedWord.length() > 0) {
|
if (typedWord.length() > 0) {
|
||||||
|
final boolean isBatchMode = mWordComposer.isBatchMode();
|
||||||
commitChosenWord(settingsValues, typedWord,
|
commitChosenWord(settingsValues, typedWord,
|
||||||
LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, separatorString);
|
LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, separatorString);
|
||||||
|
StatsUtils.onWordCommitUserTyped(typedWord, isBatchMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2086,6 +2098,7 @@ public final class InputLogic {
|
||||||
throw new RuntimeException("We have an auto-correction but the typed word "
|
throw new RuntimeException("We have an auto-correction but the typed word "
|
||||||
+ "is empty? Impossible! I must commit suicide.");
|
+ "is empty? Impossible! I must commit suicide.");
|
||||||
}
|
}
|
||||||
|
final boolean isBatchMode = mWordComposer.isBatchMode();
|
||||||
commitChosenWord(settingsValues, autoCorrection,
|
commitChosenWord(settingsValues, autoCorrection,
|
||||||
LastComposedWord.COMMIT_TYPE_DECIDED_WORD, separator);
|
LastComposedWord.COMMIT_TYPE_DECIDED_WORD, separator);
|
||||||
if (!typedWord.equals(autoCorrection)) {
|
if (!typedWord.equals(autoCorrection)) {
|
||||||
|
@ -2098,8 +2111,11 @@ public final class InputLogic {
|
||||||
mConnection.commitCorrection(new CorrectionInfo(
|
mConnection.commitCorrection(new CorrectionInfo(
|
||||||
mConnection.getExpectedSelectionEnd() - autoCorrection.length(),
|
mConnection.getExpectedSelectionEnd() - autoCorrection.length(),
|
||||||
typedWord, autoCorrection));
|
typedWord, autoCorrection));
|
||||||
StatsUtils.onAutoCorrection(typedWord, autoCorrection, mWordComposer.isBatchMode(),
|
StatsUtils.onAutoCorrection(typedWord, autoCorrection, isBatchMode,
|
||||||
mWordComposer.getAutoCorrectionDictionaryTypeOrNull());
|
mWordComposer.getAutoCorrectionDictionaryTypeOrNull());
|
||||||
|
StatsUtils.onWordCommitAutoCorrect(autoCorrection, isBatchMode);
|
||||||
|
} else {
|
||||||
|
StatsUtils.onWordCommitUserTyped(autoCorrection, isBatchMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue