use of com.google.android.gms.maps.model.TileOverlayOptions 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);
}
}
}
Aggregations