From 8138eb0346f170159e68f64fb14d7fa16c9a18ed Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 4 Jul 2019 18:17:13 +0200 Subject: [PATCH] use more default values in LocationActivity fixes #3475 --- .../conversations/ui/LocationActivity.java | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java index 0367db8e1..2bddf5b2d 100644 --- a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java @@ -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()) {