From 3bc3bc7971f15438732933cfac0db6e766e6a3e9 Mon Sep 17 00:00:00 2001 From: Mohammadinamul Sheik Date: Tue, 24 Mar 2015 14:56:54 -0700 Subject: Force download the dictionaries after the apk package is updated. - Also display the notification when the dictionaries are auto updated Bug: 19808828 Change-Id: If5c4efb73d8bb554d812afcf7deafec3ac40a462 --- .../inputmethod/dictionarypack/CommonPreferences.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'java/src/com/android/inputmethod/dictionarypack/CommonPreferences.java') diff --git a/java/src/com/android/inputmethod/dictionarypack/CommonPreferences.java b/java/src/com/android/inputmethod/dictionarypack/CommonPreferences.java index 3d0e29ed0..3cd822a3c 100644 --- a/java/src/com/android/inputmethod/dictionarypack/CommonPreferences.java +++ b/java/src/com/android/inputmethod/dictionarypack/CommonPreferences.java @@ -22,6 +22,8 @@ import android.content.SharedPreferences; public final class CommonPreferences { private static final String COMMON_PREFERENCES_NAME = "LatinImeDictPrefs"; + public static final String PREF_FORCE_DOWNLOAD_DICT = "pref_key_force_download_dict"; + public static SharedPreferences getCommonPreferences(final Context context) { return context.getSharedPreferences(COMMON_PREFERENCES_NAME, 0); } @@ -37,4 +39,14 @@ public final class CommonPreferences { editor.putBoolean(id, false); editor.apply(); } + + public static boolean isForceDownloadDict(Context context) { + return getCommonPreferences(context).getBoolean(PREF_FORCE_DOWNLOAD_DICT, false); + } + + public static void setForceDownloadDict(Context context, boolean forceDownload) { + SharedPreferences.Editor editor = getCommonPreferences(context).edit(); + editor.putBoolean(PREF_FORCE_DOWNLOAD_DICT, forceDownload); + editor.apply(); + } } -- cgit v1.2.3-83-g751a