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

Fixes #5806 Implemented "Refresh" button to clear the cache and reload the Nearby map #5891

Merged
merged 8 commits into from
Oct 25, 2024

Conversation

noahvendrig
Copy link
Contributor

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?

  1. 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)

  2. NearbyParentFragment.java
    This is where the clicking of the refresh button is handled, which calls emptyCache(), which will then call reloadMap() to complete the refresh. Main functionality has been implemented here.

  3. 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.

  4. NearbyParentFragment.java, PlacesRepository.java, PlacesLocalDataSource.java, PlaceDao.java
    These files were changed to implement emptying the nearby cache

  5. NearbyParentFragment.java
    Functionality for reloading the map is inside reloadMap()

Tests performed (required)

  1. Tested 'app' profile on Huawei Pura 70 with API level 32
  2. Tested 'app' profile on Virtual Device "Medium Phone" with API level 34

Screenshots (for UI changes only)
Screen_recording_20241025_152616.webm

noahvendrig and others added 8 commits October 12, 2024 17:28
…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
Copy link
Member

@nicolas-raoul nicolas-raoul left a 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
Copy link
Member

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

@nicolas-raoul nicolas-raoul merged commit 3e020ed into commons-app:main Oct 25, 2024
1 check failed
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.

Nearby: "Refresh" button to clear the cache and reload the Nearby map
3 participants