use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class WptPtMenuBuilder method buildWaypointsView.
private void buildWaypointsView(View view) {
GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();
SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedGPXFile(wpt);
if (selectedGpxFile != null) {
List<WptPt> points = selectedGpxFile.getGpxFile().getPoints();
GPXUtilities.GPXFile gpx = selectedGpxFile.getGpxFile();
if (points.size() > 0) {
String title = view.getContext().getString(R.string.context_menu_points_of_group);
File file = new File(gpx.path);
String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
int color = getPointColor(wpt, getFileColor(selectedGpxFile));
buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), null, title, 0, gpxName, true, getCollapsableWaypointsView(view.getContext(), true, gpx, wpt), false, 0, false, null, false);
}
}
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class AddTracksGroupBottomSheetDialogFragment method createMapMarkersSyncGroup.
private MapMarkersGroup createMapMarkersSyncGroup(OsmandApplication app, GpxDataItem gpxDataItem) {
GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();
File gpx = gpxDataItem.getFile();
SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedFileByPath(gpx.getAbsolutePath());
if (selectedGpxFile == null) {
GPXFile res = GPXUtilities.loadGPXFile(app, gpx);
gpxSelectionHelper.selectGpxFile(res, true, false);
}
return getMyApplication().getMapMarkersHelper().getOrCreateGroup(gpx);
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class GpxUiHelper method selectSingleGPXFile.
public static AlertDialog selectSingleGPXFile(final Activity activity, boolean showCurrentGpx, final CallbackWithObject<GPXFile[]> callbackWithObject) {
OsmandApplication app = (OsmandApplication) activity.getApplication();
int gpxDirLength = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath().length();
List<SelectedGpxFile> selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles();
final List<GPXInfo> list = new ArrayList<>(selectedGpxFiles.size() + 1);
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) {
showCurrentGpx = false;
}
if (!selectedGpxFiles.isEmpty() || showCurrentGpx) {
if (showCurrentGpx) {
list.add(new GPXInfo(activity.getString(R.string.shared_string_currently_recording_track), 0, 0));
}
for (SelectedGpxFile selectedGpx : selectedGpxFiles) {
if (!selectedGpx.getGpxFile().showCurrentTrack) {
list.add(new GPXInfo(selectedGpx.getGpxFile().path.substring(gpxDirLength + 1), selectedGpx.getGpxFile().modifiedTime, 0));
}
}
final ContextMenuAdapter adapter = createGpxContextMenuAdapter(list, null, showCurrentGpx);
return createSingleChoiceDialog(activity, showCurrentGpx, callbackWithObject, list, adapter);
}
return null;
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class MapMarkersHelper method getGroupsForDisplayedGpx.
@NonNull
public List<MapMarkersGroup> getGroupsForDisplayedGpx() {
List<MapMarkersGroup> res = new ArrayList<>();
List<SelectedGpxFile> selectedGpxFiles = ctx.getSelectedGpxHelper().getSelectedGPXFiles();
for (SelectedGpxFile selected : selectedGpxFiles) {
MapMarkersGroup group = getOrCreateGroup(new File(selected.getGpxFile().path));
if (!isGroupSynced(group.getId())) {
group.disabled = true;
createHeaderInGroup(group);
res.add(group);
}
}
return res;
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class OsmandAidlApi method hideGpx.
boolean hideGpx(String fileName) {
if (!Algorithms.isEmpty(fileName)) {
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByName(fileName);
if (selectedGpxFile != null) {
app.getSelectedGpxHelper().selectGpxFile(selectedGpxFile.getGpxFile(), false, false);
refreshMap();
return true;
}
}
return false;
}
Aggregations