Fixed #1155 - Map Info Dialog Glitch #1156
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 callingshowInfoDialog()
to updatelast 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 thelast 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 anythingIf 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)