LatinIME/java/src/com/android/inputmethod/latin/SynchronouslyLoadedUserDictionary.java
Jean Chalard cfed273922 Add an option to user dict to match more precise locales
This should not be used lightly, as it violates the general
contract of locale, and does kill some legitimate (albeit
alledgedly rare) use patterns.
Currently, the spell checker uses this because it uses a
negative logic: it should match broadly, and when in doubt,
match even more broadly, which is almost never the case of
something that uses the locale.
In other words: don't use this option unless you are
very, VERY sure that's what you want. Hint: it isn't

Bug: 5280929
Change-Id: Ib3cae319c692161d653630038c5bcde1f4340c05
2011-09-15 18:01:13 +09:00

46 lines
1.6 KiB
Java

/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.latin;
import android.content.Context;
import com.android.inputmethod.keyboard.ProximityInfo;
public class SynchronouslyLoadedUserDictionary extends UserDictionary {
public SynchronouslyLoadedUserDictionary(final Context context, final String locale) {
this(context, locale, false);
}
public SynchronouslyLoadedUserDictionary(final Context context, final String locale,
final boolean alsoUseMoreRestrictiveLocales) {
super(context, locale, alsoUseMoreRestrictiveLocales);
}
@Override
public void getWords(final WordComposer codes, final WordCallback callback,
final ProximityInfo proximityInfo) {
blockingReloadDictionaryIfRequired();
getWordsInner(codes, callback, proximityInfo);
}
@Override
public synchronized boolean isValidWord(CharSequence word) {
blockingReloadDictionaryIfRequired();
return getWordFrequency(word) > -1;
}
}