diff --git a/OsmAnd/res/values-he/strings.xml b/OsmAnd/res/values-he/strings.xml
index 45d01f1439..eb1c52423d 100644
--- a/OsmAnd/res/values-he/strings.xml
+++ b/OsmAnd/res/values-he/strings.xml
@@ -3540,7 +3540,7 @@
ניתוב
%1$s מוצג, כבר קיים ב־OsmAnd.
למחוק את הנתונים שהוקלטו\?
- מיובאים נתונים מתוך %1
+ מיובאים נתונים מתוך %1$s
מתבצע ייבוא
OsmAnd יחפש כפילויות של %1$s עם פריטים קיימים ביישומון.
\n
diff --git a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
index 71ec956959..60964c99ad 100644
--- a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
@@ -1,6 +1,7 @@
package net.osmand.plus;
import android.app.Activity;
+import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
@@ -9,6 +10,7 @@ import android.text.Html;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.JsonUtils;
import net.osmand.PlatformUtil;
@@ -104,7 +106,7 @@ public class CustomOsmandPlugin extends OsmandPlugin {
// called from UI
File pluginItemsFile = getPluginItemsFile();
if (pluginItemsFile.exists()) {
- addPluginItemsFromFile(pluginItemsFile);
+ addPluginItemsFromFile(pluginItemsFile, activity);
}
}
return true;
@@ -212,7 +214,26 @@ public class CustomOsmandPlugin extends OsmandPlugin {
this.resourceDirName = resourceDirName;
}
- private void addPluginItemsFromFile(final File file) {
+ private void addPluginItemsFromFile(final File file, final Activity activity) {
+ final ProgressDialog progress = new ProgressDialog(activity);
+ progress.setTitle(app.getString(R.string.loading_smth, ""));
+ progress.setMessage(app.getString(R.string.loading_data));
+ progress.setIndeterminate(true);
+ progress.setCancelable(false);
+
+ if (AndroidUtils.isActivityNotDestroyed(activity)) {
+ progress.show();
+ }
+
+ final SettingsHelper.SettingsImportListener importListener = new SettingsHelper.SettingsImportListener() {
+ @Override
+ public void onSettingsImportFinished(boolean succeed, @NonNull List items) {
+ if (AndroidUtils.isActivityNotDestroyed(activity)) {
+ progress.dismiss();
+ }
+ }
+ };
+
app.getSettingsHelper().collectSettings(file, "", 1, new SettingsCollectListener() {
@Override
public void onSettingsCollectFinished(boolean succeed, boolean empty, @NonNull List items) {
@@ -231,7 +252,7 @@ public class CustomOsmandPlugin extends OsmandPlugin {
item.setShouldReplace(true);
}
}
- app.getSettingsHelper().importSettings(file, items, "", 1, null);
+ app.getSettingsHelper().importSettings(file, items, "", 1, importListener);
}
}
});
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/PluginDisabledBottomSheet.java b/OsmAnd/src/net/osmand/plus/dialogs/PluginDisabledBottomSheet.java
index 50c0046c89..3a4b38e3b1 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/PluginDisabledBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/PluginDisabledBottomSheet.java
@@ -134,13 +134,15 @@ public class PluginDisabledBottomSheet extends MenuBottomSheetDialogFragment {
public static void showInstance(@NonNull FragmentManager fm, String pluginId, Boolean usedOnMap) {
try {
- Bundle args = new Bundle();
- args.putString(PLUGIN_ID_KEY, pluginId);
+ if (!fm.isStateSaved()) {
+ Bundle args = new Bundle();
+ args.putString(PLUGIN_ID_KEY, pluginId);
- PluginDisabledBottomSheet dialog = new PluginDisabledBottomSheet();
- dialog.setArguments(args);
- dialog.setUsedOnMap(usedOnMap);
- dialog.show(fm, PluginDisabledBottomSheet.TAG);
+ PluginDisabledBottomSheet dialog = new PluginDisabledBottomSheet();
+ dialog.setArguments(args);
+ dialog.setUsedOnMap(usedOnMap);
+ dialog.show(fm, PluginDisabledBottomSheet.TAG);
+ }
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java b/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java
index efeb56aaff..43abf6d515 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java
@@ -322,13 +322,15 @@ public class PluginInstalledBottomSheetDialog extends MenuBottomSheetDialogFragm
public static void showInstance(@NonNull FragmentManager fm, String pluginId, Boolean usedOnMap) {
try {
- Bundle args = new Bundle();
- args.putString(PLUGIN_ID_KEY, pluginId);
+ if (!fm.isStateSaved()) {
+ Bundle args = new Bundle();
+ args.putString(PLUGIN_ID_KEY, pluginId);
- PluginInstalledBottomSheetDialog dialog = new PluginInstalledBottomSheetDialog();
- dialog.setArguments(args);
- dialog.setUsedOnMap(usedOnMap);
- dialog.show(fm, PluginInstalledBottomSheetDialog.TAG);
+ PluginInstalledBottomSheetDialog dialog = new PluginInstalledBottomSheetDialog();
+ dialog.setArguments(args);
+ dialog.setUsedOnMap(usedOnMap);
+ dialog.show(fm, PluginInstalledBottomSheetDialog.TAG);
+ }
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
index 7651f8413a..8ceb40eb42 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
@@ -840,9 +840,22 @@ public class ImportHelper {
}
private void handlePluginImport(final PluginSettingsItem pluginItem, final File file) {
+ final ProgressDialog progress = new ProgressDialog(activity);
+ progress.setTitle(app.getString(R.string.loading_smth, ""));
+ progress.setMessage(app.getString(R.string.importing_from, pluginItem.getPublicName(app)));
+ progress.setIndeterminate(true);
+ progress.setCancelable(false);
+
+ if (AndroidUtils.isActivityNotDestroyed(activity)) {
+ progress.show();
+ }
+
final SettingsImportListener importListener = new SettingsImportListener() {
@Override
public void onSettingsImportFinished(boolean succeed, @NonNull List items) {
+ if (AndroidUtils.isActivityNotDestroyed(activity)) {
+ progress.dismiss();
+ }
CustomOsmandPlugin plugin = pluginItem.getPlugin();
plugin.loadResources();