Skip to content

Fix point annotation update bitmap affect others issue.#633

Merged
Chaoba merged 1 commit intomainfrom
kl-icon-update
Sep 17, 2021
Merged

Fix point annotation update bitmap affect others issue.#633
Chaoba merged 1 commit intomainfrom
kl-icon-update

Conversation

@Chaoba
Copy link
Copy Markdown
Contributor

@Chaoba Chaoba commented Sep 10, 2021

PRs must be submitted under the terms of our Contributor License Agreement CLA.
Fixes: #587

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Add example if relevant.
  • Document any changes to public APIs.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Add an entry inside this element for inclusion in the mapbox-maps-android changelog: <changelog>Fix point annotation update bitmap affect others issue.</changelog>.

Summary of changes

This pr changes the way to generate iconImage value for PointAnnotation and update the check condition for updating bitmap.

device-2021-09-10-155401.mp4

User impact (optional)

@Chaoba Chaoba added the bug 🪲 Something isn't working label Sep 10, 2021
@Chaoba Chaoba requested a review from a team September 10, 2021 10:06
@Chaoba Chaoba self-assigned this Sep 10, 2021
iconImage = ICON_DEFAULT_NAME_PREFIX + it.generationId
if (iconImage == null || iconImage!!.startsWith(ICON_DEFAULT_NAME_PREFIX)) {
// User does not set iconImage, update iconImage to this new bitmap
iconImage = ICON_DEFAULT_NAME_PREFIX + it.hashCode()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we revisit how generationId is generated instead of not using it here and introducing standard hash function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the official docs: generationId changes whenever the bitmap is modified. This can be used as an efficient way to check if a bitmap has changed. Here we want to distinguish different bitmap, so use hashCode would be appropriate.

@Chaoba Chaoba merged commit 3383903 into main Sep 17, 2021
@Chaoba Chaoba deleted the kl-icon-update branch September 17, 2021 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't update PointAnnotation's bitmap

4 participants