* Disable hidden marker actions
This commit is contained in:
Ashish 2020-09-14 16:44:24 +05:30 committed by GitHub
parent 624d351d4b
commit ece085d1d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -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;
}
}

View file

@ -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;
});
}
}