aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/dictionarypack/MetadataHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack/MetadataHandler.java')
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/MetadataHandler.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/MetadataHandler.java b/java/src/com/android/inputmethod/dictionarypack/MetadataHandler.java
index d66b69050..329b9f62e 100644
--- a/java/src/com/android/inputmethod/dictionarypack/MetadataHandler.java
+++ b/java/src/com/android/inputmethod/dictionarypack/MetadataHandler.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.dictionarypack;
+import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
@@ -29,9 +30,6 @@ import java.util.List;
* Helper class to easy up manipulation of dictionary pack metadata.
*/
public class MetadataHandler {
- @SuppressWarnings("unused")
- private static final String TAG = "DictionaryProvider:" + MetadataHandler.class.getSimpleName();
-
// The canonical file name for metadata. This is not the name of a real file on the
// device, but a symbolic name used in the database and in metadata handling. It is never
// tested against, only used for human-readability as the file name for the metadata.
@@ -55,6 +53,7 @@ public class MetadataHandler {
final int rawChecksumIndex =
results.getColumnIndex(MetadataDbHelper.RAW_CHECKSUM_COLUMN);
final int checksumIndex = results.getColumnIndex(MetadataDbHelper.CHECKSUM_COLUMN);
+ final int retryCountIndex = results.getColumnIndex(MetadataDbHelper.RETRY_COUNT_COLUMN);
final int localFilenameIndex =
results.getColumnIndex(MetadataDbHelper.LOCAL_FILENAME_COLUMN);
final int remoteFilenameIndex =
@@ -70,6 +69,7 @@ public class MetadataHandler {
results.getLong(fileSizeIndex),
results.getString(rawChecksumIndex),
results.getString(checksumIndex),
+ results.getInt(retryCountIndex),
results.getString(localFilenameIndex),
results.getString(remoteFilenameIndex),
results.getInt(versionIndex),
@@ -102,6 +102,22 @@ public class MetadataHandler {
}
/**
+ * Gets the metadata, for a specific dictionary.
+ *
+ * @param context The context to open files over.
+ * @param clientId the client id for retrieving the database. null for default (deprecated).
+ * @param wordListId the word list ID.
+ * @param version the word list version.
+ * @return the current metaData
+ */
+ public static WordListMetadata getCurrentMetadataForWordList(final Context context,
+ final String clientId, final String wordListId, final int version) {
+ final ContentValues contentValues = MetadataDbHelper.getContentValuesByWordListId(
+ MetadataDbHelper.getDb(context, clientId), wordListId, version);
+ return WordListMetadata.createFromContentValues(contentValues);
+ }
+
+ /**
* Read metadata from a stream.
* @param input The stream to read from.
* @return The read metadata.