Make sure we don't download maps with disabled plugin

This commit is contained in:
Victor Shcherb 2014-10-13 01:04:55 +02:00
parent 078505633b
commit 0e8da64cb5

View file

@ -6,8 +6,10 @@ import net.osmand.data.RotatedTileBox;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.util.MapUtils;
import android.graphics.Bitmap;
@ -146,8 +148,8 @@ public class MapTileLayer extends BaseMapLayer {
int width = (int) Math.ceil(tilesRect.right - left);
int height = (int) Math.ceil(tilesRect.bottom + ellipticTileCorrection - top);
boolean useInternet = settings.USE_INTERNET_TO_DOWNLOAD_TILES.get()
&& settings.isInternetConnectionAvailable() && map.couldBeDownloadedFromInternet();
boolean useInternet = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null &&
settings.USE_INTERNET_TO_DOWNLOAD_TILES.get() && settings.isInternetConnectionAvailable() && map.couldBeDownloadedFromInternet();
int maxLevel = Math.min(view.getSettings().MAX_LEVEL_TO_DOWNLOAD_TILE.get(), map.getMaximumZoomSupported());
int tileSize = map.getTileSize();
boolean oneTileShown = false;