mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-25 00:56:35 +00:00
provide the correct dictionary name (used for debugging only)
This commit is contained in:
parent
9abcd15c5f
commit
c78e729daa
1 changed files with 8 additions and 6 deletions
|
@ -23,6 +23,7 @@ import android.os.Looper;
|
|||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.makedict.DictionaryHeader;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.DictionaryInfoUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -45,11 +46,6 @@ public final class DictionaryFactory {
|
|||
* @param locale the locale for which to create the dictionary
|
||||
* @return an initialized instance of DictionaryCollection
|
||||
*/
|
||||
// todo: this should be adjusted
|
||||
// ONE call to getDictionaryFiles
|
||||
// should return AssetFileAddress and locale (and maybe match level)
|
||||
// this should consider the he/iw mess-up
|
||||
// only if compressed dict needs to be used it should be extracted
|
||||
public static DictionaryCollection createMainDictionaryFromManager(final Context context,
|
||||
final Locale locale) {
|
||||
if (null == locale) {
|
||||
|
@ -73,9 +69,15 @@ public final class DictionaryFactory {
|
|||
assetFileList = BinaryDictionaryGetter.getDictionaryFiles(locale, context, true);
|
||||
|
||||
for (final AssetFileAddress f : assetFileList) {
|
||||
final DictionaryHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull(new File(f.mFilename), f.mOffset, f.mLength);
|
||||
String dictType = Dictionary.TYPE_MAIN;
|
||||
if (header != null) {
|
||||
// make sure the suggested words dictionary has the correct type
|
||||
dictType = header.mIdString.split(":")[0];
|
||||
}
|
||||
final ReadOnlyBinaryDictionary readOnlyBinaryDictionary =
|
||||
new ReadOnlyBinaryDictionary(f.mFilename, f.mOffset, f.mLength,
|
||||
false /* useFullEditDistance */, locale, Dictionary.TYPE_MAIN);
|
||||
false /* useFullEditDistance */, locale, dictType);
|
||||
if (readOnlyBinaryDictionary.isValidDictionary()) {
|
||||
dictList.add(readOnlyBinaryDictionary);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue