Fix renaming selected gpx
This commit is contained in:
parent
7125f0f5c4
commit
bfab856efb
2 changed files with 13 additions and 2 deletions
|
@ -22,11 +22,11 @@ import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -639,6 +639,12 @@ public class GpxSelectionHelper {
|
||||||
selectedGPXFiles = newSelectedGPXFiles;
|
selectedGPXFiles = newSelectedGPXFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateSelectedGpxFile(SelectedGpxFile selectedGpxFile) {
|
||||||
|
if (selectedGPXFiles.contains(selectedGpxFile)) {
|
||||||
|
saveCurrentSelections();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SelectedGpxFile selectGpxFile(GPXFile gpx, boolean show, boolean notShowNavigationDialog) {
|
public SelectedGpxFile selectGpxFile(GPXFile gpx, boolean show, boolean notShowNavigationDialog) {
|
||||||
return selectGpxFile(gpx, show, notShowNavigationDialog, true, true, true);
|
return selectGpxFile(gpx, show, notShowNavigationDialog, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,6 @@ import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -82,6 +81,7 @@ import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
||||||
import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment;
|
import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -1482,11 +1482,16 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
final SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedFileByPath(gpxInfo.file.getPath());
|
||||||
FileUtils.renameFile(getActivity(), gpxInfo.file, new RenameCallback() {
|
FileUtils.renameFile(getActivity(), gpxInfo.file, new RenameCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void renamedTo(File file) {
|
public void renamedTo(File file) {
|
||||||
asyncLoader = new LoadGpxTask();
|
asyncLoader = new LoadGpxTask();
|
||||||
asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
||||||
|
if (selectedGpxFile != null && selectedGpxFile.getGpxFile() != null) {
|
||||||
|
selectedGpxFile.getGpxFile().path = file.getPath();
|
||||||
|
selectedGpxHelper.updateSelectedGpxFile(selectedGpxFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue