diff --git a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java index 31ac655f06..3e4cd5af55 100644 --- a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java +++ b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java @@ -78,5 +78,5 @@ public class IndexConstants { public static final String ROUTING_PROFILES_DIR = "routing/"; public static final String PLUGINS_DIR = "plugins/"; - public static final String TTS_DIR_SUFFIX = "-tts"; + public static final String VOICE_PROVIDER_SUFFIX = "-tts"; } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 7e0aadfa3b..3355d67a32 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -138,10 +138,10 @@ public class DownloadIndexesThread { String setTts = null; for (String s : OsmandSettings.TTS_AVAILABLE_VOICES) { if (lng.startsWith(s)) { - setTts = s + "-tts"; + setTts = s + IndexConstants.VOICE_PROVIDER_SUFFIX; break; } else if (lng.contains("," + s)) { - setTts = s + "-tts"; + setTts = s + IndexConstants.VOICE_PROVIDER_SUFFIX; } } if (setTts != null) { @@ -544,7 +544,7 @@ public class DownloadIndexesThread { // validate enough space if (asz != -1 && cs > asz) { String breakDownloadMessage = app.getString(R.string.download_files_not_enough_space, - cs, asz); + String.valueOf(cs), String.valueOf(asz)); publishProgress(breakDownloadMessage); return false; } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java index 47b3015d56..f6381b3552 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java @@ -8,9 +8,7 @@ import java.net.URLConnection; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.zip.GZIPInputStream; import net.osmand.AndroidUtils; @@ -159,10 +157,13 @@ public class DownloadOsmandIndexesHelper { List mapping = getBundledAssets(amanager); for (AssetEntry asset : mapping) { String target = asset.destination; - if (target.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS) && target.startsWith("voice/") && target.contains("-tts")) { - String lang = target.substring("voice/".length(), target.indexOf("-tts")); - File destFile = new File(voicePath, target.substring("voice/".length(), - target.indexOf("/", "voice/".length())) + "/" + lang + "_tts.js"); + if (target.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS) + && target.startsWith(IndexConstants.VOICE_INDEX_DIR) + && target.contains(IndexConstants.VOICE_PROVIDER_SUFFIX)) { + String lang = target.substring(IndexConstants.VOICE_INDEX_DIR.length(), + target.indexOf(IndexConstants.VOICE_PROVIDER_SUFFIX)); + File destFile = new File(voicePath, target.substring(IndexConstants.VOICE_INDEX_DIR.length(), + target.indexOf("/", IndexConstants.VOICE_INDEX_DIR.length())) + "/" + lang + "_tts.js"); result.add(new AssetIndexItem(lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS, "voice", date, dateModified, "0.1", destFile.length(), asset.source, destFile.getPath(), DownloadActivityType.VOICE_FILE)); diff --git a/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java b/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java index 539eceb622..229003050e 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java @@ -85,10 +85,10 @@ public class FileNameTranslationHelper { public static String getVoiceName(Context ctx, String fileName) { try { String nm = fileName.replace('-', '_').replace(' ', '_'); - if (nm.endsWith("_tts") || nm.endsWith("-tts")) { + if (nm.endsWith("_tts") || nm.endsWith(IndexConstants.VOICE_PROVIDER_SUFFIX)) { nm = nm.substring(0, nm.length() - 4); } - Field f = R.string.class.getField("lang_"+nm); + Field f = R.string.class.getField("lang_" + nm); if (f != null) { Integer in = (Integer) f.get(null); return ctx.getString(in); diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index ae123b2c8b..a87d5004bd 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -413,7 +413,7 @@ public class ResourceManager { java.text.DateFormat dateFormat = getDateFormat(); for (File f : lf) { if (f.isDirectory()) { - String lang = f.getName().replace("-tts", ""); + String lang = f.getName().replace(IndexConstants.VOICE_PROVIDER_SUFFIX, ""); File conf = new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS); if (!conf.exists()) { conf = new File(f, "_config.p"); @@ -454,9 +454,10 @@ public class ResourceManager { if (appPath.canWrite()) { for (AssetEntry asset : assets) { File jsFile = new File(appPath, asset.destination); - if (asset.destination.contains("-tts") && asset.destination + if (asset.destination.contains(IndexConstants.VOICE_PROVIDER_SUFFIX) && asset.destination .endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) { - File oggFile = new File(appPath, asset.destination.replace("-tts", "")); + File oggFile = new File(appPath, asset.destination.replace( + IndexConstants.VOICE_PROVIDER_SUFFIX, "")); if (oggFile.getParentFile().exists() && !oggFile.exists()) { copyAssets(context.getAssets(), asset.source, oggFile); } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 4c91964f0d..bcc7a4c170 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -2543,7 +2543,7 @@ public class OsmandSettings { Configuration config = ctx.getResources().getConfiguration(); for (String lang : TTS_AVAILABLE_VOICES) { if (lang.equals(config.locale.getLanguage())) { - return lang + "-tts"; + return lang + IndexConstants.VOICE_PROVIDER_SUFFIX; } } return "en-tts"; diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/DataSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/DataSettingsItem.java index d68325fe5f..75529aa543 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/DataSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/DataSettingsItem.java @@ -64,7 +64,7 @@ public class DataSettingsItem extends StreamSettingsItem { SettingsItemReader getReader() { return new StreamSettingsItemReader(this) { @Override - public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException { + public void readFromStream(@NonNull InputStream inputStream, File destination) throws IOException, IllegalArgumentException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead; byte[] data = new byte[SettingsHelper.BUFFER]; diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java index 8e8c4c6f36..a035ae0146 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java @@ -16,6 +16,7 @@ import net.osmand.plus.R; import org.json.JSONException; import org.json.JSONObject; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -145,7 +146,7 @@ public class FavoritesSettingsItem extends CollectionSettingsItem return new SettingsItemReader(this) { @Override - public void readFromStream(@NonNull InputStream inputStream) throws IllegalArgumentException { + public void readFromStream(@NonNull InputStream inputStream, File destination) throws IllegalArgumentException { GPXFile gpxFile = GPXUtilities.loadGPXFile(inputStream); if (gpxFile.error != null) { warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType()))); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FileSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FileSettingsItem.java index 4ea7265310..3b4f8568e1 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FileSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FileSettingsItem.java @@ -18,6 +18,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.zip.ZipOutputStream; public class FileSettingsItem extends StreamSettingsItem { @@ -100,7 +101,7 @@ public class FileSettingsItem extends StreamSettingsItem { } break; case TTS_VOICE: - if (name.startsWith(subtype.subtypeFolder) && name.endsWith(IndexConstants.TTS_DIR_SUFFIX)) { + if (name.startsWith(subtype.subtypeFolder) && name.endsWith(IndexConstants.VOICE_PROVIDER_SUFFIX)) { return subtype; } break; @@ -244,9 +245,8 @@ public class FileSettingsItem extends StreamSettingsItem { SettingsItemReader getReader() { return new StreamSettingsItemReader(this) { @Override - public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException { + public void readFromStream(@NonNull InputStream inputStream, File dest) throws IOException, IllegalArgumentException { OutputStream output; - File dest = getDestination(); if (dest.exists() && !shouldReplace) { dest = renameFile(dest); } @@ -279,6 +279,38 @@ public class FileSettingsItem extends StreamSettingsItem { warnings.add(app.getString(R.string.settings_item_read_error, file.getName())); SettingsHelper.LOG.error("Failed to set input stream from file: " + file.getName(), e); } - return super.getWriter(); + return new StreamSettingsItemWriter(this) { + + @Override + public void writeEntry(String fileName, @NonNull ZipOutputStream zos) throws IOException { + if (getSubtype().isDirectory()) { + File file = getFile(); + zipDirsWithFiles(file, zos); + } else { + super.writeEntry(fileName, zos); + } + } + + public void zipDirsWithFiles(File f, ZipOutputStream zos) + throws IOException { + if (f == null) { + return; + } + if (f.isDirectory()) { + File[] fs = f.listFiles(); + if (fs != null) { + for (File c : fs) { + zipDirsWithFiles(c, zos); + } + } + } else { + String zipEntryName = Algorithms.isEmpty(getSubtype().getSubtypeFolder()) + ? f.getName() + : f.getPath().substring(f.getPath().indexOf(getSubtype().getSubtypeFolder()) - 1); + setInputStream(new FileInputStream(f)); + super.writeEntry(zipEntryName, zos); + } + } + }; } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmandSettingsItemReader.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmandSettingsItemReader.java index 0267e69471..df68e8a3e3 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmandSettingsItemReader.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmandSettingsItemReader.java @@ -10,6 +10,7 @@ import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -29,7 +30,7 @@ public abstract class OsmandSettingsItemReader ext @NonNull JSONObject json) throws JSONException; @Override - public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException { + public void readFromStream(@NonNull InputStream inputStream, File destination) throws IOException, IllegalArgumentException { StringBuilder buf = new StringBuilder(); try { BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsExporter.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsExporter.java index 88b7851630..3a697b77c0 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsExporter.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsExporter.java @@ -8,7 +8,6 @@ import org.json.JSONObject; import java.io.BufferedOutputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -68,43 +67,11 @@ class SettingsExporter { if (Algorithms.isEmpty(fileName)) { fileName = item.getDefaultFileName(); } - if (item instanceof FileSettingsItem && ((FileSettingsItem) item).getSubtype().isDirectory()) { - File file = ((FileSettingsItem) item).getFile(); - zipDirsWithFiles(file, writer, zos); - } else { - ZipEntry entry = new ZipEntry(fileName); - zos.putNextEntry(entry); - writer.writeToStream(zos); - zos.closeEntry(); - } + writer.writeEntry(fileName, zos); } } } - public void zipDirsWithFiles(File f, SettingsItemWriter writer, ZipOutputStream zos) - throws IOException { - if (f == null) { - return; - } - if (f.isDirectory()) { - File[] fs = f.listFiles(); - if (fs != null) { - for (File c : fs) { - zipDirsWithFiles(c, writer, zos); - } - } - } else { - FileSettingsItem item = (FileSettingsItem) writer.getItem(); - String zipEntryName = Algorithms.isEmpty(item.getSubtype().getSubtypeFolder()) - ? f.getName() - : f.getPath().substring(f.getPath().indexOf(item.getSubtype().getSubtypeFolder()) - 1); - ZipEntry entry = new ZipEntry(zipEntryName); - zos.putNextEntry(entry); - item.setInputStream(new FileInputStream(f)); - writer.writeToStream(zos); - zos.closeEntry(); - } - } private JSONObject createItemsJson() throws JSONException { JSONObject json = new JSONObject(); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java index d198c81502..f3821505a2 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -533,20 +533,22 @@ public class SettingsHelper { dataList.put(ExportSettingsType.OSM_EDITS, editsPointList); } } - List files = getLocalMapFiles(); - if (!files.isEmpty()) { - dataList.put(ExportSettingsType.OFFLINE_MAPS, files); - } List favoriteGroups = app.getFavorites().getFavoriteGroups(); if (!favoriteGroups.isEmpty()) { dataList.put(ExportSettingsType.FAVORITES, favoriteGroups); } - List localVoiceFileList = getVoiceIndexInfo(); - files = getFilesByType(localVoiceFileList, LocalIndexType.TTS_VOICE_DATA); + List localIndexInfoList = getVoiceIndexInfo(); + List files; + files = getFilesByType(localIndexInfoList, LocalIndexType.MAP_DATA, LocalIndexType.TILES_DATA, + LocalIndexType.SRTM_DATA, LocalIndexType.WIKI_DATA); + if (!files.isEmpty()) { + dataList.put(ExportSettingsType.OFFLINE_MAPS, files); + } + files = getFilesByType(localIndexInfoList, LocalIndexType.TTS_VOICE_DATA); if (!files.isEmpty()) { dataList.put(ExportSettingsType.TTS_VOICE, files); } - files = getFilesByType(localVoiceFileList, LocalIndexType.VOICE_DATA); + files = getFilesByType(localIndexInfoList, LocalIndexType.VOICE_DATA); if (!files.isEmpty()) { dataList.put(ExportSettingsType.VOICE, files); } @@ -554,40 +556,25 @@ public class SettingsHelper { } private List getVoiceIndexInfo() { - LocalIndexHelper helper = new LocalIndexHelper(app); - List localVoiceInfoList = new ArrayList<>(); - helper.loadVoiceData(app.getAppPath(IndexConstants.VOICE_INDEX_DIR), localVoiceInfoList, false, - new AbstractLoadLocalIndexTask() { - @Override - public void loadFile(LocalIndexInfo... loaded) { - } - }); - return localVoiceInfoList; - } - - private List getFilesByType(List localVoiceFileList, LocalIndexType localIndexType) { - List files = new ArrayList<>(); - for (LocalIndexInfo map : localVoiceFileList) { - File file = new File(map.getPathToData()); - if (file.exists() && map.getType() == localIndexType) { - files.add(file); - } - } - return files; - } - - private List getLocalMapFiles() { - List files = new ArrayList<>(); - LocalIndexHelper helper = new LocalIndexHelper(app); - List localMapFileList = helper.getLocalIndexData(new AbstractLoadLocalIndexTask() { + return new LocalIndexHelper(app).getLocalIndexData(new AbstractLoadLocalIndexTask() { @Override public void loadFile(LocalIndexInfo... loaded) { } }); - for (LocalIndexInfo map : localMapFileList) { + } + + private List getFilesByType(List localVoiceFileList, LocalIndexType... localIndexType) { + List files = new ArrayList<>(); + for (LocalIndexInfo map : localVoiceFileList) { File file = new File(map.getPathToData()); - if (file.exists() && map.getType() != LocalIndexType.TTS_VOICE_DATA - && map.getType() != LocalIndexType.VOICE_DATA) { + boolean filtered = false; + for (LocalIndexType type : localIndexType) { + if (map.getType() == type) { + filtered = true; + break; + } + } + if (file.exists() && filtered) { files.add(file); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java index f1a6f2d894..fcc1fba2f7 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java @@ -124,8 +124,7 @@ class SettingsImporter { try { SettingsItemReader reader = item.getReader(); if (reader != null) { - reader.setDestination(app.getAppPath(fileName)); - reader.readFromStream(ois); + reader.readFromStream(ois, app.getAppPath(fileName)); } } catch (IllegalArgumentException e) { item.warnings.add(app.getString(R.string.settings_item_read_error, item.getName())); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java index 75c5ba6500..815710b94c 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java @@ -169,7 +169,7 @@ public abstract class SettingsItem { SettingsItemReader getJsonReader() { return new SettingsItemReader(this) { @Override - public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException { + public void readFromStream(@NonNull InputStream inputStream, File destination) throws IOException, IllegalArgumentException { StringBuilder buf = new StringBuilder(); try { BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemReader.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemReader.java index 5269150adc..2e38e04f08 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemReader.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemReader.java @@ -10,19 +10,9 @@ public abstract class SettingsItemReader { private T item; - File destination; - public SettingsItemReader(@NonNull T item) { this.item = item; } - public void setDestination(File destination) { - this.destination = destination; - } - - public File getDestination() { - return destination; - } - - public abstract void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException; + public abstract void readFromStream(@NonNull InputStream inputStream, File destination) throws IOException, IllegalArgumentException; } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java index 9e3cf61377..090767a493 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java @@ -4,6 +4,8 @@ import androidx.annotation.NonNull; import java.io.IOException; import java.io.OutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; public abstract class SettingsItemWriter { @@ -18,4 +20,11 @@ public abstract class SettingsItemWriter { } public abstract boolean writeToStream(@NonNull OutputStream outputStream) throws IOException; + + public void writeEntry(String fileName, @NonNull ZipOutputStream zos) throws IOException { + ZipEntry entry = new ZipEntry(fileName); + zos.putNextEntry(entry); + writeToStream(zos); + zos.closeEntry(); + } } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java index 01391b89e6..6affe49e6d 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java @@ -368,8 +368,12 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter { for (Object item : listItems) { if (data.contains(item)) { amount++; - if (type == OFFLINE_MAPS && item instanceof FileSettingsItem) { - amountSize += ((FileSettingsItem) item).getSize(); + if (type == OFFLINE_MAPS) { + if (item instanceof FileSettingsItem) { + amountSize += ((FileSettingsItem) item).getSize(); + } else { + amountSize += ((File) item).length(); + } } } } @@ -403,9 +407,9 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter { case OSM_NOTES: return R.string.osm_notes; case OSM_EDITS: - return R.string.osm_edit_modified_poi; + return R.string.osm_edits; case OFFLINE_MAPS: - return R.string.shared_string_local_maps; + return R.string.shared_string_maps; case FAVORITES: return R.string.shared_string_favorites; case TTS_VOICE: diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java index 4c86a45a85..0d621b6b50 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java @@ -295,7 +295,7 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet { progress.dismiss(); } progress = new ProgressDialog(context); - progress.setTitle(app.getString(R.string.export_profile)); + progress.setTitle(app.getString(R.string.shared_string_export)); progress.setMessage(app.getString(R.string.shared_string_preparing)); progress.setCancelable(false); progress.show(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java index 1c30923de4..3eec01930b 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java @@ -120,7 +120,7 @@ public class ImportedSettingsItemsAdapter extends break; case OSM_EDITS: holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_info_dark, activeColorRes)); - holder.title.setText(R.string.osm_edit_modified_poi); + holder.title.setText(R.string.osm_edits); break; case FAVORITES: holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_favorite, activeColorRes)); @@ -128,7 +128,7 @@ public class ImportedSettingsItemsAdapter extends break; case OFFLINE_MAPS: holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_map, activeColorRes)); - holder.title.setText(R.string.shared_string_local_maps); + holder.title.setText(R.string.shared_string_maps); break; case TTS_VOICE: holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_volume_up, activeColorRes)); diff --git a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java index 44f301945f..fe17c52ab5 100644 --- a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java +++ b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java @@ -95,7 +95,8 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat language = ((Struct) langVal).getName(); } } else { - language = voiceProvider.replace("-tts", "").replace("-formal", ""); + language = voiceProvider.replace(IndexConstants.VOICE_PROVIDER_SUFFIX, "") + .replace("-formal", ""); } } diff --git a/OsmAnd/src/net/osmand/plus/voice/JSTTSCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/JSTTSCommandPlayerImpl.java index e0c0018605..bf8d9803bf 100644 --- a/OsmAnd/src/net/osmand/plus/voice/JSTTSCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/JSTTSCommandPlayerImpl.java @@ -28,8 +28,8 @@ public class JSTTSCommandPlayerImpl extends TTSCommandPlayerImpl { jsScope = context.initSafeStandardObjects(); try { BufferedReader br = new BufferedReader(new FileReader(new File( - app.getAppPath(IndexConstants.VOICE_INDEX_DIR).getAbsolutePath() + - "/" + voiceProvider + "/" + voiceProvider.replace("-tts", "_tts") + ".js"))); + app.getAppPath(IndexConstants.VOICE_INDEX_DIR).getAbsolutePath() + "/" + voiceProvider + "/" + + voiceProvider.replace(IndexConstants.VOICE_PROVIDER_SUFFIX, "_tts") + ".js"))); context.evaluateReader(jsScope, br, "JS", 1, null); br.close(); } catch (Exception e) {