mapbox / mapbox/mapbox-maps-android

Point annotations are tinted black

Open
#1,031 21 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: All(?) Tested on APIs 24-31
- Devices affected: All(?) Tested on multiple OnePlus and Pixel devices, Motorola Moto One (2018) and the official Android Emulator
- Maps SDK Version: 10.2.0

## Observed behavior and steps to reproduce
After deleting a point annotation, all point annotation created after are tinted black. The issue also occurs if the original annotation is updated with a new point, instead of deleting and recreating.
1. Create a point annotation on a map view
2. Delete the point annotation
3. Create a new point annotation with the same bitmap (not necessarily the same object, the issue also occurs if the bitmap is created from a drawable res each time)

My specific use case is calling the following code segment in an `OnMapLongClickListener` so a user can select a specific location on a map.
```
// Setup annotation manager if we haven't
if (annotationManager == null) {
val annotationApi = mapView?.annotations
annotationManager = annotationApi?.createPointAnnotationManager(mapView!!)
}

// Build marker annotation at point
val pointAnnotationOptions: PointAnnotationOptions = PointAnnotationOptions()
.withPoint(point)
.withIconImage(pin)

// Replace any existing marker with the new marker
marker?.let {
it.point = point
annotationManager?.update(it)
}
if (marker == null) {
marker = annotationManager?.create(pointAnnotationOptions)
}
```
## Expected behavior
Annotation icon should be the correct colors.

## Notes / preliminary analysis
none

## Additional links and references
First created annotation/Expected behavior:
![image](https://user-images.githubusercontent.com/8814164/148840982-b706b60c-fce5-4a13-9558-e9f909a60af3.png)
After deleting/creating or updating point:
![image](https://user-images.githubusercontent.com/8814164/148841046-9f133bfe-c8a1-44bf-855f-bec6729e2f58.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the OnMapLongClickListener flow and the annotation manager: create a point annotation, delete or update it, then create another with the same bitmap. Compare the first and later icons, and consider the work done when recreated or updated point annotations retain their correct colors.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.