mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-08 15:47:43 +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 usesContacts();
|
||||||
|
|
||||||
|
boolean usesPersonalization();
|
||||||
|
|
||||||
String getAccount();
|
String getAccount();
|
||||||
|
|
||||||
void resetDictionaries(
|
void resetDictionaries(
|
||||||
|
|
|
@ -294,6 +294,11 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
||||||
return mDictionaryGroups.get(0).getSubDict(Dictionary.TYPE_CONTACTS) != null;
|
return mDictionaryGroups.get(0).getSubDict(Dictionary.TYPE_CONTACTS) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean usesPersonalization() {
|
||||||
|
return mDictionaryGroups.get(0).getSubDict(Dictionary.TYPE_USER_HISTORY) != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAccount() {
|
public String getAccount() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -609,11 +609,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
mClipboardHistoryManager.onCreate();
|
mClipboardHistoryManager.onCreate();
|
||||||
mHandler.onCreate();
|
mHandler.onCreate();
|
||||||
|
|
||||||
// TODO: Resolve mutual dependencies of {@link #loadSettings()} and
|
|
||||||
// {@link #resetDictionaryFacilitatorIfNecessary()}.
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
resetDictionaryFacilitatorIfNecessary();
|
|
||||||
|
|
||||||
// Register to receive ringer mode change.
|
// Register to receive ringer mode change.
|
||||||
final IntentFilter filter = new IntentFilter();
|
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
|
// been displayed. Opening dictionaries never affects responsivity as dictionaries are
|
||||||
// asynchronously loaded.
|
// asynchronously loaded.
|
||||||
if (!mHandler.hasPendingReopenDictionaries()) {
|
if (!mHandler.hasPendingReopenDictionaries()) {
|
||||||
resetDictionaryFacilitator(locale);
|
resetDictionaryFacilitatorIfNecessary();
|
||||||
}
|
}
|
||||||
refreshPersonalizationDictionarySession(currentSettingsValues);
|
refreshPersonalizationDictionarySession(currentSettingsValues);
|
||||||
resetDictionaryFacilitatorIfNecessary();
|
|
||||||
mStatsUtilsManager.onLoadSettings(this /* context */, currentSettingsValues);
|
mStatsUtilsManager.onLoadSettings(this /* context */, currentSettingsValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,7 +699,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
subtypeLocale = subtypeSwitcherLocale;
|
subtypeLocale = subtypeSwitcherLocale;
|
||||||
}
|
}
|
||||||
if (mDictionaryFacilitator.isForLocale(subtypeLocale)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
resetDictionaryFacilitator(subtypeLocale);
|
resetDictionaryFacilitator(subtypeLocale);
|
||||||
|
@ -725,8 +723,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
settingsValues.mAccount, "" /* dictNamePrefix */,
|
settingsValues.mAccount, "" /* dictNamePrefix */,
|
||||||
this /* DictionaryInitializationListener */);
|
this /* DictionaryInitializationListener */);
|
||||||
if (settingsValues.mAutoCorrectionEnabledPerUserSettings) {
|
if (settingsValues.mAutoCorrectionEnabledPerUserSettings) {
|
||||||
mInputLogic.mSuggest.setAutoCorrectionThreshold(
|
mInputLogic.mSuggest.setAutoCorrectionThreshold(settingsValues.mAutoCorrectionThreshold);
|
||||||
settingsValues.mAutoCorrectionThreshold);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue