am eb66f190: Merge "Check corpus handles during startup for personalization."
* commit 'eb66f1906d4269dd5c10ab83c86e3885f140cc4f': Check corpus handles during startup for personalization.main
commit
c35d5abe6f
|
@ -57,7 +57,7 @@ public abstract class PersonalizationDictionaryUpdateSession {
|
||||||
dictionary.unRegisterUpdateSession(this);
|
dictionary.unRegisterUpdateSession(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearAndFlushDictionary(final Context context) {
|
public void clearAndFlushDictionary() {
|
||||||
final PersonalizationDictionary dictionary = getDictionary();
|
final PersonalizationDictionary dictionary = getDictionary();
|
||||||
if (dictionary == null) {
|
if (dictionary == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -31,7 +31,9 @@ import com.android.inputmethod.latin.utils.ResourceUtils;
|
||||||
import com.android.inputmethod.latin.utils.RunInLocale;
|
import com.android.inputmethod.latin.utils.RunInLocale;
|
||||||
import com.android.inputmethod.latin.utils.StringUtils;
|
import com.android.inputmethod.latin.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
public final class Settings implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public final class Settings implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
@ -95,6 +97,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
"pref_last_used_personalization_token";
|
"pref_last_used_personalization_token";
|
||||||
private static final String PREF_LAST_PERSONALIZATION_DICT_WIPED_TIME =
|
private static final String PREF_LAST_PERSONALIZATION_DICT_WIPED_TIME =
|
||||||
"pref_last_used_personalization_dict_wiped_time";
|
"pref_last_used_personalization_dict_wiped_time";
|
||||||
|
private static final String PREF_CORPUS_HANDLES_FOR_PERSONALIZATION =
|
||||||
|
"pref_corpus_handles_for_personalization";
|
||||||
public static final String PREF_SEND_FEEDBACK = "send_feedback";
|
public static final String PREF_SEND_FEEDBACK = "send_feedback";
|
||||||
public static final String PREF_ABOUT_KEYBOARD = "about_keyboard";
|
public static final String PREF_ABOUT_KEYBOARD = "about_keyboard";
|
||||||
|
|
||||||
|
@ -382,6 +386,15 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
return mPrefs.getLong(PREF_LAST_PERSONALIZATION_DICT_WIPED_TIME, 0);
|
return mPrefs.getLong(PREF_LAST_PERSONALIZATION_DICT_WIPED_TIME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void writeCorpusHandlesForPersonalization(final Set<String> corpusHandles) {
|
||||||
|
mPrefs.edit().putStringSet(PREF_CORPUS_HANDLES_FOR_PERSONALIZATION, corpusHandles).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> readCorpusHandlesForPersonalization() {
|
||||||
|
final Set<String> emptySet = Collections.emptySet();
|
||||||
|
return mPrefs.getStringSet(PREF_CORPUS_HANDLES_FOR_PERSONALIZATION, emptySet);
|
||||||
|
}
|
||||||
|
|
||||||
public static void writeEmojiRecentKeys(final SharedPreferences prefs, String str) {
|
public static void writeEmojiRecentKeys(final SharedPreferences prefs, String str) {
|
||||||
prefs.edit().putString(PREF_EMOJI_RECENT_KEYS, str).apply();
|
prefs.edit().putString(PREF_EMOJI_RECENT_KEYS, str).apply();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue