diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java index 71d7a9a410..2acb463ffa 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java @@ -339,7 +339,7 @@ public class DownloadActivityType { // fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) { if (this == VOICE_FILE) { if (fileName.contains(".js")) { - return fileName; + return fileName.replace('_', '-').replace('.', '-'); } int l = fileName.lastIndexOf('_'); if (l == -1) { @@ -413,7 +413,7 @@ public class DownloadActivityType { if (l == -1) { l = fileName.length(); } - return fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS) ? fileName : fileName.substring(0, l); + return fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS) ? fileName.replace('_', '-').replace('.', '-') : fileName.substring(0, l); } if (this == FONT_FILE) { int l = fileName.indexOf('.'); diff --git a/OsmAnd/src/net/osmand/plus/download/IndexItem.java b/OsmAnd/src/net/osmand/plus/download/IndexItem.java index 06529dc6f0..0c43ca4cb8 100644 --- a/OsmAnd/src/net/osmand/plus/download/IndexItem.java +++ b/OsmAnd/src/net/osmand/plus/download/IndexItem.java @@ -141,7 +141,8 @@ public class IndexItem implements Comparable { basename = (FileNameTranslationHelper.HILL_SHADE + getBasename()).replace("_", " "); } else if (type == DownloadActivityType.VOICE_FILE && getFileName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)){ return new File(type.getDownloadFolder(ctx, this), - getBasename().replaceAll("[_\\.]+", "-") + File.separator + getBasename()); + getBasename().replaceAll("[_\\.]+", "-") + File.separator + getBasename().replaceFirst("-", "_") + .replace('-', '.')); } else { basename = getBasename(); } diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java index 2db69a358c..190ede5b32 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java @@ -403,7 +403,7 @@ public class ItemViewHolder { } else if (indexItem.getType() == DownloadActivityType.FONT_FILE) { tp = LocalIndexType.FONT_DATA; } else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) { - tp = indexItem.getFileName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS) ? LocalIndexType.TTS_VOICE_DATA_JS : + tp = indexItem.getFileName().contains("-tts-js") ? LocalIndexType.TTS_VOICE_DATA_JS : indexItem.getBasename().contains("tts") ? LocalIndexType.TTS_VOICE_DATA : LocalIndexType.VOICE_DATA; } diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index e3ca184e2f..9798f4100b 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -396,7 +396,7 @@ public class ResourceManager { String lang = f.getName().replace("-tts-js", ""); File jsConf = new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS); if (jsConf.exists()) { - indexFileNames.put(jsConf.getName(), dateFormat.format(jsConf.lastModified())); + indexFileNames.put(f.getName(), dateFormat.format(jsConf.lastModified())); } } } diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index c34f97f44b..9c103353d3 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -97,7 +97,8 @@ public class RoutingHelper { public RoutingHelper(OsmandApplication context){ this.app = context; settings = context.getSettings(); - voiceRouter = settings.USE_JS_VOICE_GUIDANCE.get() ?new JSVoiceRouter(this, settings) + boolean useJS = settings.VOICE_PROVIDER.get().contains("-js"); + voiceRouter = useJS ? new JSVoiceRouter(this, settings) : new VoiceRouter(this, settings); provider = new RouteProvider(); setAppMode(settings.APPLICATION_MODE.get());