use of io.jawg.osmcontributor.ui.utils.MapMode in project osm-contributor by jawg.
the class MapFragment method switchMode.
public void switchMode(MapMode mode) {
mapMode = mode;
Bitmap bitmap;
switchToolbarMode(mapMode);
editNodeRefPosition.setVisibility(View.GONE);
// progressBar.setVisibility(View.GONE);
final MapMode.MapModeProperties properties = mode.getProperties();
if (properties.isUnSelectIcon()) {
unselectMarker();
}
showFloatingButtonAddPoi(properties.isShowAddPoiFab());
displayPoiTypePicker();
displayPoiDetailBanner(properties.isShowPoiBanner());
displayNoteDetailBanner(properties.isShowNodeBanner());
switch(mode) {
case DETAIL_POI:
break;
case DETAIL_NOTE:
break;
case TYPE_PICKER:
eventBus.post(new PleaseLoadLastUsedPoiType());
break;
case POI_CREATION:
animationPoiCreation();
break;
case NOTE_CREATION:
noteSelected();
animationPoiCreation();
break;
case POI_POSITION_EDITION:
// This marker is being moved
bitmap = bitmapHandler.getMarkerBitmap(((Poi) markerSelected.getRelatedObject()).getType(), Poi.computeState(false, true, false));
creationPin.setImageBitmap(bitmap);
break;
case NODE_REF_POSITION_EDITION:
wayCreationPin.setImageBitmap(bitmapHandler.getNodeRefBitmap(PoiNodeRef.State.MOVING));
break;
case WAY_EDITION:
if (getZoomLevel() < zoomVectorial) {
changeMapZoomSmooth(configManager.getZoomVectorial());
}
loadAreaForEdition();
break;
default:
poiTypeSelected = null;
poiTypeEditText.setText("");
clearAllNodeRef();
switchToolbarMode(mapMode);
displayHomeButton(true);
unselectMarker();
break;
}
// the marker is displayed at the end of the animation
displayCreationPin(properties.isShowCreationPin());
wayCreationPin.setVisibility(properties.isShowCreationPin() ? View.VISIBLE : View.GONE);
if (addPoiFloatingMenu.isOpened()) {
addPoiFloatingMenu.toggle(true);
}
}
use of io.jawg.osmcontributor.ui.utils.MapMode in project osm-contributor by jawg.
the class MapFragment method switchToolbarMode.
private void switchToolbarMode(MapMode mode) {
MapMode.MapModeProperties properties = mode.getProperties();
confirm.setVisible(properties.isShowConfirmBtn());
filter.setVisible(FlavorUtils.hasFilter() && !properties.isLockDrawer());
toggleBackButton(properties.isMenuBtn());
getActivity().setTitle(properties.getTitle(getActivity()));
eventBus.post(new PleaseChangeToolbarColor(properties.isEditColor()));
eventBus.post(new PleaseToggleDrawerLock(properties.isLockDrawer()));
}
use of io.jawg.osmcontributor.ui.utils.MapMode in project osm-contributor by jawg.
the class MapboxListener method onWayMarkerClick.
/**
* Click on way marker
* @param wayMarker
*/
public void onWayMarkerClick(WayMarker wayMarker) {
MapMode mapMode = mapFragment.getMapMode();
if (mapMode != MapMode.POI_POSITION_EDITION && mapMode != MapMode.POI_CREATION) {
mapFragment.unselectWayMarker();
mapFragment.setWayMarkerSelected(wayMarker);
mapFragment.selectWayMarker();
}
}
use of io.jawg.osmcontributor.ui.utils.MapMode in project osm-contributor by jawg.
the class MapboxListener method onLocationMarkerClick.
/**
* Click on LocationMarkerView
* @param locationMarkerView
*/
public void onLocationMarkerClick(LocationMarkerView locationMarkerView) {
MapMode mapMode = mapFragment.getMapMode();
if (mapMode != MapMode.POI_POSITION_EDITION && mapMode != MapMode.POI_CREATION) {
mapFragment.unselectMarker();
mapFragment.setMarkerSelected(locationMarkerView);
switch(locationMarkerView.getType()) {
case POI:
onPoiMarkerClick(locationMarkerView);
break;
case NOTE:
onNoteMarkerClick(locationMarkerView);
break;
default:
break;
}
}
}
use of io.jawg.osmcontributor.ui.utils.MapMode in project osm-contributor by jawg.
the class MapboxListener method onMapClick.
/**
* User click on map
*/
private void onMapClick() {
MapMode mapMode = mapFragment.getMapMode();
if (mapMode == MapMode.DETAIL_POI || mapMode == MapMode.DETAIL_NOTE) {
// it prevents to reselect the marker
mapFragment.setMarkerSelectedId(-1L);
mapFragment.switchMode(MapMode.DEFAULT);
}
if (mapMode == MapMode.WAY_EDITION) {
mapFragment.unselectWayMarker();
}
if (mapMode == MapMode.DEFAULT && mapFragment.getAddPoiFloatingMenu().isOpened()) {
mapFragment.getAddPoiFloatingMenu().close(true);
}
}
Aggregations