Android Gradle plugin 8 preparation (#1034)
This commit is contained in:
@@ -182,19 +182,15 @@ public class MapLayers {
|
||||
App.map.layers().remove(mBackgroundLayer);
|
||||
mBackgroundLayer = null;
|
||||
|
||||
switch (id) {
|
||||
case R.id.menu_layer_openstreetmap:
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mBackgroundLayer = new BitmapTileLayer(App.map, tileSource);
|
||||
break;
|
||||
|
||||
case R.id.menu_layer_naturalearth:
|
||||
mBackgroundLayer = new BitmapTileLayer(App.map, DefaultSources.NE_LANDCOVER.build());
|
||||
break;
|
||||
default:
|
||||
mBackgroundLayer = mBackroundPlaceholder;
|
||||
id = -1;
|
||||
if (id == R.id.menu_layer_openstreetmap) {
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mBackgroundLayer = new BitmapTileLayer(App.map, tileSource);
|
||||
} else if (id == R.id.menu_layer_naturalearth) {
|
||||
mBackgroundLayer = new BitmapTileLayer(App.map, DefaultSources.NE_LANDCOVER.build());
|
||||
} else {
|
||||
mBackgroundLayer = mBackroundPlaceholder;
|
||||
id = -1;
|
||||
}
|
||||
|
||||
if (mBackgroundLayer instanceof BitmapTileLayer)
|
||||
|
||||
@@ -293,23 +293,20 @@ public class POISearch {
|
||||
}
|
||||
|
||||
public boolean onContextItemSelected(MenuItem item, GeoPoint geoPoint) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_poi_nearby:
|
||||
Intent intent = new Intent(App.activity, POIActivity.class);
|
||||
intent.putExtra("ID", poiMarkers.getBubbledItemId());
|
||||
App.activity.startActivityForResult(intent, TileMap.POIS_REQUEST);
|
||||
return true;
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.menu_poi_nearby) {
|
||||
Intent intent = new Intent(App.activity, POIActivity.class);
|
||||
intent.putExtra("ID", poiMarkers.getBubbledItemId());
|
||||
App.activity.startActivityForResult(intent, TileMap.POIS_REQUEST);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_poi_clear) {
|
||||
poiMarkers.removeAllItems();
|
||||
mPOIs.clear();
|
||||
App.map.updateMap(true);
|
||||
|
||||
case R.id.menu_poi_clear:
|
||||
poiMarkers.removeAllItems();
|
||||
mPOIs.clear();
|
||||
App.map.updateMap(true);
|
||||
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -321,39 +321,35 @@ public class RouteSearch {
|
||||
}
|
||||
|
||||
boolean onContextItemSelected(MenuItem item, GeoPoint geoPoint) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_route_departure:
|
||||
mStartPoint = geoPoint;
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.menu_route_departure) {
|
||||
mStartPoint = geoPoint;
|
||||
|
||||
markerStart = putMarkerItem(markerStart, mStartPoint, START_INDEX,
|
||||
R.string.departure, R.drawable.marker_departure, -1);
|
||||
markerStart = putMarkerItem(markerStart, mStartPoint, START_INDEX,
|
||||
R.string.departure, R.drawable.marker_departure, -1);
|
||||
|
||||
getRouteAsync();
|
||||
return true;
|
||||
getRouteAsync();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_route_destination) {
|
||||
mDestinationPoint = geoPoint;
|
||||
|
||||
case R.id.menu_route_destination:
|
||||
mDestinationPoint = geoPoint;
|
||||
markerDestination = putMarkerItem(markerDestination, mDestinationPoint, DEST_INDEX,
|
||||
R.string.destination,
|
||||
R.drawable.marker_destination, -1);
|
||||
|
||||
markerDestination = putMarkerItem(markerDestination, mDestinationPoint, DEST_INDEX,
|
||||
R.string.destination,
|
||||
R.drawable.marker_destination, -1);
|
||||
getRouteAsync();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_route_viapoint) {
|
||||
GeoPoint viaPoint = geoPoint;
|
||||
addViaPoint(viaPoint);
|
||||
|
||||
getRouteAsync();
|
||||
return true;
|
||||
|
||||
case R.id.menu_route_viapoint:
|
||||
GeoPoint viaPoint = geoPoint;
|
||||
addViaPoint(viaPoint);
|
||||
|
||||
getRouteAsync();
|
||||
return true;
|
||||
|
||||
case R.id.menu_route_clear:
|
||||
clearOverlays();
|
||||
return true;
|
||||
|
||||
default:
|
||||
getRouteAsync();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_route_clear) {
|
||||
clearOverlays();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,88 +149,62 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.menu_info_about) {
|
||||
startActivity(new Intent(this, InfoView.class));
|
||||
} else if (itemId == R.id.menu_position) {
|
||||
} else if (itemId == R.id.menu_poi_nearby) {
|
||||
Intent intent = new Intent(this, POIActivity.class);
|
||||
startActivityForResult(intent, TileMap.POIS_REQUEST);
|
||||
} else if (itemId == R.id.menu_compass_2d) {
|
||||
if (!item.isChecked()) {
|
||||
// FIXME
|
||||
//mMapView.getMapViewPosition().setTilt(0);
|
||||
mCompass.setMode(Compass.Mode.C2D);
|
||||
} else {
|
||||
mCompass.setMode(Compass.Mode.OFF);
|
||||
}
|
||||
} else if (itemId == R.id.menu_compass_3d) {
|
||||
if (!item.isChecked()) {
|
||||
mCompass.setMode(Compass.Mode.C3D);
|
||||
} else {
|
||||
mCompass.setMode(Compass.Mode.OFF);
|
||||
}
|
||||
} else if (itemId == R.id.menu_position_my_location_enable) {
|
||||
if (!item.isChecked()) {
|
||||
mLocation.setMode(LocationHandler.Mode.SHOW);
|
||||
mLocation.setCenterOnFirstFix();
|
||||
} else {
|
||||
mLocation.setMode(LocationHandler.Mode.OFF);
|
||||
}
|
||||
} else if (itemId == R.id.menu_position_follow_location) {
|
||||
if (!item.isChecked()) {
|
||||
mLocation.setMode(LocationHandler.Mode.SNAP);
|
||||
} else {
|
||||
mLocation.setMode(LocationHandler.Mode.OFF);
|
||||
}
|
||||
} else if (itemId == R.id.menu_layer_openstreetmap || itemId == R.id.menu_layer_naturalearth) {
|
||||
int bgId = item.getItemId();
|
||||
// toggle if already enabled
|
||||
if (bgId == mMapLayers.getBackgroundId())
|
||||
bgId = -1;
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_info_about:
|
||||
startActivity(new Intent(this, InfoView.class));
|
||||
break;
|
||||
|
||||
case R.id.menu_position:
|
||||
break;
|
||||
|
||||
case R.id.menu_poi_nearby:
|
||||
Intent intent = new Intent(this, POIActivity.class);
|
||||
startActivityForResult(intent, TileMap.POIS_REQUEST);
|
||||
break;
|
||||
|
||||
case R.id.menu_compass_2d:
|
||||
if (!item.isChecked()) {
|
||||
// FIXME
|
||||
//mMapView.getMapViewPosition().setTilt(0);
|
||||
mCompass.setMode(Compass.Mode.C2D);
|
||||
} else {
|
||||
mCompass.setMode(Compass.Mode.OFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_compass_3d:
|
||||
if (!item.isChecked()) {
|
||||
mCompass.setMode(Compass.Mode.C3D);
|
||||
} else {
|
||||
mCompass.setMode(Compass.Mode.OFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_position_my_location_enable:
|
||||
if (!item.isChecked()) {
|
||||
mLocation.setMode(LocationHandler.Mode.SHOW);
|
||||
mLocation.setCenterOnFirstFix();
|
||||
} else {
|
||||
mLocation.setMode(LocationHandler.Mode.OFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_position_follow_location:
|
||||
if (!item.isChecked()) {
|
||||
mLocation.setMode(LocationHandler.Mode.SNAP);
|
||||
} else {
|
||||
mLocation.setMode(LocationHandler.Mode.OFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_layer_openstreetmap:
|
||||
case R.id.menu_layer_naturalearth:
|
||||
int bgId = item.getItemId();
|
||||
// toggle if already enabled
|
||||
if (bgId == mMapLayers.getBackgroundId())
|
||||
bgId = -1;
|
||||
|
||||
mMapLayers.setBackgroundMap(bgId);
|
||||
mMap.updateMap(true);
|
||||
break;
|
||||
|
||||
case R.id.menu_layer_grid:
|
||||
mMapLayers.enableGridOverlay(this, !mMapLayers.isGridEnabled());
|
||||
mMap.updateMap(true);
|
||||
break;
|
||||
|
||||
case R.id.menu_position_enter_coordinates:
|
||||
showDialog(DIALOG_ENTER_COORDINATES);
|
||||
break;
|
||||
|
||||
//case R.id.menu_position_map_center:
|
||||
// MapPosition mapCenter = mBaseLayer.getMapFileCenter();
|
||||
// if (mapCenter != null)
|
||||
// mMap.setCenter(mapCenter.getGeoPoint());
|
||||
// break;
|
||||
|
||||
case R.id.menu_preferences:
|
||||
startActivity(new Intent(this, EditPreferences.class));
|
||||
overridePendingTransition(R.anim.slide_right, R.anim.slide_left2);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
mMapLayers.setBackgroundMap(bgId);
|
||||
mMap.updateMap(true);
|
||||
} else if (itemId == R.id.menu_layer_grid) {
|
||||
mMapLayers.enableGridOverlay(this, !mMapLayers.isGridEnabled());
|
||||
mMap.updateMap(true);
|
||||
} else if (itemId == R.id.menu_position_enter_coordinates) {
|
||||
showDialog(DIALOG_ENTER_COORDINATES);
|
||||
/*} else if (itemId == R.id.menu_position_map_center) {
|
||||
MapPosition mapCenter = mBaseLayer.getMapFileCenter();
|
||||
if (mapCenter != null)
|
||||
mMap.setCenter(mapCenter.getGeoPoint());*/
|
||||
} else if (itemId == R.id.menu_preferences) {
|
||||
startActivity(new Intent(this, EditPreferences.class));
|
||||
overridePendingTransition(R.anim.slide_right, R.anim.slide_left2);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
toggleMenuCheck();
|
||||
|
||||
Reference in New Issue
Block a user