Enable nautical maps for development

This commit is contained in:
Victor Shcherb 2015-02-15 21:58:56 +01:00
parent 987a29ec6a
commit 1a25b33100
3 changed files with 5 additions and 37 deletions

View file

@ -96,7 +96,8 @@ public class Version {
} }
public static boolean isDeveloperVersion(OsmandApplication ctx){ public static boolean isDeveloperVersion(OsmandApplication ctx){
return "osmand~".equalsIgnoreCase(getAppName(ctx)); return "osmand~".equalsIgnoreCase(getAppName(ctx)) ||
isProductionVersion(ctx);
} }

View file

@ -26,7 +26,7 @@ public class RendererRegistry {
public final static String DEFAULT_RENDER = "OsmAnd"; //$NON-NLS-1$ public final static String DEFAULT_RENDER = "OsmAnd"; //$NON-NLS-1$
public final static String NAUTICAL_RENDER = "Nautical"; //$NON-NLS-1$ public final static String NAUTICAL_RENDER = "Nautical"; //$NON-NLS-1$
public static final String WINTER_SKI_RENDER = "Winter-and-ski"; public static final String WINTER_SKI_RENDER = "Winter and ski";
private RenderingRulesStorage defaultRender = null; private RenderingRulesStorage defaultRender = null;
private RenderingRulesStorage currentSelectedRender = null; private RenderingRulesStorage currentSelectedRender = null;
@ -44,12 +44,11 @@ public class RendererRegistry {
public RendererRegistry(){ public RendererRegistry(){
internalRenderers.put(DEFAULT_RENDER, "default.render.xml"); internalRenderers.put(DEFAULT_RENDER, "default.render.xml");
internalRenderers.put("Touring-view_(more-contrast-and-details)", "Touring-view_(more-contrast-and-details)" +".render.xml");
internalRenderers.put("UniRS", "UniRS" + ".render.xml"); internalRenderers.put("UniRS", "UniRS" + ".render.xml");
internalRenderers.put("Touring view (contrast and details)", "Touring-view_(more-contrast-and-details)" +".render.xml");
internalRenderers.put("LightRS", "LightRS" + ".render.xml"); internalRenderers.put("LightRS", "LightRS" + ".render.xml");
internalRenderers.put("High-contrast-roads", "High-contrast-roads" + ".render.xml");
internalRenderers.put(WINTER_SKI_RENDER, "Winter-and-ski" + ".render.xml");
internalRenderers.put(NAUTICAL_RENDER, "nautical" + ".render.xml"); internalRenderers.put(NAUTICAL_RENDER, "nautical" + ".render.xml");
internalRenderers.put(WINTER_SKI_RENDER, "skimap" + ".render.xml");
} }
public RenderingRulesStorage defaultRender() { public RenderingRulesStorage defaultRender() {
@ -143,7 +142,6 @@ public class RendererRegistry {
return main; return main;
} }
@SuppressWarnings("resource")
public InputStream getInputStream(String name) throws FileNotFoundException { public InputStream getInputStream(String name) throws FileNotFoundException {
InputStream is; InputStream is;
if("default".equalsIgnoreCase(name)) { if("default".equalsIgnoreCase(name)) {

View file

@ -1,16 +1,9 @@
package net.osmand.plus.skimapsplugin; package net.osmand.plus.skimapsplugin;
import net.osmand.IndexConstants;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.render.RendererRegistry;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
public class SkiMapsPlugin extends OsmandPlugin { public class SkiMapsPlugin extends OsmandPlugin {
@ -40,30 +33,6 @@ public class SkiMapsPlugin extends OsmandPlugin {
// called from UI // called from UI
previousRenderer = app.getSettings().RENDERER.get(); previousRenderer = app.getSettings().RENDERER.get();
app.getSettings().RENDERER.set(RendererRegistry.WINTER_SKI_RENDER); app.getSettings().RENDERER.set(RendererRegistry.WINTER_SKI_RENDER);
if(!app.getResourceManager().getIndexFileNames().containsKey("World-ski"+
IndexConstants.BINARY_MAP_INDEX_EXT)){
Builder dlg = new AlertDialog.Builder(activity);
dlg.setMessage(net.osmand.plus.R.string.world_ski_missing);
dlg.setPositiveButton(net.osmand.plus.R.string.default_buttons_ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final Intent intent = new Intent(activity, app.getAppCustomization().getDownloadIndexActivity());
intent.putExtra(DownloadActivity.FILTER_KEY, app.getString(net.osmand.plus.R.string.index_item_world_ski));
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
activity.startActivity(intent);
}
});
dlg.setNegativeButton(net.osmand.plus.R.string.default_buttons_cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
app.getSettings().RENDERER.set(previousRenderer);
}
});
dlg.show();
}
} }
return true; return true;
} }