parent
f3ab2dd33a
commit
8138eb0346
|
@ -23,8 +23,10 @@ import org.osmdroid.api.IGeoPoint;
|
||||||
import org.osmdroid.api.IMapController;
|
import org.osmdroid.api.IMapController;
|
||||||
import org.osmdroid.config.Configuration;
|
import org.osmdroid.config.Configuration;
|
||||||
import org.osmdroid.config.IConfigurationProvider;
|
import org.osmdroid.config.IConfigurationProvider;
|
||||||
|
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
|
||||||
import org.osmdroid.tileprovider.tilesource.XYTileSource;
|
import org.osmdroid.tileprovider.tilesource.XYTileSource;
|
||||||
import org.osmdroid.util.GeoPoint;
|
import org.osmdroid.util.GeoPoint;
|
||||||
|
import org.osmdroid.views.CustomZoomButtonsController;
|
||||||
import org.osmdroid.views.MapView;
|
import org.osmdroid.views.MapView;
|
||||||
import org.osmdroid.views.overlay.Overlay;
|
import org.osmdroid.views.overlay.Overlay;
|
||||||
|
|
||||||
|
@ -73,14 +75,6 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
||||||
clearMarkers();
|
clearMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected XYTileSource tileSource() {
|
|
||||||
return new XYTileSource("OpenStreetMap",
|
|
||||||
0, 19, 256, ".png", new String[] {
|
|
||||||
"https://a.tile.openstreetmap.org/",
|
|
||||||
"https://b.tile.openstreetmap.org/",
|
|
||||||
"https://c.tile.openstreetmap.org/" },"© OpenStreetMap contributors");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -103,7 +97,7 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
||||||
|
|
||||||
final IConfigurationProvider config = Configuration.getInstance();
|
final IConfigurationProvider config = Configuration.getInstance();
|
||||||
config.load(ctx, getPreferences());
|
config.load(ctx, getPreferences());
|
||||||
config.setUserAgentValue(BuildConfig.APPLICATION_ID + "_" + BuildConfig.VERSION_CODE);
|
config.setUserAgentValue(BuildConfig.APPLICATION_ID + "/" + BuildConfig.VERSION_CODE);
|
||||||
if (QuickConversationsService.isConversations() && getBooleanPreference("use_tor", R.bool.use_tor)) {
|
if (QuickConversationsService.isConversations() && getBooleanPreference("use_tor", R.bool.use_tor)) {
|
||||||
try {
|
try {
|
||||||
config.setHttpProxy(HttpConnectionManager.getProxy());
|
config.setHttpProxy(HttpConnectionManager.getProxy());
|
||||||
|
@ -111,17 +105,6 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
||||||
throw new RuntimeException("Unable to configure proxy");
|
throw new RuntimeException("Unable to configure proxy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final File f = new File(ctx.getCacheDir() + "/tiles");
|
|
||||||
try {
|
|
||||||
//noinspection ResultOfMethodCallIgnored
|
|
||||||
f.mkdirs();
|
|
||||||
} catch (final SecurityException ignored) {
|
|
||||||
}
|
|
||||||
if (f.exists() && f.isDirectory() && f.canRead() && f.canWrite()) {
|
|
||||||
Log.d(Config.LOGTAG, "Using tile cache at: " + f.getAbsolutePath());
|
|
||||||
config.setOsmdroidTileCache(f.getAbsoluteFile());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -150,8 +133,8 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
||||||
|
|
||||||
protected void setupMapView(MapView mapView, final GeoPoint pos) {
|
protected void setupMapView(MapView mapView, final GeoPoint pos) {
|
||||||
map = mapView;
|
map = mapView;
|
||||||
map.setTileSource(tileSource());
|
map.setTileSource(TileSourceFactory.MAPNIK);
|
||||||
map.setBuiltInZoomControls(false);
|
map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.NEVER);
|
||||||
map.setMultiTouchControls(true);
|
map.setMultiTouchControls(true);
|
||||||
map.setTilesScaledToDpi(true);
|
map.setTilesScaledToDpi(true);
|
||||||
mapController = map.getController();
|
mapController = map.getController();
|
||||||
|
@ -251,7 +234,7 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
||||||
requestLocationUpdates();
|
requestLocationUpdates();
|
||||||
updateLocationMarkers();
|
updateLocationMarkers();
|
||||||
updateUi();
|
updateUi();
|
||||||
map.setTileSource(tileSource());
|
map.setTileSource(TileSourceFactory.MAPNIK);
|
||||||
map.setTilesScaledToDpi(true);
|
map.setTilesScaledToDpi(true);
|
||||||
|
|
||||||
if (mapAtInitialLoc()) {
|
if (mapAtInitialLoc()) {
|
||||||
|
|
Loading…
Reference in New Issue