not suggest to download terrain if at least one map downloaded on the point
This commit is contained in:
parent
9cd8dc830c
commit
23fde2b150
2 changed files with 11 additions and 7 deletions
|
@ -513,16 +513,20 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
|
||||
public static List<IndexItem> findIndexItemsAt(OsmandApplication app, LatLon latLon, DownloadActivityType type, boolean includeDownloaded) throws IOException {
|
||||
return findIndexItemsAt(app, latLon, type, includeDownloaded, -1);
|
||||
return findIndexItemsAt(app, latLon, type, includeDownloaded, -1, false);
|
||||
}
|
||||
|
||||
public static List<IndexItem> findIndexItemsAt(OsmandApplication app, LatLon latLon, DownloadActivityType type, boolean includeDownloaded, int limit) throws IOException {
|
||||
public static List<IndexItem> findIndexItemsAt(OsmandApplication app, LatLon latLon, DownloadActivityType type, boolean includeDownloaded, int limit, boolean skipIfOneDownloaded) throws IOException {
|
||||
List<IndexItem> res = new ArrayList<>();
|
||||
OsmandRegions regions = app.getRegions();
|
||||
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||
List<WorldRegion> downloadRegions = regions.getWorldRegionsAt(latLon);
|
||||
for (WorldRegion downloadRegion : downloadRegions) {
|
||||
if (includeDownloaded || !isIndexItemDownloaded(downloadThread, type, downloadRegion, res)) {
|
||||
boolean itemDownloaded = isIndexItemDownloaded(downloadThread, type, downloadRegion, res);
|
||||
if (skipIfOneDownloaded && itemDownloaded) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (includeDownloaded || !itemDownloaded) {
|
||||
addIndexItem(downloadThread, type, downloadRegion, res);
|
||||
}
|
||||
if (limit != -1 && res.size() == limit) {
|
||||
|
|
|
@ -424,14 +424,14 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
|
|||
TerrainMode mode = srtmPlugin.getTerrainMode();
|
||||
IndexItem currentDownloadingItem = downloadThread.getCurrentDownloadingItem();
|
||||
int currentDownloadingProgress = downloadThread.getCurrentDownloadingItemProgress();
|
||||
List<IndexItem> hillshadeItems = DownloadResources.findIndexItemsAt(
|
||||
List<IndexItem> indexItemsAt = DownloadResources.findIndexItemsAt(
|
||||
app, ((MapActivity) mapActivity).getMapLocation(),
|
||||
mode == HILLSHADE ? HILLSHADE_FILE : SLOPE_FILE);
|
||||
if (hillshadeItems.size() > 0) {
|
||||
mode == HILLSHADE ? HILLSHADE_FILE : SLOPE_FILE, false, -1, true);
|
||||
if (indexItemsAt.size() > 0) {
|
||||
downloadContainer.setVisibility(View.VISIBLE);
|
||||
downloadTopDivider.setVisibility(View.VISIBLE);
|
||||
downloadBottomDivider.setVisibility(View.VISIBLE);
|
||||
for (final IndexItem indexItem : hillshadeItems) {
|
||||
for (final IndexItem indexItem : indexItemsAt) {
|
||||
ContextMenuItem.ItemBuilder itemBuilder = new ContextMenuItem.ItemBuilder()
|
||||
.setLayout(R.layout.list_item_icon_and_download)
|
||||
.setTitle(indexItem.getVisibleName(app, app.getRegions(), false))
|
||||
|
|
Loading…
Reference in a new issue