mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
* NearbyParentFragment.kt: add helper methods for user location overlays and accuracy data. Before this commit, the code used to create the user location overlays was in multiple places. Additionally, there was no easy way to access the location accuracy. This commit places the user location overlay creation code into helper methods, as well as adding a new location accuracy getter method. These methods can now be used to refactor other parts of the file. * NearbyParentFragment.kt: create method to update user location overlays Before this commit, there was no easy way to update the user location overlays. This commit adds the updateUserLocationOverlays() method, which will properly replace the old user location overlays with new ones. It will also add the overlays if they do not already exist. * NearbyParentFragment.kt: replace old code with calls to updateUserLocationOverlays() This commit completes the refactor and fixes the issue of the user overlays not updating. The new method updateUserLocationOverlays is called to refactor and simplify old code. * Removal of file is not related to the issue, but is needed for project to compile and run. * NearbyParentFragment.kt: fix bug where multiple user location overlays would appear Before this commit, the user could see multiple user location overlays if they paused the app and reopened it when there are no Places/pins on the map. This was caused by a linear search failing to identify the target overlay because it compared Drawables between two Overlays, which was unreliable. This commit contains a better solution for replacing existing user location overlays by adding 2 instance variables to keep track of the overlays. The position of these overlays in the overlay list can then be found by using indexOf() with these instance variables rather than the linear search that was implemented before. Some refactoring was also done. --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com> |
||
|---|---|---|
| .. | ||
| src | ||
| build.gradle.kts | ||
| proguard-rules.txt | ||
| test-proguard-rules.txt | ||