Search in sources :

Example 1 with MarkerModel

use of com.google.samples.apps.iosched.map.util.MarkerModel in project iosched by google.

the class MapFragment method onMarkerClick.

@Override
public boolean onMarkerClick(Marker marker) {
    final String title = marker.getTitle();
    final MarkerModel model = mMarkers.get(title);
    // Log clicks on all markers (regardless of type)
    // ANALYTICS EVENT: Click on marker on the map.
    // Contains: Marker ID (for example room UUID)
    AnalyticsHelper.sendEvent("Map", "markerclick", title);
    deselectActiveMarker();
    // For all other markers the model needs to be looked up first.
    if (marker.equals(mVenueMaker)) {
        // Return camera to the venue
        LOGD(TAG, "Clicked on the venue marker, return to initial display.");
        centerOnVenue(true);
    } else if (model != null && MapUtils.hasInfoTitleOnly(model.type)) {
        // Show a basic info window with a title only
        mCallbacks.onInfoShowTitle(model.label, model.type);
        selectActiveMarker(marker);
    } else if (model != null && MapUtils.hasInfoSessionList(model.type)) {
        // Type has sessions to display
        mCallbacks.onInfoShowSessionlist(model.id, model.label, model.type);
        selectActiveMarker(marker);
    } else if (model != null && MapUtils.hasInfoFirstDescriptionOnly(model.type)) {
        // Display the description of the first session only
        mCallbacks.onInfoShowFirstSessionTitle(model.id, model.label, model.type);
        selectActiveMarker(marker);
    } else {
        // Hide the bottom sheet for unknown markers
        mCallbacks.onInfoHide();
    }
    return true;
}
Also used : MarkerModel(com.google.samples.apps.iosched.map.util.MarkerModel)

Example 2 with MarkerModel

use of com.google.samples.apps.iosched.map.util.MarkerModel in project iosched by google.

the class MapFragment method onMarkersLoaded.

private void onMarkersLoaded(List<MarkerLoadingTask.MarkerEntry> list) {
    if (list != null) {
        for (MarkerLoadingTask.MarkerEntry entry : list) {
            // Skip incomplete entries
            if (entry.options == null || entry.model == null) {
                break;
            }
            // Add marker to the map
            Marker m = mMap.addMarker(entry.options);
            MarkerModel model = entry.model;
            model.marker = m;
            // Store the marker and its model
            ArrayList<Marker> markerList = mMarkersFloor.get(model.floor);
            if (markerList == null) {
                // Initialise the list of Markers for this floor
                markerList = new ArrayList<>();
                mMarkersFloor.put(model.floor, markerList);
            }
            markerList.add(m);
            mMarkers.put(model.id, model);
        }
    }
    enableMapElements();
}
Also used : Marker(com.google.android.gms.maps.model.Marker) MarkerModel(com.google.samples.apps.iosched.map.util.MarkerModel) MarkerLoadingTask(com.google.samples.apps.iosched.map.util.MarkerLoadingTask)

Example 3 with MarkerModel

use of com.google.samples.apps.iosched.map.util.MarkerModel in project iosched by google.

the class MapFragment method highlightRoom.

private void highlightRoom(String roomId) {
    MarkerModel m = mMarkers.get(roomId);
    if (m != null) {
        mHighlightedRoom = m;
        showFloorElementsIndex(m.floor);
    }
}
Also used : MarkerModel(com.google.samples.apps.iosched.map.util.MarkerModel)

Aggregations

MarkerModel (com.google.samples.apps.iosched.map.util.MarkerModel)3 Marker (com.google.android.gms.maps.model.Marker)1 MarkerLoadingTask (com.google.samples.apps.iosched.map.util.MarkerLoadingTask)1