Search in sources :

Example 1 with MapBoxTileProvider

use of com.ushahidi.android.app.MapBoxTileProvider in project Ushahidi_Android by ushahidi.

the class Util method setMapTile.

/**
     * Sets which map tile to use
     * 
     * @param context The calling Activity
     * @param map The GoogleMap
     */
public static void setMapTile(Context context, GoogleMap map) {
    // load preferences
    Preferences.loadSettings(context);
    TileOverlayOptions osm = new TileOverlayOptions().tileProvider(new OpenStreetMapTileProvider());
    TileOverlayOptions mapbox = new TileOverlayOptions().tileProvider(new MapBoxTileProvider());
    final String mapTile = Preferences.mapTiles;
    if (map != null) {
        ///map.setMapType(GoogleMap.MAP_TYPE_NONE);
        map.addTileOverlay(osm).remove();
        map.addTileOverlay(mapbox).remove();
        map.clear();
        if (mapTile.equals("google")) {
            map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
        } else if (mapTile.equals("osm")) {
            map.addTileOverlay(osm);
        } else {
            map.addTileOverlay(mapbox);
        }
    }
}
Also used : TileOverlayOptions(com.google.android.gms.maps.model.TileOverlayOptions) MapBoxTileProvider(com.ushahidi.android.app.MapBoxTileProvider) OpenStreetMapTileProvider(com.ushahidi.android.app.OpenStreetMapTileProvider)

Aggregations

TileOverlayOptions (com.google.android.gms.maps.model.TileOverlayOptions)1 MapBoxTileProvider (com.ushahidi.android.app.MapBoxTileProvider)1 OpenStreetMapTileProvider (com.ushahidi.android.app.OpenStreetMapTileProvider)1