mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 0f3c05cd
: Merge "Send the dictionaries descriptions to the dict pack"
* commit '0f3c05cd6bee664e5ccaf632c35c34017eb1c5e9': Send the dictionaries descriptions to the dict pack
This commit is contained in:
commit
6b909d38f3
@ -49,17 +49,20 @@ public class DictionaryInfoUtils {
|
||||
private static final String LOCALE_COLUMN = "locale";
|
||||
private static final String WORDLISTID_COLUMN = "id";
|
||||
private static final String LOCAL_FILENAME_COLUMN = "filename";
|
||||
private static final String DESCRIPTION_COLUMN = "description";
|
||||
private static final String DATE_COLUMN = "date";
|
||||
private static final String FILESIZE_COLUMN = "filesize";
|
||||
private static final String VERSION_COLUMN = "version";
|
||||
public final String mId;
|
||||
public final Locale mLocale;
|
||||
public final String mDescription;
|
||||
public final AssetFileAddress mFileAddress;
|
||||
public final int mVersion;
|
||||
public final String mId;
|
||||
public DictionaryInfo(final String id, final Locale locale,
|
||||
public DictionaryInfo(final String id, final Locale locale, final String description,
|
||||
final AssetFileAddress fileAddress, final int version) {
|
||||
mId = id;
|
||||
mLocale = locale;
|
||||
mDescription = description;
|
||||
mFileAddress = fileAddress;
|
||||
mVersion = version;
|
||||
}
|
||||
@ -67,6 +70,7 @@ public class DictionaryInfoUtils {
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(WORDLISTID_COLUMN, mId);
|
||||
values.put(LOCALE_COLUMN, mLocale.toString());
|
||||
values.put(DESCRIPTION_COLUMN, mDescription);
|
||||
values.put(LOCAL_FILENAME_COLUMN, mFileAddress.mFilename);
|
||||
values.put(DATE_COLUMN,
|
||||
new File(mFileAddress.mFilename).lastModified() / DateUtils.SECOND_IN_MILLIS);
|
||||
@ -283,8 +287,9 @@ public class DictionaryInfoUtils {
|
||||
new File(fileAddress.mFilename), fileAddress.mOffset, fileAddress.mLength);
|
||||
final String id = header.getId();
|
||||
final Locale locale = LocaleUtils.constructLocaleFromString(header.getLocaleString());
|
||||
final String description = header.getDescription();
|
||||
final String version = header.getVersion();
|
||||
return new DictionaryInfo(id, locale, fileAddress, Integer.parseInt(version));
|
||||
return new DictionaryInfo(id, locale, description, fileAddress, Integer.parseInt(version));
|
||||
}
|
||||
|
||||
private static void addOrUpdateDictInfo(final ArrayList<DictionaryInfo> dictList,
|
||||
|
@ -259,6 +259,7 @@ public final class FormatSpec {
|
||||
private static final String DICTIONARY_VERSION_ATTRIBUTE = "version";
|
||||
private static final String DICTIONARY_LOCALE_ATTRIBUTE = "locale";
|
||||
private static final String DICTIONARY_ID_ATTRIBUTE = "dictionary";
|
||||
private static final String DICTIONARY_DESCRIPTION_ATTRIBUTE = "description";
|
||||
public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions,
|
||||
final FormatOptions formatOptions) {
|
||||
mHeaderSize = headerSize;
|
||||
@ -280,6 +281,13 @@ public final class FormatSpec {
|
||||
public String getId() {
|
||||
return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_ID_ATTRIBUTE);
|
||||
}
|
||||
|
||||
// Helper method to get the description
|
||||
public String getDescription() {
|
||||
// TODO: Right now each dictionary file comes with a description in its own language.
|
||||
// It will display as is no matter the device's locale. It should be internationalized.
|
||||
return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_DESCRIPTION_ATTRIBUTE);
|
||||
}
|
||||
}
|
||||
|
||||
private FormatSpec() {
|
||||
|
Loading…
Reference in New Issue
Block a user