Skip to content

Reduce duplicate drawing of polylines and polygons + fix feature removing in Google Maps#7065

Merged
grzesiek2010 merged 4 commits intogetodk:masterfrom
grzesiek2010:COLLECT-7058
Feb 1, 2026
Merged

Reduce duplicate drawing of polylines and polygons + fix feature removing in Google Maps#7065
grzesiek2010 merged 4 commits intogetodk:masterfrom
grzesiek2010:COLLECT-7058

Conversation

@grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Jan 31, 2026

Closes #7058

This PR focuses on:

The shape remains on the map even after the points have been deleted.

from #7058

Why is this the best possible solution? Were any other approaches considered?

There are at least two issues in the way we update polylines/polygons:

  1. The process of updating polylines/polygons is quite heavy because, despite being called an update, it actually removes the existing polyline/polygon entirely and recreates it from scratch. This means that every time a new point is recorded for a polyline/polygon, the full remove-and-create sequence is repeated.

  2. Additionally, the update was triggered by changes in combined LiveData (the list of points and the invalid polygon message). As a result, any change in either of these LiveData sources caused an update even in cases where the value didn’t effectively change (for example, when the invalid polygon message was null and remained null). This led to redundant updates where identical polylines/polygons were removed and recreated.

Google Maps somehow doesn't like that heavy approach and has problems with redrawing polylines/polygons properly. I've fixed the latter in 4fd62ed This helped a little, but didn’t fix the issue entirely. I considered addressing the root cause properly by updating polylines/polygons instead of removing and recreating them from scratch, but that would require more time and introduce additional risk. Instead, for now, in Collect v2026.1, I implemented a workaround to address the issue see: 2ae024b
However, I think we should file a separate issue for addressing updating properly.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Since there are a few other PRs with the needs testing label that address related issues in this area, I think it makes sense to test everything as a whole rather than focusing on any particular area of risk.

Do we need any specific form for testing your changes? If so, please attach one.

The form is linked in the issue.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 requested a review from seadowg February 1, 2026 00:11
@grzesiek2010 grzesiek2010 marked this pull request as ready for review February 1, 2026 00:11
@grzesiek2010 grzesiek2010 merged commit 536d3db into getodk:master Feb 1, 2026
7 checks passed
@srujner
Copy link

srujner commented Feb 3, 2026

Tested with success

Verified on Android 14

Verified cases:

@dbemke
Copy link

dbemke commented Feb 3, 2026

Tested with success

Verified on Android 10

@WKobus
Copy link

WKobus commented Feb 3, 2026

Tested with success

Verified on Android 16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The shape remains on the map even after the points have been deleted with incremental=true.

5 participants