Audio/Video notes don't show up right after import, relaunch is needed?

This commit is contained in:
androiddevkkotlin 2020-12-14 01:17:25 +02:00
parent 0855c21717
commit d1384f148b
2 changed files with 17 additions and 0 deletions

View file

@ -13,8 +13,10 @@ import net.osmand.FileUtils;
import net.osmand.IndexConstants;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.CustomOsmandPlugin;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.base.BaseLoadAsyncTask;
import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.backend.backup.PluginSettingsItem;
@ -138,6 +140,10 @@ class SettingsImportTask extends BaseLoadAsyncTask<Void, Void, String> {
app.getPoiFilters().loadSelectedPoiFilters();
AppInitializer.loadRoutingFiles(app, null);
FragmentActivity activity = activityRef.get();
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
if (plugin != null) {
plugin.indexingFiles(null, true, true);
}
if (activity instanceof MapActivity) {
((MapActivity) activity).getMapLayers().getMapWidgetRegistry().updateVisibleWidgets();
((MapActivity) activity).updateApplicationModeSettings();
@ -151,6 +157,7 @@ class SettingsImportTask extends BaseLoadAsyncTask<Void, Void, String> {
};
}
private void handlePluginImport(final PluginSettingsItem pluginItem, final File file) {
FragmentActivity activity = activityRef.get();
final ProgressDialog progress;
@ -172,6 +179,10 @@ class SettingsImportTask extends BaseLoadAsyncTask<Void, Void, String> {
if (progress != null && AndroidUtils.isActivityNotDestroyed(activity)) {
progress.dismiss();
}
AudioVideoNotesPlugin pluginAudioVideo = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
if (pluginAudioVideo != null) {
pluginAudioVideo.indexingFiles(null, true, true);
}
CustomOsmandPlugin plugin = pluginItem.getPlugin();
plugin.loadResources();

View file

@ -24,10 +24,12 @@ import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.download.ReloadIndexesTask;
import net.osmand.plus.download.ReloadIndexesTask.ReloadIndexesListener;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
@ -189,6 +191,10 @@ public class ImportSettingsFragment extends BaseSettingsListFragment {
app.getRendererRegistry().updateExternalRenderers();
AppInitializer.loadRoutingFiles(app, null);
reloadIndexes(items);
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
if (plugin != null) {
plugin.indexingFiles(null, true, true);
}
FragmentManager fm = getFragmentManager();
if (fm != null && file != null) {
ImportCompleteFragment.showInstance(fm, items, file.getName());