aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/dictionarypack
diff options
context:
space:
mode:
authorMohammadinamul Sheik <inamul@google.com>2015-05-04 20:24:33 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-05-04 20:24:33 +0000
commit9c08208d1a0592652fbdb6626cfd4ff9bd473441 (patch)
treef0b332c4d8d42c73065553f7240c431053c906df /java/src/com/android/inputmethod/dictionarypack
parentc6e7e89225ba6b350145ba7e57efcfa0b5fcc7fd (diff)
parentf01cd568f0de414e88507ce244969cf0e509c537 (diff)
downloadlatinime-9c08208d1a0592652fbdb6626cfd4ff9bd473441.tar.gz
latinime-9c08208d1a0592652fbdb6626cfd4ff9bd473441.tar.xz
latinime-9c08208d1a0592652fbdb6626cfd4ff9bd473441.zip
am f01cd568: Merge "Make the DictionaryService stage the downloaded files"
* commit 'f01cd568f0de414e88507ce244969cf0e509c537': Make the DictionaryService stage the downloaded files
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack')
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/ActionBatch.java10
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java2
2 files changed, 12 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java b/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java
index 09f8032cc..ee5106b5a 100644
--- a/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java
+++ b/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java
@@ -26,7 +26,9 @@ import android.text.TextUtils;
import android.util.Log;
import com.android.inputmethod.compat.DownloadManagerCompatUtils;
+import com.android.inputmethod.latin.BinaryDictionaryFileDumper;
import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.common.LocaleUtils;
import com.android.inputmethod.latin.utils.ApplicationUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;
@@ -210,9 +212,17 @@ public final class ActionBatch {
+ " for an InstallAfterDownload action. Bailing out.");
return;
}
+
DebugLogUtils.l("Setting word list as installed");
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
MetadataDbHelper.markEntryAsFinishedDownloadingAndInstalled(db, mWordListValues);
+
+ // Install the downloaded file by un-compressing and moving it to the staging
+ // directory. Ideally, we should do this before updating the DB, but the
+ // installDictToStagingFromContentProvider() relies on the db being updated.
+ final String localeString = mWordListValues.getAsString(MetadataDbHelper.LOCALE_COLUMN);
+ BinaryDictionaryFileDumper.installDictToStagingFromContentProvider(
+ LocaleUtils.constructLocaleFromString(localeString), context, false);
}
}
diff --git a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
index e61547a9d..6570171a6 100644
--- a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
+++ b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
@@ -592,6 +592,8 @@ public final class UpdateHandler {
* Warn Android Keyboard that the state of dictionaries changed and it should refresh its data.
*/
private static void signalNewDictionaryState(final Context context) {
+ // TODO: Also provide the locale of the updated dictionary so that the LatinIme
+ // does not have to reset if it is a different locale.
final Intent newDictBroadcast =
new Intent(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION);
context.sendBroadcast(newDictBroadcast);