Fix context menu

This commit is contained in:
Alexey Kulish 2016-11-23 16:02:16 +03:00
parent 2227b9e963
commit 6fc0ce85e7

View file

@ -543,23 +543,25 @@ public abstract class MenuController extends BaseMenuController {
downloadMapDataObject = null; downloadMapDataObject = null;
for (BinaryMapDataObject o : mapDataObjects) { for (BinaryMapDataObject o : mapDataObjects) {
String downloadName = osmandRegions.getDownloadName(o); String downloadName = osmandRegions.getDownloadName(o);
String fullName = osmandRegions.getFullName(o); if (!Algorithms.isEmpty(downloadName)) {
WorldRegion region = osmandRegions.getRegionData(fullName);
if (!Algorithms.isEmpty(downloadName) && region.isRegionMapDownload()) {
boolean downloaded = checkIfObjectDownloaded(rm, downloadName); boolean downloaded = checkIfObjectDownloaded(rm, downloadName);
if (downloaded) { if (downloaded) {
downloadMapDataObject = null; downloadMapDataObject = null;
break; break;
} else { } else {
double area = OsmandRegions.getArea(o); String fullName = osmandRegions.getFullName(o);
if (smallestArea == -1) { WorldRegion region = osmandRegions.getRegionData(fullName);
smallestArea = area; if (region != null && region.isRegionMapDownload()) {
selectedFullName = fullName; double area = OsmandRegions.getArea(o);
downloadMapDataObject = o; if (smallestArea == -1) {
} else if (area < smallestArea) { smallestArea = area;
smallestArea = area; selectedFullName = fullName;
selectedFullName = fullName; downloadMapDataObject = o;
downloadMapDataObject = o; } else if (area < smallestArea) {
smallestArea = area;
selectedFullName = fullName;
downloadMapDataObject = o;
}
} }
} }
} }