Merge "Remember the locale in the Suggest object (A1)"

main
Jean Chalard 2012-06-26 03:05:05 -07:00 committed by Android (Google) Code Review
commit a8c9946b44
1 changed files with 5 additions and 0 deletions

View File

@ -91,16 +91,21 @@ public class Suggest {
private boolean mIsAllUpperCase; private boolean mIsAllUpperCase;
private int mTrailingSingleQuotesCount; private int mTrailingSingleQuotesCount;
// Locale used for upper- and title-casing words
final private Locale mLocale;
private static final int MINIMUM_SAFETY_NET_CHAR_LENGTH = 4; private static final int MINIMUM_SAFETY_NET_CHAR_LENGTH = 4;
public Suggest(final Context context, final Locale locale) { public Suggest(final Context context, final Locale locale) {
initAsynchronously(context, locale); initAsynchronously(context, locale);
mLocale = locale;
} }
/* package for test */ Suggest(final Context context, final File dictionary, /* package for test */ Suggest(final Context context, final File dictionary,
final long startOffset, final long length, final Locale locale) { final long startOffset, final long length, final Locale locale) {
final Dictionary mainDict = DictionaryFactory.createDictionaryForTest(context, dictionary, final Dictionary mainDict = DictionaryFactory.createDictionaryForTest(context, dictionary,
startOffset, length /* useFullEditDistance */, false, locale); startOffset, length /* useFullEditDistance */, false, locale);
mLocale = locale;
mMainDictionary = mainDict; mMainDictionary = mainDict;
addOrReplaceDictionary(mDictionaries, DICT_KEY_MAIN, mainDict); addOrReplaceDictionary(mDictionaries, DICT_KEY_MAIN, mainDict);
initWhitelistAndAutocorrectAndPool(context, locale); initWhitelistAndAutocorrectAndPool(context, locale);