mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix: contacts/user dicts are too frequently regenerated.
Change-Id: I6b04a58c543fda6df7a2c016b8b8a5300f137d73
This commit is contained in:
parent
f614de62aa
commit
4426cbc59e
@ -511,12 +511,12 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||||||
*/
|
*/
|
||||||
private final void asyncReloadDictionary() {
|
private final void asyncReloadDictionary() {
|
||||||
if (mIsReloading.compareAndSet(false, true)) {
|
if (mIsReloading.compareAndSet(false, true)) {
|
||||||
mNeedsToReload = false;
|
|
||||||
asyncExecuteTaskWithWriteLock(new Runnable() {
|
asyncExecuteTaskWithWriteLock(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (!mDictFile.exists() || haveContentsChanged()) {
|
// TODO: Quit checking contents in ExpandableBinaryDictionary.
|
||||||
|
if (!mDictFile.exists() || (mNeedsToReload && haveContentsChanged())) {
|
||||||
// If the dictionary file does not exist or contents have been updated,
|
// If the dictionary file does not exist or contents have been updated,
|
||||||
// generate a new one.
|
// generate a new one.
|
||||||
createNewDictionaryLocked();
|
createNewDictionaryLocked();
|
||||||
@ -524,6 +524,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||||||
// Otherwise, load the existing dictionary.
|
// Otherwise, load the existing dictionary.
|
||||||
loadBinaryDictionaryLocked();
|
loadBinaryDictionaryLocked();
|
||||||
}
|
}
|
||||||
|
mNeedsToReload = false;
|
||||||
if (mBinaryDictionary != null && !(isValidDictionaryLocked()
|
if (mBinaryDictionary != null && !(isValidDictionaryLocked()
|
||||||
// TODO: remove the check below
|
// TODO: remove the check below
|
||||||
&& matchesExpectedBinaryDictFormatVersionForThisType(
|
&& matchesExpectedBinaryDictFormatVersionForThisType(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user