Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed geotrace and geoshape widgets in read-only mode #6102

Merged
merged 6 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ public enum OutputMode { GEOTRACE, GEOSHAPE }
private List<MapPoint> originalPoly;

private ImageButton zoomButton;
private ImageButton playButton;
private ImageButton clearButton;
ImageButton playButton;
ImageButton clearButton;
private Button recordButton;
private ImageButton pauseButton;
private ImageButton backspaceButton;
ImageButton backspaceButton;
ImageButton saveButton;

private TextView locationStatus;
private TextView collectionStatus;
Expand Down Expand Up @@ -127,7 +128,7 @@ public enum OutputMode { GEOTRACE, GEOSHAPE }
private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
if (map != null && !originalPoly.equals(map.getPolyLinePoints(featureId))) {
if (!intentReadOnly && map != null && !originalPoly.equals(map.getPolyLinePoints(featureId))) {
showBackDialog();
} else {
finish();
Expand Down Expand Up @@ -225,7 +226,7 @@ public void initMap(MapFragment newMapFragment) {
backspaceButton = findViewById(R.id.backspace);
backspaceButton.setOnClickListener(v -> removeLastPoint());

ImageButton saveButton = findViewById(R.id.save);
saveButton = findViewById(R.id.save);
saveButton.setOnClickListener(v -> {
if (!map.getPolyLinePoints(featureId).isEmpty()) {
if (outputMode == OutputMode.GEOTRACE) {
Expand Down Expand Up @@ -276,7 +277,7 @@ public void initMap(MapFragment newMapFragment) {
if (restoredPoints != null) {
points = restoredPoints;
}
featureId = map.addPolyLine(new LineDescription(points, String.valueOf(MapConsts.DEFAULT_STROKE_WIDTH), null, true, outputMode == OutputMode.GEOSHAPE));
featureId = map.addPolyLine(new LineDescription(points, String.valueOf(MapConsts.DEFAULT_STROKE_WIDTH), null, !intentReadOnly, outputMode == OutputMode.GEOSHAPE));

if (inputActive && !intentReadOnly) {
startInput();
Expand Down Expand Up @@ -444,7 +445,7 @@ private void removeLastPoint() {

private void clear() {
map.clearFeatures();
featureId = map.addPolyLine(new LineDescription(new ArrayList<>(), String.valueOf(MapConsts.DEFAULT_STROKE_WIDTH), null, true, outputMode == OutputMode.GEOSHAPE));
featureId = map.addPolyLine(new LineDescription(new ArrayList<>(), String.valueOf(MapConsts.DEFAULT_STROKE_WIDTH), null, !intentReadOnly, outputMode == OutputMode.GEOSHAPE));
inputActive = false;
updateUi();
}
Expand All @@ -470,6 +471,7 @@ private void updateUi() {
playButton.setEnabled(false);
backspaceButton.setEnabled(false);
clearButton.setEnabled(false);
saveButton.setEnabled(false);
}
// Settings dialog

Expand Down
255 changes: 0 additions & 255 deletions geo/src/test/java/org/odk/collect/geo/geopoly/GeoPolyActivityTest.java

This file was deleted.

Loading