mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
parent
624d351d4b
commit
ece085d1d1
2 changed files with 18 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import com.mapbox.mapboxsdk.annotations.Marker;
|
|||
public class NearbyMarker extends Marker {
|
||||
private final Place place;
|
||||
private NearbyBaseMarker nearbyBaseMarker;
|
||||
private boolean disabled;
|
||||
|
||||
/**
|
||||
* Creates a instance of {@link Marker} using the builder of Marker.
|
||||
|
|
@ -24,4 +25,12 @@ public class NearbyMarker extends Marker {
|
|||
public Place getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
return disabled;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1208,6 +1208,10 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
nearbyBaseMarker.icon(IconFactory.getInstance(getContext())
|
||||
.fromBitmap(icon));
|
||||
marker.setIcon(IconFactory.getInstance(getContext()).fromBitmap(icon));
|
||||
|
||||
if(marker instanceof NearbyMarker){
|
||||
((NearbyMarker) marker).setDisabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1226,6 +1230,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
for (Marker marker : mapBox.getMarkers()) {
|
||||
if (!marker.equals(currentLocationMarker)) {
|
||||
marker.setIcon(IconFactory.getInstance(getContext()).fromBitmap(icon));
|
||||
if(marker instanceof NearbyMarker){
|
||||
((NearbyMarker) marker).setDisabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
addCurrentLocationMarker(NearbyController.currentLocation);
|
||||
|
|
@ -1249,10 +1256,10 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
});
|
||||
|
||||
mapBox.setOnMarkerClickListener(marker -> {
|
||||
if (marker instanceof NearbyMarker) {
|
||||
if (marker instanceof NearbyMarker && !((NearbyMarker) marker).isDisabled()) {
|
||||
presenter.markerSelected(marker);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue