Add map marker listener

This commit is contained in:
neslihanturan 2017-12-11 14:22:37 +03:00
parent e336b50f87
commit 4348dd65aa

View file

@ -48,7 +48,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
private FloatingActionButton fabCamera; private FloatingActionButton fabCamera;
private FloatingActionButton fabGallery; private FloatingActionButton fabGallery;
private View transparentView; private View transparentView;
private int currBottomSheetState;
private boolean isFabOpen=false; private boolean isFabOpen=false;
private Animation rotate_backward; private Animation rotate_backward;
private Animation fab_close; private Animation fab_close;
@ -137,7 +136,8 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
} }
}); });
bottomSheetDetailsBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { bottomSheetDetailsBehavior.setBottomSheetCallback(new BottomSheetBehavior
.BottomSheetCallback() {
@Override @Override
public void onStateChanged(@NonNull View bottomSheet, int newState) { public void onStateChanged(@NonNull View bottomSheet, int newState) {
prepareViewsForSheetPosition(newState); prepareViewsForSheetPosition(newState);
@ -150,6 +150,21 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
} }
} }
}); });
bottomSheetListBehavior.setBottomSheetCallback(new BottomSheetBehavior
.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
if (newState == BottomSheetBehavior.STATE_EXPANDED){
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
}
});
} }
private void setupMapView(Bundle savedInstanceState) { private void setupMapView(Bundle savedInstanceState) {
@ -170,7 +185,10 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
if (marker instanceof NearbyMarker) { if (marker instanceof NearbyMarker) {
NearbyMarker nearbyMarker = (NearbyMarker) marker; NearbyMarker nearbyMarker = (NearbyMarker) marker;
Place place = nearbyMarker.getNearbyBaseMarker().getPlace(); Place place = nearbyMarker.getNearbyBaseMarker().getPlace();
NearbyInfoDialog.showYourself(getActivity(), place); passInfoToSheet(place);
bottomSheetListBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
//NearbyInfoDialog.showYourself(getActivity(), place);
} }
return false; return false;
}); });
@ -257,7 +275,11 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
fabPlus.hide(); fabPlus.hide();
//moreInfo.setVisibility(View.GONE); //moreInfo.setVisibility(View.GONE);
} }
currBottomSheetState = bottomSheetState; //currBottomSheetState = bottomSheetState;
}
private void passInfoToSheet(Place place) {
} }
private void animateFAB(boolean isFabOpen) { private void animateFAB(boolean isFabOpen) {