mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-09 08:07:42 +00:00
Apps dictionary (#1361)
This commit is contained in:
parent
2fe87eea9b
commit
c9059f3616
16 changed files with 279 additions and 52 deletions
|
@ -26,6 +26,7 @@ public class DictionaryFacilitatorLruCache {
|
|||
private final Object mLock = new Object();
|
||||
private final DictionaryFacilitator mDictionaryFacilitator;
|
||||
private boolean mUseContactsDictionary;
|
||||
private boolean mUseAppsDictionary;
|
||||
private Locale mLocale;
|
||||
|
||||
public DictionaryFacilitatorLruCache(final Context context, final String dictionaryNamePrefix) {
|
||||
|
@ -59,7 +60,7 @@ public class DictionaryFacilitatorLruCache {
|
|||
if (mLocale != null) {
|
||||
// Note: Given that personalized dictionaries are not used here; we can pass null account.
|
||||
mDictionaryFacilitator.resetDictionaries(mContext, mLocale,
|
||||
mUseContactsDictionary, false /* usePersonalizedDicts */,
|
||||
mUseContactsDictionary, mUseAppsDictionary, false /* usePersonalizedDicts */,
|
||||
false /* forceReloadMainDictionary */, null /* account */,
|
||||
mDictionaryNamePrefix, null /* listener */);
|
||||
}
|
||||
|
@ -77,6 +78,18 @@ public class DictionaryFacilitatorLruCache {
|
|||
}
|
||||
}
|
||||
|
||||
public void setUseAppsDictionary(final boolean useAppsDictionary) {
|
||||
synchronized (mLock) {
|
||||
if (mUseAppsDictionary == useAppsDictionary) {
|
||||
// The value has not been changed.
|
||||
return;
|
||||
}
|
||||
mUseAppsDictionary = useAppsDictionary;
|
||||
resetDictionariesForLocaleLocked();
|
||||
waitForLoadingMainDictionary(mDictionaryFacilitator);
|
||||
}
|
||||
}
|
||||
|
||||
public DictionaryFacilitator get(final Locale locale) {
|
||||
synchronized (mLock) {
|
||||
if (!mDictionaryFacilitator.isForLocale(locale)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue