Add multimedia notes to import/export
This commit is contained in:
parent
ee1ab5e2eb
commit
1308d16e97
10 changed files with 89 additions and 24 deletions
|
@ -96,13 +96,11 @@ public class AudioVideoNoteMenuController extends MenuController {
|
|||
|
||||
@Override
|
||||
public Drawable getRightIcon() {
|
||||
if (mRecording.isPhoto()) {
|
||||
return getIcon(R.drawable.ic_action_photo_dark, R.color.audio_video_icon_color);
|
||||
} else if (mRecording.isAudio()) {
|
||||
return getIcon(R.drawable.ic_action_micro_dark, R.color.audio_video_icon_color);
|
||||
} else {
|
||||
return getIcon(R.drawable.ic_action_video_dark, R.color.audio_video_icon_color);
|
||||
int iconId = AudioVideoNotesPlugin.getIconIdForRecordingFile(mRecording.getFile());
|
||||
if (iconId == -1) {
|
||||
iconId = R.drawable.ic_action_photo_dark;
|
||||
}
|
||||
return getIcon(iconId, R.color.audio_video_icon_color);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -47,14 +47,11 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.data.DataTileManager;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -66,12 +63,15 @@ import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
|||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import net.osmand.plus.quickaction.QuickActionType;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||
import net.osmand.plus.views.layers.MapInfoLayer;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.mapwidgets.widgetstates.WidgetState;
|
||||
import net.osmand.plus.views.layers.MapInfoLayer;
|
||||
import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget;
|
||||
import net.osmand.plus.views.mapwidgets.widgetstates.WidgetState;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.GeoPointParserUtil.GeoParsedPoint;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
@ -517,7 +517,18 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
}
|
||||
return additional.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIconIdForRecordingFile(@NonNull File file) {
|
||||
String fileName = file.getName();
|
||||
if (fileName.endsWith(IMG_EXTENSION)) {
|
||||
return R.drawable.ic_action_photo_dark;
|
||||
} else if (fileName.endsWith(MPEG4_EXTENSION)) {
|
||||
return R.drawable.ic_action_video_dark;
|
||||
} else if (fileName.endsWith(THREEGP_EXTENSION)) {
|
||||
return R.drawable.ic_action_micro_dark;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// private static void initializeRemoteControlRegistrationMethods() {
|
||||
|
|
|
@ -11,6 +11,6 @@ public enum ExportSettingsType {
|
|||
MARKERS,
|
||||
FAVORITES,
|
||||
TRACKS,
|
||||
AUDIO_VIDEO_NOTES,
|
||||
MULTIMEDIA_NOTES,
|
||||
OSM_CHANGES
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ public class FileSettingsItem extends StreamSettingsItem {
|
|||
TILES_MAP("tiles_map", IndexConstants.TILES_INDEX_DIR),
|
||||
GPX("gpx", IndexConstants.GPX_INDEX_DIR),
|
||||
VOICE("voice", IndexConstants.VOICE_INDEX_DIR),
|
||||
TRAVEL("travel", IndexConstants.WIKIVOYAGE_INDEX_DIR);
|
||||
TRAVEL("travel", IndexConstants.WIKIVOYAGE_INDEX_DIR),
|
||||
MULTIMEDIA_NOTES("multimedia_notes", IndexConstants.AV_INDEX_DIR);
|
||||
|
||||
private String subtypeName;
|
||||
private String subtypeFolder;
|
||||
|
|
|
@ -14,7 +14,10 @@ import net.osmand.map.ITileSource;
|
|||
import net.osmand.map.TileSourceManager;
|
||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.SQLiteTileSource;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.quickaction.QuickAction;
|
||||
|
@ -473,6 +476,19 @@ public class SettingsHelper {
|
|||
if (!impassableRoads.isEmpty()) {
|
||||
dataList.put(ExportSettingsType.AVOID_ROADS, new ArrayList<>(impassableRoads.values()));
|
||||
}
|
||||
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
|
||||
if (plugin != null) {
|
||||
List<File> files = new ArrayList<>();
|
||||
for (Recording rec : plugin.getAllRecordings()) {
|
||||
File file = rec.getFile();
|
||||
if (file != null && file.exists()) {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
if (!files.isEmpty()) {
|
||||
dataList.put(ExportSettingsType.MULTIMEDIA_NOTES, files);
|
||||
}
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
|
@ -522,6 +538,7 @@ public class SettingsHelper {
|
|||
List<ITileSource> tileSourceTemplates = new ArrayList<>();
|
||||
List<File> routingFilesList = new ArrayList<>();
|
||||
List<File> renderFilesList = new ArrayList<>();
|
||||
List<File> multimediaFilesList = new ArrayList<>();
|
||||
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
|
||||
for (SettingsItem item : settingsItems) {
|
||||
switch (item.getType()) {
|
||||
|
@ -534,6 +551,8 @@ public class SettingsHelper {
|
|||
renderFilesList.add(fileItem.getFile());
|
||||
} else if (fileItem.getSubtype() == FileSettingsItem.FileSubtype.ROUTING_CONFIG) {
|
||||
routingFilesList.add(fileItem.getFile());
|
||||
} else if (fileItem.getSubtype() == FileSettingsItem.FileSubtype.MULTIMEDIA_NOTES) {
|
||||
multimediaFilesList.add(fileItem.getFile());
|
||||
}
|
||||
break;
|
||||
case QUICK_ACTIONS:
|
||||
|
@ -594,6 +613,9 @@ public class SettingsHelper {
|
|||
if (!avoidRoads.isEmpty()) {
|
||||
settingsToOperate.put(ExportSettingsType.AVOID_ROADS, avoidRoads);
|
||||
}
|
||||
if (!multimediaFilesList.isEmpty()) {
|
||||
settingsToOperate.put(ExportSettingsType.MULTIMEDIA_NOTES, multimediaFilesList);
|
||||
}
|
||||
return settingsToOperate;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -131,6 +132,12 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
itemHolder.icon.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_map_style, activeColorRes));
|
||||
} else if (file.getAbsolutePath().contains(IndexConstants.ROUTING_PROFILES_DIR)) {
|
||||
itemHolder.icon.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_route_distance, activeColorRes));
|
||||
} else if (file.getAbsolutePath().contains(IndexConstants.AV_INDEX_DIR)) {
|
||||
int iconId = AudioVideoNotesPlugin.getIconIdForRecordingFile(file);
|
||||
if (iconId == -1) {
|
||||
iconId = R.drawable.ic_action_photo_dark;
|
||||
}
|
||||
itemHolder.icon.setImageDrawable(uiUtilities.getIcon(iconId, activeColorRes));
|
||||
}
|
||||
itemHolder.subTitle.setVisibility(View.GONE);
|
||||
} else if (currentItem instanceof AvoidRoadInfo) {
|
||||
|
|
|
@ -16,19 +16,20 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.plus.settings.backend.ExportSettingsType;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.profiles.ProfileIconColors;
|
||||
import net.osmand.plus.profiles.RoutingProfileDataObject.RoutingProfilesResources;
|
||||
import net.osmand.plus.quickaction.QuickAction;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
|
||||
import net.osmand.plus.settings.backend.ExportSettingsType;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.view.ThreeStateCheckbox;
|
||||
|
||||
|
@ -244,6 +245,16 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
|
|||
setupIcon(icon, R.drawable.ic_action_alert, itemSelected);
|
||||
subText.setVisibility(View.GONE);
|
||||
break;
|
||||
case MULTIMEDIA_NOTES:
|
||||
File file = (File) currentItem;
|
||||
title.setText(file.getName());
|
||||
int iconId = AudioVideoNotesPlugin.getIconIdForRecordingFile(file);
|
||||
if (iconId == -1) {
|
||||
iconId = R.drawable.ic_action_photo_dark;
|
||||
}
|
||||
setupIcon(icon, iconId, itemSelected);
|
||||
subText.setVisibility(View.GONE);
|
||||
break;
|
||||
default:
|
||||
return child;
|
||||
}
|
||||
|
@ -316,6 +327,8 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
|
|||
return R.string.shared_string_routing;
|
||||
case AVOID_ROADS:
|
||||
return R.string.avoid_road;
|
||||
case MULTIMEDIA_NOTES:
|
||||
return R.string.audionotes_plugin_name;
|
||||
default:
|
||||
return R.string.access_empty_list;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,6 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
|
|||
|
||||
@Override
|
||||
protected void onRightBottomButtonClick() {
|
||||
super.onRightBottomButtonClick();
|
||||
prepareFile();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,24 +26,27 @@ import com.google.android.material.appbar.CollapsingToolbarLayout;
|
|||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.plus.AppInitializer;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportAsyncTask;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportType;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsItem;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.quickaction.QuickAction;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportAsyncTask;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportType;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsItem;
|
||||
import net.osmand.view.ComplexButton;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.IndexConstants.AV_INDEX_DIR;
|
||||
import static net.osmand.IndexConstants.RENDERERS_DIR;
|
||||
import static net.osmand.IndexConstants.ROUTING_PROFILES_DIR;
|
||||
import static net.osmand.plus.settings.fragments.ImportSettingsFragment.IMPORT_SETTINGS_TAG;
|
||||
|
||||
|
||||
|
@ -171,6 +174,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
|
|||
List<ITileSource> tileSources = new ArrayList<>();
|
||||
List<File> renderFilesList = new ArrayList<>();
|
||||
List<File> routingFilesList = new ArrayList<>();
|
||||
List<File> multimediaFilesList = new ArrayList<>();
|
||||
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
|
||||
|
||||
for (Object object : duplicatesList) {
|
||||
|
@ -184,10 +188,12 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
|
|||
tileSources.add((ITileSource) object);
|
||||
} else if (object instanceof File) {
|
||||
File file = (File) object;
|
||||
if (file.getAbsolutePath().contains("files/rendering")) {
|
||||
if (file.getAbsolutePath().contains(RENDERERS_DIR)) {
|
||||
renderFilesList.add(file);
|
||||
} else if (file.getAbsolutePath().contains("files/routing")) {
|
||||
} else if (file.getAbsolutePath().contains(ROUTING_PROFILES_DIR)) {
|
||||
routingFilesList.add(file);
|
||||
} else if (file.getAbsolutePath().contains(AV_INDEX_DIR)) {
|
||||
multimediaFilesList.add(file);
|
||||
}
|
||||
} else if (object instanceof AvoidRoadInfo) {
|
||||
avoidRoads.add((AvoidRoadInfo) object);
|
||||
|
@ -217,6 +223,10 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
|
|||
duplicates.add(getString(R.string.shared_string_rendering_style));
|
||||
duplicates.addAll(renderFilesList);
|
||||
}
|
||||
if (!multimediaFilesList.isEmpty()) {
|
||||
duplicates.add(getString(R.string.audionotes_plugin_name));
|
||||
duplicates.addAll(multimediaFilesList);
|
||||
}
|
||||
if (!avoidRoads.isEmpty()) {
|
||||
duplicates.add(getString(R.string.avoid_road));
|
||||
duplicates.addAll(avoidRoads);
|
||||
|
|
|
@ -106,6 +106,10 @@ public class ImportedSettingsItemsAdapter extends
|
|||
holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_alert, activeColorRes));
|
||||
holder.title.setText(R.string.avoid_road);
|
||||
break;
|
||||
case MULTIMEDIA_NOTES:
|
||||
holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_photo_dark, activeColorRes));
|
||||
holder.title.setText(R.string.audionotes_plugin_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue