am bf418f7c: Pass time stamp to addToUserHistory method as an argument
* commit 'bf418f7cba9b935785797e4ec34959fe0aef69b3': Pass time stamp to addToUserHistory method as an argumentmain
commit
4260f4efd7
|
@ -375,26 +375,21 @@ public class DictionaryFacilitatorForSuggest {
|
|||
mUserDictionary.addWordToUserDictionary(word);
|
||||
}
|
||||
|
||||
public void addToUserHistory(final WordComposer wordComposer, final String previousWord,
|
||||
final String suggestion) {
|
||||
public void addToUserHistory(final String suggestion, final boolean wasAutoCapitalized,
|
||||
final String previousWord, final int timeStampInSeconds) {
|
||||
if (mUserHistoryDictionary == null) {
|
||||
return;
|
||||
}
|
||||
final String secondWord;
|
||||
if (wordComposer.wasAutoCapitalized() && !wordComposer.isMostlyCaps()) {
|
||||
secondWord = suggestion.toLowerCase(mLocale);
|
||||
} else {
|
||||
secondWord = suggestion;
|
||||
}
|
||||
// We demote unrecognized words (frequency < 0, below) by specifying them as "invalid".
|
||||
// We don't add words with 0-frequency (assuming they would be profanity etc.).
|
||||
final int maxFreq = getMaxFrequency(suggestion);
|
||||
if (maxFreq == 0) {
|
||||
return;
|
||||
}
|
||||
final String secondWord = wasAutoCapitalized ? suggestion.toLowerCase(mLocale) : suggestion;
|
||||
// We demote unrecognized words (frequency < 0, below) by specifying them as "invalid".
|
||||
// We don't add words with 0-frequency (assuming they would be profanity etc.).
|
||||
final boolean isValid = maxFreq > 0;
|
||||
final int timeStamp = (int)TimeUnit.MILLISECONDS.toSeconds((System.currentTimeMillis()));
|
||||
mUserHistoryDictionary.addToDictionary(previousWord, secondWord, isValid, timeStamp);
|
||||
mUserHistoryDictionary.addToDictionary(
|
||||
previousWord, secondWord, isValid, timeStampInSeconds);
|
||||
}
|
||||
|
||||
public void cancelAddingUserHistory(final String previousWord, final String committedWord) {
|
||||
|
|
|
@ -59,6 +59,7 @@ import com.android.inputmethod.research.ResearchLogger;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* This class manages the input logic.
|
||||
|
@ -994,7 +995,12 @@ public final class InputLogic {
|
|||
final Suggest suggest = mSuggest;
|
||||
if (suggest == null) return;
|
||||
|
||||
suggest.mDictionaryFacilitator.addToUserHistory(mWordComposer, prevWord, suggestion);
|
||||
final boolean wasAutoCapitalized =
|
||||
mWordComposer.wasAutoCapitalized() && !mWordComposer.isMostlyCaps();
|
||||
final int timeStampInSeconds = (int)TimeUnit.MILLISECONDS.toSeconds(
|
||||
System.currentTimeMillis());
|
||||
suggest.mDictionaryFacilitator.addToUserHistory(suggestion, wasAutoCapitalized, prevWord,
|
||||
timeStampInSeconds);
|
||||
}
|
||||
|
||||
public void performUpdateSuggestionStripSync(final SettingsValues settingsValues,
|
||||
|
|
Loading…
Reference in New Issue