android-maps-compose icon indicating copy to clipboard operation
android-maps-compose copied to clipboard

fix: improve MarkerState API

Open bubenheimer opened this issue 1 year ago • 2 comments

This is a non-breaking change following suggestions from @arriolac for addressing #149: https://github.com/googlemaps/android-maps-compose/pull/150#discussion_r1016963262

This PR does not add an onDrag callback parameter to Marker(), which would be a somewhat breaking change; this functionality is not strictly necessary and I see alternatives that may be preferable.

Summary of changes:

  1. Deprecate MarkerState.dragState and DragState enum. These were carried over from GoogleMap SDK; they are events that were mischaracterized as states.
  2. Replace with MarkerState.isDragging boolean.
  3. Clarify KDoc in several places.
  4. Add several examples providing patterns for common use cases.
  5. Organize Marker-related examples into their own folder.

Fixes #149

bubenheimer avatar Jan 29 '24 07:01 bubenheimer

To be clear: replacing MarkerState.dragState (START/DRAG/END) with MarkerState.isDragging does not lose information, because the information was not valid in the first place, due to the State vs. Event mismatch in dragState.

The MarkerDragEventsActivity example doubles as a proof of concept demonstrating how to recreate DragState events from MarkerState.isDragging plus MarkerState.position. It is equally lossy about DragState events as MarkerState.dragState, short of relying on data race details.

bubenheimer avatar Jan 29 '24 14:01 bubenheimer

@wangela can I get a review for this PR, please? I'd really like to use these improvements. Thanks.

bubenheimer avatar Feb 28 '24 22:02 bubenheimer

:tada: This PR is included in version 5.0.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

googlemaps-bot avatar Jun 06 '24 11:06 googlemaps-bot