parent
f3ab2dd33a
commit
8138eb0346
|
@ -23,8 +23,10 @@ import org.osmdroid.api.IGeoPoint;
|
|||
import org.osmdroid.api.IMapController;
|
||||
import org.osmdroid.config.Configuration;
|
||||
import org.osmdroid.config.IConfigurationProvider;
|
||||
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
|
||||
import org.osmdroid.tileprovider.tilesource.XYTileSource;
|
||||
import org.osmdroid.util.GeoPoint;
|
||||
import org.osmdroid.views.CustomZoomButtonsController;
|
||||
import org.osmdroid.views.MapView;
|
||||
import org.osmdroid.views.overlay.Overlay;
|
||||
|
||||
|
@ -72,15 +74,7 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
|||
protected void updateLocationMarkers() {
|
||||
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
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -103,7 +97,7 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
|||
|
||||
final IConfigurationProvider config = Configuration.getInstance();
|
||||
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)) {
|
||||
try {
|
||||
config.setHttpProxy(HttpConnectionManager.getProxy());
|
||||
|
@ -111,17 +105,6 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
|||
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
|
||||
|
@ -150,8 +133,8 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
|||
|
||||
protected void setupMapView(MapView mapView, final GeoPoint pos) {
|
||||
map = mapView;
|
||||
map.setTileSource(tileSource());
|
||||
map.setBuiltInZoomControls(false);
|
||||
map.setTileSource(TileSourceFactory.MAPNIK);
|
||||
map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.NEVER);
|
||||
map.setMultiTouchControls(true);
|
||||
map.setTilesScaledToDpi(true);
|
||||
mapController = map.getController();
|
||||
|
@ -251,7 +234,7 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
|
|||
requestLocationUpdates();
|
||||
updateLocationMarkers();
|
||||
updateUi();
|
||||
map.setTileSource(tileSource());
|
||||
map.setTileSource(TileSourceFactory.MAPNIK);
|
||||
map.setTilesScaledToDpi(true);
|
||||
|
||||
if (mapAtInitialLoc()) {
|
||||
|
|
Loading…
Reference in New Issue