Search in sources :

Example 66 with SelectedGpxFile

use of net.osmand.plus.track.helpers.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.

the class FileUtils method removeGpxFile.

public static boolean removeGpxFile(@NonNull OsmandApplication app, @NonNull File file) {
    if (file.exists()) {
        GpxSelectionHelper helper = app.getSelectedGpxHelper();
        SelectedGpxFile selected = helper.getSelectedFileByPath(file.getAbsolutePath());
        file.delete();
        app.getGpxDbHelper().remove(file);
        if (selected != null && selected.getGpxFile() != null) {
            helper.selectGpxFile(selected.getGpxFile(), false, false);
        }
        return true;
    }
    return false;
}
Also used : SelectedGpxFile(net.osmand.plus.track.helpers.GpxSelectionHelper.SelectedGpxFile) GpxSelectionHelper(net.osmand.plus.track.helpers.GpxSelectionHelper)

Aggregations

SelectedGpxFile (net.osmand.plus.track.helpers.GpxSelectionHelper.SelectedGpxFile)66 GPXFile (net.osmand.GPXUtilities.GPXFile)36 File (java.io.File)26 MapActivity (net.osmand.plus.activities.MapActivity)18 OsmandApplication (net.osmand.plus.OsmandApplication)17 ArrayList (java.util.ArrayList)13 WptPt (net.osmand.GPXUtilities.WptPt)12 GpxSelectionHelper (net.osmand.plus.track.helpers.GpxSelectionHelper)12 GpxDataItem (net.osmand.plus.track.helpers.GPXDatabase.GpxDataItem)9 View (android.view.View)8 ImageView (android.widget.ImageView)8 TextView (android.widget.TextView)8 LatLon (net.osmand.data.LatLon)8 SelectedGpxPoint (net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint)6 NonNull (androidx.annotation.NonNull)5 Paint (android.graphics.Paint)4 CallbackWithObject (net.osmand.CallbackWithObject)4 MapMarker (net.osmand.plus.mapmarkers.MapMarker)4 GpxDisplayGroup (net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup)4 DialogInterface (android.content.DialogInterface)3