Loading java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +2 −2 Original line number Diff line number Diff line Loading @@ -22,8 +22,8 @@ import android.content.res.AssetFileDescriptor; import android.util.Log; import com.android.inputmethod.latin.makedict.DictDecoder; import com.android.inputmethod.latin.makedict.DictionaryHeader; import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.UnsupportedFormatException; import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.DictionaryInfoUtils; Loading Loading @@ -230,7 +230,7 @@ final public class BinaryDictionaryGetter { try { // Read the version of the file final DictDecoder dictDecoder = FormatSpec.getDictDecoder(f); final FileHeader header = dictDecoder.readHeader(); final DictionaryHeader header = dictDecoder.readHeader(); final String version = header.mDictionaryOptions.mAttributes.get(VERSION_KEY); if (null == version) { Loading java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +4 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.latin.makedict.DictionaryHeader; import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.utils.AsyncResultHolder; Loading Loading @@ -268,9 +269,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { protected Map<String, String> getHeaderAttributeMap() { HashMap<String, String> attributeMap = new HashMap<String, String>(); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_KEY, attributeMap.put(DictionaryHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(DictionaryHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(DictionaryHeader.DICTIONARY_VERSION_KEY, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); return attributeMap; } Loading java/src/com/android/inputmethod/latin/debug/ExternalDictionaryGetterForDebug.java +4 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import android.os.Environment; import com.android.inputmethod.latin.BinaryDictionaryFileDumper; import com.android.inputmethod.latin.BinaryDictionaryGetter; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.DictionaryHeader; import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.DictionaryInfoUtils; import com.android.inputmethod.latin.utils.LocaleUtils; Loading @@ -51,7 +51,7 @@ public class ExternalDictionaryGetterForDebug { final File[] files = new File(SOURCE_FOLDER).listFiles(); final ArrayList<String> eligibleList = CollectionUtils.newArrayList(); for (File f : files) { final FileHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(f); final DictionaryHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(f); if (null == header) continue; eligibleList.add(f.getName()); } Loading Loading @@ -99,7 +99,7 @@ public class ExternalDictionaryGetterForDebug { public static void askInstallFile(final Context context, final String dirPath, final String fileName, final Runnable completeRunnable) { final File file = new File(dirPath, fileName.toString()); final FileHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(file); final DictionaryHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(file); final StringBuilder message = new StringBuilder(); final String locale = header.getLocaleString(); for (String key : header.mDictionaryOptions.mAttributes.keySet()) { Loading Loading @@ -143,7 +143,7 @@ public class ExternalDictionaryGetterForDebug { } private static void installFile(final Context context, final File file, final FileHeader header) { final DictionaryHeader header) { BufferedOutputStream outputStream = null; File tempFile = null; try { Loading java/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java +4 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.CharEncoding; import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString; Loading @@ -36,7 +35,7 @@ public abstract class AbstractDictDecoder implements DictDecoder { private static final int ERROR_CANNOT_READ = 1; private static final int ERROR_WRONG_FORMAT = 2; protected FileHeader readHeader(final DictBuffer headerBuffer) protected DictionaryHeader readHeader(final DictBuffer headerBuffer) throws IOException, UnsupportedFormatException { if (headerBuffer == null) { openDictBuffer(); Loading @@ -57,10 +56,10 @@ public abstract class AbstractDictDecoder implements DictDecoder { final HashMap<String, String> attributes = HeaderReader.readAttributes(headerBuffer, headerSize); final FileHeader header = new FileHeader(headerSize, final DictionaryHeader header = new DictionaryHeader(headerSize, new FusionDictionary.DictionaryOptions(attributes), new FormatOptions(version, FileHeader.ATTRIBUTE_VALUE_TRUE.equals( attributes.get(FileHeader.HAS_HISTORICAL_INFO_KEY)))); new FormatOptions(version, DictionaryHeader.ATTRIBUTE_VALUE_TRUE.equals( attributes.get(DictionaryHeader.HAS_HISTORICAL_INFO_KEY)))); return header; } Loading java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java +1 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary.PtNode; import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray; Loading Loading @@ -598,7 +597,7 @@ public final class BinaryDictDecoderUtils { /* package */ static FusionDictionary readDictionaryBinary(final DictDecoder dictDecoder, final FusionDictionary dict) throws IOException, UnsupportedFormatException { // Read header final FileHeader fileHeader = dictDecoder.readHeader(); final DictionaryHeader fileHeader = dictDecoder.readHeader(); Map<Integer, PtNodeArray> reverseNodeArrayMapping = new TreeMap<Integer, PtNodeArray>(); Map<Integer, PtNode> reversePtNodeMapping = new TreeMap<Integer, PtNode>(); Loading Loading
java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +2 −2 Original line number Diff line number Diff line Loading @@ -22,8 +22,8 @@ import android.content.res.AssetFileDescriptor; import android.util.Log; import com.android.inputmethod.latin.makedict.DictDecoder; import com.android.inputmethod.latin.makedict.DictionaryHeader; import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.UnsupportedFormatException; import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.DictionaryInfoUtils; Loading Loading @@ -230,7 +230,7 @@ final public class BinaryDictionaryGetter { try { // Read the version of the file final DictDecoder dictDecoder = FormatSpec.getDictDecoder(f); final FileHeader header = dictDecoder.readHeader(); final DictionaryHeader header = dictDecoder.readHeader(); final String version = header.mDictionaryOptions.mAttributes.get(VERSION_KEY); if (null == version) { Loading
java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +4 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.latin.makedict.DictionaryHeader; import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.utils.AsyncResultHolder; Loading Loading @@ -268,9 +269,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { protected Map<String, String> getHeaderAttributeMap() { HashMap<String, String> attributeMap = new HashMap<String, String>(); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_KEY, attributeMap.put(DictionaryHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(DictionaryHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(DictionaryHeader.DICTIONARY_VERSION_KEY, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); return attributeMap; } Loading
java/src/com/android/inputmethod/latin/debug/ExternalDictionaryGetterForDebug.java +4 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import android.os.Environment; import com.android.inputmethod.latin.BinaryDictionaryFileDumper; import com.android.inputmethod.latin.BinaryDictionaryGetter; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.DictionaryHeader; import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.DictionaryInfoUtils; import com.android.inputmethod.latin.utils.LocaleUtils; Loading @@ -51,7 +51,7 @@ public class ExternalDictionaryGetterForDebug { final File[] files = new File(SOURCE_FOLDER).listFiles(); final ArrayList<String> eligibleList = CollectionUtils.newArrayList(); for (File f : files) { final FileHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(f); final DictionaryHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(f); if (null == header) continue; eligibleList.add(f.getName()); } Loading Loading @@ -99,7 +99,7 @@ public class ExternalDictionaryGetterForDebug { public static void askInstallFile(final Context context, final String dirPath, final String fileName, final Runnable completeRunnable) { final File file = new File(dirPath, fileName.toString()); final FileHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(file); final DictionaryHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(file); final StringBuilder message = new StringBuilder(); final String locale = header.getLocaleString(); for (String key : header.mDictionaryOptions.mAttributes.keySet()) { Loading Loading @@ -143,7 +143,7 @@ public class ExternalDictionaryGetterForDebug { } private static void installFile(final Context context, final File file, final FileHeader header) { final DictionaryHeader header) { BufferedOutputStream outputStream = null; File tempFile = null; try { Loading
java/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java +4 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.CharEncoding; import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString; Loading @@ -36,7 +35,7 @@ public abstract class AbstractDictDecoder implements DictDecoder { private static final int ERROR_CANNOT_READ = 1; private static final int ERROR_WRONG_FORMAT = 2; protected FileHeader readHeader(final DictBuffer headerBuffer) protected DictionaryHeader readHeader(final DictBuffer headerBuffer) throws IOException, UnsupportedFormatException { if (headerBuffer == null) { openDictBuffer(); Loading @@ -57,10 +56,10 @@ public abstract class AbstractDictDecoder implements DictDecoder { final HashMap<String, String> attributes = HeaderReader.readAttributes(headerBuffer, headerSize); final FileHeader header = new FileHeader(headerSize, final DictionaryHeader header = new DictionaryHeader(headerSize, new FusionDictionary.DictionaryOptions(attributes), new FormatOptions(version, FileHeader.ATTRIBUTE_VALUE_TRUE.equals( attributes.get(FileHeader.HAS_HISTORICAL_INFO_KEY)))); new FormatOptions(version, DictionaryHeader.ATTRIBUTE_VALUE_TRUE.equals( attributes.get(DictionaryHeader.HAS_HISTORICAL_INFO_KEY)))); return header; } Loading
java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java +1 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary.PtNode; import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray; Loading Loading @@ -598,7 +597,7 @@ public final class BinaryDictDecoderUtils { /* package */ static FusionDictionary readDictionaryBinary(final DictDecoder dictDecoder, final FusionDictionary dict) throws IOException, UnsupportedFormatException { // Read header final FileHeader fileHeader = dictDecoder.readHeader(); final DictionaryHeader fileHeader = dictDecoder.readHeader(); Map<Integer, PtNodeArray> reverseNodeArrayMapping = new TreeMap<Integer, PtNodeArray>(); Map<Integer, PtNode> reversePtNodeMapping = new TreeMap<Integer, PtNode>(); Loading