Merge pull request #11302 from osmandapp/fix_track_upload
Fix tracks upload to osm
This commit is contained in:
commit
756fa1a510
2 changed files with 7 additions and 4 deletions
|
@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
@ -47,13 +48,15 @@ public class OptionsCard extends BaseCard {
|
||||||
public static final int DELETE_BUTTON_INDEX = 11;
|
public static final int DELETE_BUTTON_INDEX = 11;
|
||||||
|
|
||||||
private TrackDisplayHelper displayHelper;
|
private TrackDisplayHelper displayHelper;
|
||||||
|
private SelectedGpxFile selectedGpxFile;
|
||||||
private GPXFile gpxFile;
|
private GPXFile gpxFile;
|
||||||
private List<BaseBottomSheetItem> items = new ArrayList<>();
|
private List<BaseBottomSheetItem> items = new ArrayList<>();
|
||||||
|
|
||||||
public OptionsCard(@NonNull MapActivity mapActivity, TrackDisplayHelper displayHelper) {
|
public OptionsCard(@NonNull MapActivity mapActivity, TrackDisplayHelper displayHelper, SelectedGpxFile selectedGpxFile) {
|
||||||
super(mapActivity);
|
super(mapActivity);
|
||||||
this.displayHelper = displayHelper;
|
this.displayHelper = displayHelper;
|
||||||
this.gpxFile = displayHelper.getGpx();
|
this.gpxFile = displayHelper.getGpx();
|
||||||
|
this.selectedGpxFile = selectedGpxFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -254,7 +257,7 @@ public class OptionsCard extends BaseCard {
|
||||||
|
|
||||||
private BaseBottomSheetItem createUploadOsmItem() {
|
private BaseBottomSheetItem createUploadOsmItem() {
|
||||||
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
||||||
if (osmEditingPlugin != null) {
|
if (osmEditingPlugin != null && selectedGpxFile.getTrackAnalysis(app).isTimeMoving()) {
|
||||||
return new SimpleBottomSheetItem.Builder()
|
return new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getActiveIcon(R.drawable.ic_action_export))
|
.setIcon(getActiveIcon(R.drawable.ic_action_export))
|
||||||
.setTitle(app.getString(R.string.upload_to_openstreetmap))
|
.setTitle(app.getString(R.string.upload_to_openstreetmap))
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
loadSelectedGpxFile(mapActivity, path, showCurrentTrack, new CallbackWithObject<SelectedGpxFile>() {
|
loadSelectedGpxFile(mapActivity, path, showCurrentTrack, new CallbackWithObject<SelectedGpxFile>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean processResult(SelectedGpxFile result) {
|
public boolean processResult(SelectedGpxFile result) {
|
||||||
selectedGpxFile = result;
|
setSelectedGpxFile(result);
|
||||||
setupDisplayHelper();
|
setupDisplayHelper();
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
initContent(getView());
|
initContent(getView());
|
||||||
|
@ -514,7 +514,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
cardsContainer.addView(optionsCard.getView());
|
cardsContainer.addView(optionsCard.getView());
|
||||||
} else {
|
} else {
|
||||||
optionsCard = new OptionsCard(mapActivity, displayHelper);
|
optionsCard = new OptionsCard(mapActivity, displayHelper, selectedGpxFile);
|
||||||
optionsCard.setListener(this);
|
optionsCard.setListener(this);
|
||||||
cardsContainer.addView(optionsCard.build(mapActivity));
|
cardsContainer.addView(optionsCard.build(mapActivity));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue