Merge pull request #5829 from osmandapp/js_voice_routing

Added Japanese js file, ogg files are now automatically downloaded on…
This commit is contained in:
PaulStets 2018-08-11 10:34:36 +03:00 committed by GitHub
commit f7ae5b6eaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -64,7 +64,7 @@
<asset source="voice/hu/hu_tts.js" destination="voice/hu-tts/hu_tts.js" mode="overwriteOnlyIfExists" />
<!--<asset source="voice/hu-formal/hu-formal_tts.js" destination="voice/hu_formal-tts/hu-formal_tts.js" mode="overwriteOnlyIfExists" />-->
<asset source="voice/it/it_tts.js" destination="voice/it-tts/it_tts.js" mode="alwaysOverwriteOrCopy" />
<!--<asset source="voice/ja/ja_tts.js" destination="voice/ja-tts/ja_tts.js" mode="alwaysOverwriteOrCopy" />-->
<asset source="voice/ja/ja_tts.js" destination="voice/ja-tts/ja_tts.js" mode="alwaysOverwriteOrCopy" />
<!--<asset source="voice/ko/ko_tts.js" destination="voice/ko-tts/ko_tts.js" mode="overwriteOnlyIfExists" />-->
<!--<asset source="voice/lv/lv_tts.js" destination="voice/lv-tts/lv_tts.js" mode="overwriteOnlyIfExists" />-->
<asset source="voice/nl/nl_tts.js" destination="voice/nl-tts/nl_tts.js" mode="alwaysOverwriteOrCopy" />

View file

@ -428,8 +428,15 @@ public class ResourceManager {
if (appPath.canWrite()) {
for (Map.Entry<String,String> entry : mapping.entrySet()) {
File jsFile = new File(appPath, entry.getValue());
if (entry.getValue().contains("-tts") && entry.getValue()
.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) {
File oggFile = new File(appPath, entry.getValue().replace("-tts", ""));
if (oggFile.getParentFile().exists() && !oggFile.exists()) {
copyAssets(context.getAssets(), entry.getKey(), oggFile);
}
}
if (jsFile.getParentFile().exists() && !jsFile.exists()) {
ResourceManager.copyAssets(context.getAssets(), entry.getKey(), jsFile);
copyAssets(context.getAssets(), entry.getKey(), jsFile);
}
}
}