mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 22:29:10 +00:00
avoid unnecessary dictionary facilitator resets
a reset also resets confidence values for multilingual typing, which is most likely unwanted
This commit is contained in:
parent
7f970e2efd
commit
6ec03290a5
3 changed files with 13 additions and 9 deletions
|
@ -102,6 +102,8 @@ public interface DictionaryFacilitator {
|
|||
|
||||
boolean usesContacts();
|
||||
|
||||
boolean usesPersonalization();
|
||||
|
||||
String getAccount();
|
||||
|
||||
void resetDictionaries(
|
||||
|
|
|
@ -294,6 +294,11 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
|||
return mDictionaryGroups.get(0).getSubDict(Dictionary.TYPE_CONTACTS) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesPersonalization() {
|
||||
return mDictionaryGroups.get(0).getSubDict(Dictionary.TYPE_USER_HISTORY) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccount() {
|
||||
return null;
|
||||
|
|
|
@ -609,11 +609,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
|
||||
mClipboardHistoryManager.onCreate();
|
||||
mHandler.onCreate();
|
||||
|
||||
// TODO: Resolve mutual dependencies of {@link #loadSettings()} and
|
||||
// {@link #resetDictionaryFacilitatorIfNecessary()}.
|
||||
loadSettings();
|
||||
resetDictionaryFacilitatorIfNecessary();
|
||||
|
||||
// Register to receive ringer mode change.
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
|
@ -661,10 +657,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// been displayed. Opening dictionaries never affects responsivity as dictionaries are
|
||||
// asynchronously loaded.
|
||||
if (!mHandler.hasPendingReopenDictionaries()) {
|
||||
resetDictionaryFacilitator(locale);
|
||||
resetDictionaryFacilitatorIfNecessary();
|
||||
}
|
||||
refreshPersonalizationDictionarySession(currentSettingsValues);
|
||||
resetDictionaryFacilitatorIfNecessary();
|
||||
mStatsUtilsManager.onLoadSettings(this /* context */, currentSettingsValues);
|
||||
}
|
||||
|
||||
|
@ -704,7 +699,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
subtypeLocale = subtypeSwitcherLocale;
|
||||
}
|
||||
if (mDictionaryFacilitator.isForLocale(subtypeLocale)
|
||||
&& mDictionaryFacilitator.isForAccount(mSettings.getCurrent().mAccount)) {
|
||||
&& mDictionaryFacilitator.isForAccount(mSettings.getCurrent().mAccount)
|
||||
&& mDictionaryFacilitator.usesContacts() == mSettings.getCurrent().mUseContactsDictionary
|
||||
&& mDictionaryFacilitator.usesPersonalization() == mSettings.getCurrent().mUsePersonalizedDicts
|
||||
) {
|
||||
return;
|
||||
}
|
||||
resetDictionaryFacilitator(subtypeLocale);
|
||||
|
@ -725,8 +723,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
settingsValues.mAccount, "" /* dictNamePrefix */,
|
||||
this /* DictionaryInitializationListener */);
|
||||
if (settingsValues.mAutoCorrectionEnabledPerUserSettings) {
|
||||
mInputLogic.mSuggest.setAutoCorrectionThreshold(
|
||||
settingsValues.mAutoCorrectionThreshold);
|
||||
mInputLogic.mSuggest.setAutoCorrectionThreshold(settingsValues.mAutoCorrectionThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue