-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fixes #5806 Implemented "Refresh" button to clear the cache and reload the Nearby map #5891
Conversation
…nd from affected DAO files and funcs, and changed to (Kotlin v1.9.22) and (Kotlin compiler v1.5.8)
….xml (header of the nearby page). Created function refresh() in NearbyParentFragment.java to handle refresh functionality.
…esh-btn # Conflicts: # app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
… and then reload map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, in both day and night mode.
private void reloadMap() { | ||
clearAllMarkers(); // Clear the list of markers | ||
binding.map.getController().setZoom(ZOOM_LEVEL); // Reset the zoom level | ||
binding.map.getController().setCenter(lastMapFocus); // Recenter the focus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refreshing seems to move the map to the place I am in physically, is it expected?
screen-20241025-141156.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refreshing seems to move the map to the place I am in physically, is it expected?
screen-20241025-141156.mp4
My colleague @MarcusBarta worked on the map reload part of this feature, and he has told me that this is expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood! I created #5906 as an enhancement for this.
The nearby map can be buggy, and a reload feature is much more efficient than reloading the whole app.
This pull request solves this by adding a refresh button which will empty the nearby cache, and then reload the map.
Fixes #5806
What changes did you make and why?
After cloning the app would not run in my environment, and I have noticed that this is a common issue with other new maintainers. To solve this I had to: Removed suspend from affected DAO files and funcs, and changed to (Kotlin v1.9.22) and (Kotlin compiler v1.5.8)
NearbyParentFragment.java
This is where the clicking of the refresh button is handled, which calls
emptyCache()
, which will then callreloadMap()
to complete the refresh. Main functionality has been implemented here.nearby_fragment_menu.xml
,ic_refresh_24dp_nearby.xml
Created new refresh icon and added it to the nearby menu, so that it is displayed in the top header.
NearbyParentFragment.java
,PlacesRepository.java
,PlacesLocalDataSource.java
,PlaceDao.java
These files were changed to implement emptying the nearby cache
NearbyParentFragment.java
Functionality for reloading the map is inside
reloadMap()
Tests performed (required)
Screenshots (for UI changes only)
Screen_recording_20241025_152616.webm