This commit is contained in:
Rohit Verma 2024-08-25 09:51:02 +05:30
commit c2c6dc26e3
2 changed files with 4 additions and 46 deletions

View file

@ -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"

View file

@ -1992,51 +1992,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
* locations.
*/
private void addMarkersToMap(List<BaseMarker> 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);
addMarkerToMap(nearbyBaseMarkers.get(i).getPlace(), false);
}
}