mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 23:12:47 +00:00
slightly tune when entries are added to user history
This commit is contained in:
parent
935dd77cf1
commit
5eaeb5892f
1 changed files with 11 additions and 5 deletions
|
@ -874,10 +874,17 @@ public final class InputLogic {
|
||||||
private void addToHistoryIfEmoji(final String text, final SettingsValues settingsValues) {
|
private void addToHistoryIfEmoji(final String text, final SettingsValues settingsValues) {
|
||||||
if (mLastComposedWord == LastComposedWord.NOT_A_COMPOSED_WORD // we want a last composed word, also to avoid storing consecutive emojis
|
if (mLastComposedWord == LastComposedWord.NOT_A_COMPOSED_WORD // we want a last composed word, also to avoid storing consecutive emojis
|
||||||
|| mWordComposer.isComposingWord() // emoji will be part of the word in this case, better do nothing
|
|| mWordComposer.isComposingWord() // emoji will be part of the word in this case, better do nothing
|
||||||
|| !settingsValues.mBigramPredictionEnabled // this is for next word suggestions, so they need to be enabled
|
|| !settingsValues.mBigramPredictionEnabled // this is only for next word suggestions, so they need to be enabled
|
||||||
|| settingsValues.mIncognitoModeEnabled // add nothing
|
|| settingsValues.mIncognitoModeEnabled
|
||||||
|| !StringUtilsKt.isEmoji(text) // obviously we need an emoji
|
|| settingsValues.mInputAttributes.mInputTypeNoAutoCorrect // see comment in performAdditionToUserHistoryDictionary
|
||||||
|
|| !StringUtilsKt.isEmoji(text)
|
||||||
) return;
|
) return;
|
||||||
|
if (mConnection.hasSlowInputConnection()) {
|
||||||
|
// Since we don't unlearn when the user backspaces on a slow InputConnection,
|
||||||
|
// turn off learning to guard against adding typos that the user later deletes.
|
||||||
|
Log.w(TAG, "Skipping learning due to slow InputConnection.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD; // avoid storing consecutive emojis
|
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD; // avoid storing consecutive emojis
|
||||||
|
|
||||||
// commit emoji to dictionary, so it ends up in history and can be suggested as next word
|
// commit emoji to dictionary, so it ends up in history and can be suggested as next word
|
||||||
|
@ -1549,8 +1556,7 @@ public final class InputLogic {
|
||||||
// If correction is not enabled, we don't add words to the user history dictionary.
|
// If correction is not enabled, we don't add words to the user history dictionary.
|
||||||
// That's to avoid unintended additions in some sensitive fields, or fields that
|
// That's to avoid unintended additions in some sensitive fields, or fields that
|
||||||
// expect to receive non-words.
|
// expect to receive non-words.
|
||||||
if (!settingsValues.mAutoCorrectionEnabledPerUserSettings
|
if (settingsValues.mInputAttributes.mInputTypeNoAutoCorrect || settingsValues.mIncognitoModeEnabled)
|
||||||
|| settingsValues.mIncognitoModeEnabled)
|
|
||||||
return;
|
return;
|
||||||
if (mConnection.hasSlowInputConnection()) {
|
if (mConnection.hasSlowInputConnection()) {
|
||||||
// Since we don't unlearn when the user backspaces on a slow InputConnection,
|
// Since we don't unlearn when the user backspaces on a slow InputConnection,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue