diff --git a/app/build.gradle b/app/build.gradle index 57a77ea90..d769b618c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -108,7 +108,7 @@ dependencies { testImplementation 'androidx.test.ext:junit:1.1.5' testImplementation "androidx.test:rules:1.5.0" testImplementation "com.squareup.okhttp3:mockwebserver:$OKHTTP_VERSION" - testImplementation "com.jraska.livedata:testing-ktx:1.1.2" + testImplementation "com.jraska.livedata:testing-ktx:1.2.0" testImplementation "androidx.arch.core:core-testing:2.2.0" testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.0" diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java index 03ba4a48d..7b23ad680 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java @@ -1992,51 +1992,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment * locations. */ private void addMarkersToMap(List nearbyBaseMarkers) { - for (int i = 0; i < nearbyBaseMarkers.size(); i++) { - Drawable icon = ContextCompat.getDrawable(getContext(), - getIconFor(nearbyBaseMarkers.get(i).getPlace(), false)); - GeoPoint point = new GeoPoint( - nearbyBaseMarkers.get(i).getPlace().location.getLatitude(), - nearbyBaseMarkers.get(i).getPlace().location.getLongitude()); - Marker marker = new Marker(binding.map); - marker.setPosition(point); - marker.setIcon(icon); - Place place = nearbyBaseMarkers.get(i).getPlace(); - if (!Objects.equals(place.name, "")) { - marker.setTitle(place.name); - marker.setSnippet( - containsParentheses(place.getLongDescription()) - ? getTextBetweenParentheses( - place.getLongDescription()) : place.getLongDescription()); - } - marker.setTextLabelFontSize(40); - marker.setId(String.valueOf(i)); - marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_TOP); - marker.setOnMarkerClickListener((marker1, mapView) -> { - marker1.showInfoWindow(); - if (clickedMarker != null) { - clickedMarker.closeInfoWindow(); - } - clickedMarker = marker1; - int index = Integer.parseInt(marker1.getId()); - Place updatedPlace = nearbyBaseMarkers.get(index).getPlace(); - binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.VISIBLE); - binding.bottomSheetDetails.icon.setVisibility(View.GONE); - binding.bottomSheetDetails.wikiDataLl.setVisibility(View.GONE); - if (Objects.equals(updatedPlace.name, "")) { - getPlaceData(updatedPlace.getWikiDataEntityId(), updatedPlace, marker1, false); - } else { - marker.showInfoWindow(); - binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE); - binding.bottomSheetDetails.icon.setVisibility(View.VISIBLE); - binding.bottomSheetDetails.wikiDataLl.setVisibility(View.VISIBLE); - passInfoToSheet(place); - hideBottomSheet(); - } - bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); - return true; - }); - binding.map.getOverlays().add(marker); + + for(int i = 0; i< nearbyBaseMarkers.size(); i++){ + addMarkerToMap(nearbyBaseMarkers.get(i).getPlace(), false); } }