Fixed an issue with js files removal
This commit is contained in:
parent
7d808a38a9
commit
a1fbee1aa1
5 changed files with 8 additions and 6 deletions
|
@ -339,7 +339,7 @@ public class DownloadActivityType {
|
||||||
// fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) {
|
// fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) {
|
||||||
if (this == VOICE_FILE) {
|
if (this == VOICE_FILE) {
|
||||||
if (fileName.contains(".js")) {
|
if (fileName.contains(".js")) {
|
||||||
return fileName;
|
return fileName.replace('_', '-').replace('.', '-');
|
||||||
}
|
}
|
||||||
int l = fileName.lastIndexOf('_');
|
int l = fileName.lastIndexOf('_');
|
||||||
if (l == -1) {
|
if (l == -1) {
|
||||||
|
@ -413,7 +413,7 @@ public class DownloadActivityType {
|
||||||
if (l == -1) {
|
if (l == -1) {
|
||||||
l = fileName.length();
|
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) {
|
if (this == FONT_FILE) {
|
||||||
int l = fileName.indexOf('.');
|
int l = fileName.indexOf('.');
|
||||||
|
|
|
@ -141,7 +141,8 @@ public class IndexItem implements Comparable<IndexItem> {
|
||||||
basename = (FileNameTranslationHelper.HILL_SHADE + getBasename()).replace("_", " ");
|
basename = (FileNameTranslationHelper.HILL_SHADE + getBasename()).replace("_", " ");
|
||||||
} else if (type == DownloadActivityType.VOICE_FILE && getFileName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)){
|
} else if (type == DownloadActivityType.VOICE_FILE && getFileName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)){
|
||||||
return new File(type.getDownloadFolder(ctx, this),
|
return new File(type.getDownloadFolder(ctx, this),
|
||||||
getBasename().replaceAll("[_\\.]+", "-") + File.separator + getBasename());
|
getBasename().replaceAll("[_\\.]+", "-") + File.separator + getBasename().replaceFirst("-", "_")
|
||||||
|
.replace('-', '.'));
|
||||||
} else {
|
} else {
|
||||||
basename = getBasename();
|
basename = getBasename();
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,7 +403,7 @@ public class ItemViewHolder {
|
||||||
} else if (indexItem.getType() == DownloadActivityType.FONT_FILE) {
|
} else if (indexItem.getType() == DownloadActivityType.FONT_FILE) {
|
||||||
tp = LocalIndexType.FONT_DATA;
|
tp = LocalIndexType.FONT_DATA;
|
||||||
} else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
|
} 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
|
indexItem.getBasename().contains("tts") ? LocalIndexType.TTS_VOICE_DATA
|
||||||
: LocalIndexType.VOICE_DATA;
|
: LocalIndexType.VOICE_DATA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,7 +396,7 @@ public class ResourceManager {
|
||||||
String lang = f.getName().replace("-tts-js", "");
|
String lang = f.getName().replace("-tts-js", "");
|
||||||
File jsConf = new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS);
|
File jsConf = new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS);
|
||||||
if (jsConf.exists()) {
|
if (jsConf.exists()) {
|
||||||
indexFileNames.put(jsConf.getName(), dateFormat.format(jsConf.lastModified()));
|
indexFileNames.put(f.getName(), dateFormat.format(jsConf.lastModified()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,8 @@ public class RoutingHelper {
|
||||||
public RoutingHelper(OsmandApplication context){
|
public RoutingHelper(OsmandApplication context){
|
||||||
this.app = context;
|
this.app = context;
|
||||||
settings = context.getSettings();
|
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);
|
: new VoiceRouter(this, settings);
|
||||||
provider = new RouteProvider();
|
provider = new RouteProvider();
|
||||||
setAppMode(settings.APPLICATION_MODE.get());
|
setAppMode(settings.APPLICATION_MODE.get());
|
||||||
|
|
Loading…
Reference in a new issue