mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Keep addWordToDictionary from doing disk I/O on main thread
bug: 2999524 Change-Id: Id8b04d38079cfa1dadd5955eb7f83085e60eb8e2
This commit is contained in:
parent
1bebdcb4e4
commit
336bc6bfeb
@ -89,13 +89,19 @@ public class UserDictionary extends ExpandableDictionary {
|
|||||||
super.addWord(word, frequency);
|
super.addWord(word, frequency);
|
||||||
|
|
||||||
// Update the user dictionary provider
|
// Update the user dictionary provider
|
||||||
ContentValues values = new ContentValues(5);
|
final ContentValues values = new ContentValues(5);
|
||||||
values.put(Words.WORD, word);
|
values.put(Words.WORD, word);
|
||||||
values.put(Words.FREQUENCY, frequency);
|
values.put(Words.FREQUENCY, frequency);
|
||||||
values.put(Words.LOCALE, mLocale);
|
values.put(Words.LOCALE, mLocale);
|
||||||
values.put(Words.APP_ID, 0);
|
values.put(Words.APP_ID, 0);
|
||||||
|
|
||||||
getContext().getContentResolver().insert(Words.CONTENT_URI, values);
|
final ContentResolver contentResolver = getContext().getContentResolver();
|
||||||
|
new Thread("addWord") {
|
||||||
|
public void run() {
|
||||||
|
contentResolver.insert(Words.CONTENT_URI, values);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
// In case the above does a synchronous callback of the change observer
|
// In case the above does a synchronous callback of the change observer
|
||||||
setRequiresReload(false);
|
setRequiresReload(false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user