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 #1155 - Map Info Dialog Glitch #1156

Conversation

amrhossamdev
Copy link
Member

@amrhossamdev amrhossamdev commented Mar 10, 2024

Fixes #1155.

Details

After investigating I found that there is a thread that runs every 1 second responsible for updating last updated time by updating the Google info dialog by calling showInfoDialog() to update last updated time text When calling this function the dialog closes and then reopens according to the documentation it's the only way to update when there are no changes on the map, and that the cause of that glitch.

Also, I found that we update our map every 9 - 12 seconds and when we are updating the map we are also updating the info dialog according to the last data we have so this thread was only responsible for updating the last update time by calculating the (current time - last time from the previous API response) and was creating a static timer every second updating the last updated time until the next api response, in my opinion, it's not important because it costs a lot of UI drawing that will consume more battery because we are updating a text in a dialog every 1 second by recreating all the dialog.

Fix

My fix was done by just removing this thread and updating the dialog will be done in 9 - 12 seconds when we update our map this will make fewer renders for our screen less CPU consumption less battery draining and also will fix the glitch.

I tried different test cases like checking that bus station status changes in real time to make sure updating working well.

Video

dialog.webm

Ref : https://developers.google.com/maps/documentation/android-sdk/infowindows

  • Apply the AndroidStyle.xml style template to your code in Android Studio.

  • Run the unit tests with gradlew connectedObaGoogleDebugAndroidTest to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them for the initial submission of the pull request. When addressing comments on a pull request, please push a new commit per comment when possible (reviewers will squash and merge using GitHub merge tool)

aaronbrethorst

This comment was marked as duplicate.

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

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

Looks awesome! I see that there is still an occasional 'bounce' of the the info bubble, but it happens much less often than before—and I am guessing is tied to that 9-12 second update you reference. Great work, Amr.

@aaronbrethorst aaronbrethorst merged commit 297a41a into OneBusAway:main Mar 11, 2024
2 checks passed
@amrhossamdev
Copy link
Member Author

Yes is tied to updating the map every 9 - 12 seconds. In the service 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vehicle labels bounce around vehicle icon when selected on map
2 participants