Search in sources :

Example 1 with MapMode

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);
    }
}
Also used : PleaseLoadLastUsedPoiType(io.jawg.osmcontributor.ui.events.map.PleaseLoadLastUsedPoiType) Bitmap(android.graphics.Bitmap) MapMode(io.jawg.osmcontributor.ui.utils.MapMode) Poi(io.jawg.osmcontributor.model.entities.Poi)

Example 2 with MapMode

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()));
}
Also used : PleaseToggleDrawerLock(io.jawg.osmcontributor.ui.events.map.PleaseToggleDrawerLock) MapMode(io.jawg.osmcontributor.ui.utils.MapMode) PleaseChangeToolbarColor(io.jawg.osmcontributor.ui.events.map.PleaseChangeToolbarColor)

Example 3 with MapMode

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();
    }
}
Also used : MapMode(io.jawg.osmcontributor.ui.utils.MapMode)

Example 4 with MapMode

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;
        }
    }
}
Also used : MapMode(io.jawg.osmcontributor.ui.utils.MapMode)

Example 5 with MapMode

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);
    }
}
Also used : MapMode(io.jawg.osmcontributor.ui.utils.MapMode)

Aggregations

MapMode (io.jawg.osmcontributor.ui.utils.MapMode)5 Bitmap (android.graphics.Bitmap)1 Poi (io.jawg.osmcontributor.model.entities.Poi)1 PleaseChangeToolbarColor (io.jawg.osmcontributor.ui.events.map.PleaseChangeToolbarColor)1 PleaseLoadLastUsedPoiType (io.jawg.osmcontributor.ui.events.map.PleaseLoadLastUsedPoiType)1 PleaseToggleDrawerLock (io.jawg.osmcontributor.ui.events.map.PleaseToggleDrawerLock)1