mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge pull request #1035 from psh/better-marker-selection-tracking
Direct nearby uploads feature branch - Map marker selection and footer visibility now track together.
This commit is contained in:
commit
6749c43740
1 changed files with 12 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.mapbox.mapboxsdk.Mapbox;
|
import com.mapbox.mapboxsdk.Mapbox;
|
||||||
|
import com.mapbox.mapboxsdk.annotations.Marker;
|
||||||
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
||||||
import com.mapbox.mapboxsdk.annotations.PolygonOptions;
|
import com.mapbox.mapboxsdk.annotations.PolygonOptions;
|
||||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||||
|
|
@ -76,6 +77,7 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
private Animation rotate_forward;
|
private Animation rotate_forward;
|
||||||
|
|
||||||
private Place place;
|
private Place place;
|
||||||
|
private Marker selected;
|
||||||
|
|
||||||
public NearbyMapFragment() {
|
public NearbyMapFragment() {
|
||||||
}
|
}
|
||||||
|
|
@ -135,6 +137,8 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
else if (bottomSheetDetailsBehavior.getState() == BottomSheetBehavior
|
else if (bottomSheetDetailsBehavior.getState() == BottomSheetBehavior
|
||||||
.STATE_COLLAPSED) {
|
.STATE_COLLAPSED) {
|
||||||
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||||
|
mapView.getMapAsync(MapboxMap::deselectMarkers);
|
||||||
|
selected=null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -250,8 +254,15 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
mapView.getMapAsync(mapboxMap -> {
|
mapView.getMapAsync(mapboxMap -> {
|
||||||
mapboxMap.addMarkers(baseMarkerOptions);
|
mapboxMap.addMarkers(baseMarkerOptions);
|
||||||
|
|
||||||
|
mapboxMap.setOnInfoWindowCloseListener(marker -> {
|
||||||
|
if (marker == selected){
|
||||||
|
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mapboxMap.setOnMarkerClickListener(marker -> {
|
mapboxMap.setOnMarkerClickListener(marker -> {
|
||||||
if (marker instanceof NearbyMarker) {
|
if (marker instanceof NearbyMarker) {
|
||||||
|
this.selected = marker;
|
||||||
NearbyMarker nearbyMarker = (NearbyMarker) marker;
|
NearbyMarker nearbyMarker = (NearbyMarker) marker;
|
||||||
Place place = nearbyMarker.getNearbyBaseMarker().getPlace();
|
Place place = nearbyMarker.getNearbyBaseMarker().getPlace();
|
||||||
passInfoToSheet(place);
|
passInfoToSheet(place);
|
||||||
|
|
@ -325,6 +336,7 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
this.getView().requestFocus();
|
this.getView().requestFocus();
|
||||||
break;
|
break;
|
||||||
case (BottomSheetBehavior.STATE_HIDDEN):
|
case (BottomSheetBehavior.STATE_HIDDEN):
|
||||||
|
mapView.getMapAsync(MapboxMap::deselectMarkers);
|
||||||
transparentView.setClickable(false);
|
transparentView.setClickable(false);
|
||||||
transparentView.setAlpha(0);
|
transparentView.setAlpha(0);
|
||||||
closeFabs(isFabOpen);
|
closeFabs(isFabOpen);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue