Merge "Pass long timestamps to DictionaryFacilitator"

This commit is contained in:
Jatin Matani 2015-02-24 20:57:33 +00:00 committed by Android (Google) Code Review
commit f7058c2a89
3 changed files with 6 additions and 6 deletions

View file

@ -147,11 +147,11 @@ public interface DictionaryFacilitator {
throws InterruptedException;
void addToUserHistory(final String suggestion, final boolean wasAutoCapitalized,
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
final boolean blockPotentiallyOffensive);
void unlearnFromUserHistory(final String word,
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
final int eventType);
// TODO: Revise the way to fusion suggestion results.

View file

@ -579,7 +579,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
}
public void addToUserHistory(final String suggestion, final boolean wasAutoCapitalized,
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
final boolean blockPotentiallyOffensive) {
final DictionaryGroup dictionaryGroup = getDictionaryGroupForMostProbableLanguage();
final String[] words = suggestion.split(Constants.WORD_SEPARATOR);
@ -588,7 +588,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
final String currentWord = words[i];
final boolean wasCurrentWordAutoCapitalized = (i == 0) ? wasAutoCapitalized : false;
addWordToUserHistory(dictionaryGroup, ngramContextForCurrentWord, currentWord,
wasCurrentWordAutoCapitalized, timeStampInSeconds, blockPotentiallyOffensive);
wasCurrentWordAutoCapitalized, (int) timeStampInSeconds, blockPotentiallyOffensive);
ngramContextForCurrentWord =
ngramContextForCurrentWord.getNextNgramContext(new WordInfo(currentWord));
}
@ -656,7 +656,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
@Override
public void unlearnFromUserHistory(final String word,
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
final int eventType) {
// TODO: Decide whether or not to remove the word on EVENT_BACKSPACE.
if (eventType != Constants.EVENT_BACKSPACE) {

View file

@ -1184,7 +1184,7 @@ public final class InputLogic {
void unlearnWord(final String word, final SettingsValues settingsValues, final int eventType) {
final NgramContext ngramContext = mConnection.getNgramContextFromNthPreviousWord(
settingsValues.mSpacingAndPunctuations, 2);
final int timeStampInSeconds = (int)TimeUnit.MILLISECONDS.toSeconds(
final long timeStampInSeconds = TimeUnit.MILLISECONDS.toSeconds(
System.currentTimeMillis());
mDictionaryFacilitator.unlearnFromUserHistory(
word, ngramContext, timeStampInSeconds, eventType);