diff --git a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java index 338bb9089e..720ecf5107 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java @@ -90,9 +90,11 @@ public class Algorithms { return def; } - public static String getFileNameWithoutExtension(File f) { - String name = f.getName(); + return getFileNameWithoutExtension(f.getName()); + } + + public static String getFileNameWithoutExtension(String name) { int i = name.indexOf('.'); if (i >= 0) { name = name.substring(0, i); diff --git a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java index 4ed8de3185..96914f4e13 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java @@ -876,6 +876,10 @@ public class ImportHelper { if (!destDir.exists()) { destDir.mkdirs(); } + if (importType == ImportType.RENDERING && !destFileName.endsWith(RENDERER_INDEX_EXT)) { + String fileName = Algorithms.getFileNameWithoutExtension(destFileName); + destFileName = fileName + RENDERER_INDEX_EXT; + } File destFile = new File(destDir, destFileName); while (destFile.exists()) { destFileName = AndroidUtils.createNewFileName(destFileName); @@ -1171,7 +1175,8 @@ public class ImportHelper { return favourites; } - private void executeImportTask(final AsyncTask importTask) { + @SuppressWarnings("unchecked") + private

void executeImportTask(final AsyncTask importTask, final P... requests) { if (app.isApplicationInitializing()) { app.getAppInitializer().addListener(new AppInitializer.AppInitializeListener() { @Override @@ -1180,11 +1185,11 @@ public class ImportHelper { @Override public void onFinish(AppInitializer init) { - importTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + importTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); } }); } else { - importTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + importTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); } } } \ No newline at end of file