Fix 2.6
This commit is contained in:
parent
49ebb0522d
commit
6b55a731c2
5 changed files with 23 additions and 9 deletions
|
@ -20,7 +20,6 @@ import android.support.v7.app.NotificationCompat;
|
|||
import android.support.v7.app.NotificationCompat.Builder;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.WorldRegion;
|
||||
|
@ -516,6 +515,11 @@ public class DownloadIndexesThread {
|
|||
if (DownloadActivityType.isCountedInDownloads(item)) {
|
||||
downloads.set(downloads.get() + 1);
|
||||
}
|
||||
if(item.getBasename().toLowerCase().equals(DownloadResources.WORLD_SEAMARKS_KEY)) {
|
||||
File oldFile = new File(app.getAppPath(IndexConstants.MAPS_PATH), DownloadResources.WORLD_SEAMARKS_OLD_NAME +
|
||||
IndexConstants.BINARY_MAP_INDEX_EXT);
|
||||
Algorithms.removeAllFiles(oldFile);
|
||||
}
|
||||
File bf = item.getBackupFile(app);
|
||||
if (bf.exists()) {
|
||||
Algorithms.removeAllFiles(bf);
|
||||
|
|
|
@ -32,8 +32,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
private List<IndexItem> rawResources;
|
||||
private Map<WorldRegion, List<IndexItem> > groupByRegion;
|
||||
private List<IndexItem> itemsToUpdate = new ArrayList<>();
|
||||
public static final String WORLD_SEAMARKS_KEY = "world_seamarks_basemap";
|
||||
|
||||
public static final String WORLD_SEAMARKS_KEY = "world_seamarks";
|
||||
public static final String WORLD_SEAMARKS_NAME = "World_seamarks";
|
||||
public static final String WORLD_SEAMARKS_OLD_KEY = "world_seamarks_basemap";
|
||||
public static final String WORLD_SEAMARKS_OLD_NAME = "World_seamarks_basemap";
|
||||
|
||||
public DownloadResources(OsmandApplication app) {
|
||||
super(null, DownloadResourceGroupType.WORLD, "");
|
||||
|
@ -293,7 +295,8 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
groupByRegion.get(wg).add(ii);
|
||||
} else {
|
||||
if (ii.getFileName().startsWith("World_")) {
|
||||
if (ii.getFileName().toLowerCase().startsWith(WORLD_SEAMARKS_KEY)) {
|
||||
if (ii.getFileName().toLowerCase().startsWith(WORLD_SEAMARKS_KEY) ||
|
||||
ii.getFileName().toLowerCase().startsWith(WORLD_SEAMARKS_OLD_KEY)) {
|
||||
nauticalMaps.addItem(ii);
|
||||
} else {
|
||||
worldMaps.addItem(ii);
|
||||
|
|
|
@ -306,7 +306,13 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
if (!email.equalsIgnoreCase(responseEmail)) {
|
||||
app.showShortToastMessage(activity.getString(R.string.shared_string_unexpected_error));
|
||||
} else {
|
||||
app.getSettings().NUMBER_OF_FREE_DOWNLOADS.set(DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS - 3);
|
||||
int newDownloads = app.getSettings().NUMBER_OF_FREE_DOWNLOADS.get().intValue() - 3;
|
||||
if(newDownloads < 0) {
|
||||
newDownloads = 0;
|
||||
} else if(newDownloads > DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS - 3) {
|
||||
newDownloads = DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS - 3;
|
||||
}
|
||||
app.getSettings().NUMBER_OF_FREE_DOWNLOADS.set(newDownloads);
|
||||
app.getSettings().EMAIL_SUBSCRIBED.set(true);
|
||||
hideSubscribeEmailView();
|
||||
activity.updateBanner();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
@ -217,7 +217,8 @@ public class FileNameTranslationHelper {
|
|||
return ctx.getString(R.string.index_item_world_basemap);
|
||||
} else if (basename.equals("world_bitcoin_payments")) {
|
||||
return ctx.getString(R.string.index_item_world_bitcoin_payments);
|
||||
} else if (basename.equals("world_seamarks_basemap")) {
|
||||
} else if (basename.equals(DownloadResources.WORLD_SEAMARKS_KEY) ||
|
||||
basename.equals(DownloadResources.WORLD_SEAMARKS_OLD_KEY)) {
|
||||
return ctx.getString(R.string.index_item_world_seamarks);
|
||||
} else if (basename.equals("depth_contours_osmand_ext")) {
|
||||
return ctx.getString(R.string.index_item_depth_contours_osmand_ext);
|
||||
|
|
|
@ -5,12 +5,12 @@ import android.content.DialogInterface;
|
|||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
import net.osmand.plus.render.RendererRegistry;
|
||||
|
||||
public class NauticalMapsPlugin extends OsmandPlugin {
|
||||
|
@ -56,7 +56,7 @@ public class NauticalMapsPlugin extends OsmandPlugin {
|
|||
// called from UI
|
||||
previousRenderer = app.getSettings().RENDERER.get();
|
||||
app.getSettings().RENDERER.set(RendererRegistry.NAUTICAL_RENDER);
|
||||
if(!app.getResourceManager().getIndexFileNames().containsKey("World_seamarks"+
|
||||
if(!app.getResourceManager().getIndexFileNames().containsKey(DownloadResources.WORLD_SEAMARKS_NAME+
|
||||
IndexConstants.BINARY_MAP_INDEX_EXT)){
|
||||
AlertDialog.Builder dlg = new AlertDialog.Builder(activity);
|
||||
dlg.setMessage(net.osmand.plus.R.string.nautical_maps_missing);
|
||||
|
|
Loading…
Reference in a new issue