Fix osmand ant build/refactor exclude staff
This commit is contained in:
parent
cf487ee3ea
commit
85e9354a70
30 changed files with 3108 additions and 3125 deletions
2
DataExtractionOSM/.gitignore
vendored
2
DataExtractionOSM/.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
bin/
|
bin/
|
||||||
|
build/
|
||||||
|
build.zip
|
||||||
|
|
|
@ -23,10 +23,10 @@ import net.osmand.binary.OsmandOdb.TransportRoute;
|
||||||
import net.osmand.binary.OsmandOdb.TransportRouteStop;
|
import net.osmand.binary.OsmandOdb.TransportRouteStop;
|
||||||
import net.osmand.data.Building;
|
import net.osmand.data.Building;
|
||||||
import net.osmand.data.City;
|
import net.osmand.data.City;
|
||||||
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.data.MapObject;
|
import net.osmand.data.MapObject;
|
||||||
import net.osmand.data.Street;
|
import net.osmand.data.Street;
|
||||||
import net.osmand.data.TransportStop;
|
import net.osmand.data.TransportStop;
|
||||||
import net.osmand.data.index.IndexConstants;
|
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.osm.Node;
|
import net.osmand.osm.Node;
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
package net.osmand.data.index;
|
package net.osmand.data;
|
||||||
|
|
||||||
|
|
||||||
public class IndexConstants {
|
public class IndexConstants {
|
||||||
|
|
||||||
// Important : Every time you change schema of db upgrade version!!!
|
// Important : Every time you change schema of db upgrade version!!!
|
||||||
// If you want that new application support old index : put upgrade code in android app ResourceManager
|
// If you want that new application support old index : put upgrade code in android app ResourceManager
|
||||||
public final static int POI_TABLE_VERSION = 1;
|
public final static int POI_TABLE_VERSION = 1;
|
||||||
public final static int BINARY_MAP_VERSION = 1; // starts with 1
|
public final static int BINARY_MAP_VERSION = 1; // starts with 1
|
||||||
public final static int VOICE_VERSION = 0;
|
public final static int VOICE_VERSION = 0;
|
||||||
|
|
||||||
public static final String POI_INDEX_DIR = "POI/"; //$NON-NLS-1$
|
public static final String POI_INDEX_DIR = "POI/"; //$NON-NLS-1$
|
||||||
public static final String VOICE_INDEX_DIR = "voice/"; //$NON-NLS-1$
|
public static final String VOICE_INDEX_DIR = "voice/"; //$NON-NLS-1$
|
||||||
public static final String RENDERERS_DIR = "rendering/"; //$NON-NLS-1$
|
public static final String RENDERERS_DIR = "rendering/"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String POI_INDEX_EXT = ".poi.odb"; //$NON-NLS-1$
|
public static final String POI_INDEX_EXT = ".poi.odb"; //$NON-NLS-1$
|
||||||
public static final String BINARY_MAP_INDEX_EXT = ".obf"; //$NON-NLS-1$
|
public static final String BINARY_MAP_INDEX_EXT = ".obf"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String POI_INDEX_EXT_ZIP = ".poi.zip"; //$NON-NLS-1$
|
public static final String POI_INDEX_EXT_ZIP = ".poi.zip"; //$NON-NLS-1$
|
||||||
public static final String VOICE_INDEX_EXT_ZIP = ".voice.zip"; //$NON-NLS-1$
|
public static final String VOICE_INDEX_EXT_ZIP = ".voice.zip"; //$NON-NLS-1$
|
||||||
public static final String BINARY_MAP_INDEX_EXT_ZIP = ".obf.zip"; //$NON-NLS-1$
|
public static final String BINARY_MAP_INDEX_EXT_ZIP = ".obf.zip"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String RENDERER_INDEX_EXT = ".render.xml"; //$NON-NLS-1$
|
public static final String RENDERER_INDEX_EXT = ".render.xml"; //$NON-NLS-1$
|
||||||
|
|
||||||
public final static String POI_TABLE = "poi"; //$NON-NLS-1$
|
public final static String POI_TABLE = "poi"; //$NON-NLS-1$
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.data.preparation;
|
package net.osmand.data;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
|
@ -1,10 +1,10 @@
|
||||||
package net.osmand.data.index;
|
package net.osmand.data.index;
|
||||||
|
|
||||||
import static net.osmand.data.index.IndexConstants.BINARY_MAP_INDEX_EXT;
|
import static net.osmand.data.IndexConstants.BINARY_MAP_INDEX_EXT;
|
||||||
import static net.osmand.data.index.IndexConstants.BINARY_MAP_INDEX_EXT_ZIP;
|
import static net.osmand.data.IndexConstants.BINARY_MAP_INDEX_EXT_ZIP;
|
||||||
import static net.osmand.data.index.IndexConstants.BINARY_MAP_VERSION;
|
import static net.osmand.data.IndexConstants.BINARY_MAP_VERSION;
|
||||||
import static net.osmand.data.index.IndexConstants.VOICE_INDEX_EXT_ZIP;
|
import static net.osmand.data.IndexConstants.VOICE_INDEX_EXT_ZIP;
|
||||||
import static net.osmand.data.index.IndexConstants.VOICE_VERSION;
|
import static net.osmand.data.IndexConstants.VOICE_VERSION;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
|
|
|
@ -18,42 +18,43 @@ import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.data.preparation.IndexCreator;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.data.preparation.MapZooms;
|
import net.osmand.data.preparation.IndexCreator;
|
||||||
import net.osmand.impl.ConsoleProgressImplementation;
|
import net.osmand.data.preparation.MapZooms;
|
||||||
import net.osmand.osm.MapRenderingTypes;
|
import net.osmand.impl.ConsoleProgressImplementation;
|
||||||
|
import net.osmand.osm.MapRenderingTypes;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.w3c.dom.Document;
|
import org.apache.commons.logging.Log;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.Element;
|
||||||
import org.xml.sax.SAXException;
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
import rtree.RTree;
|
|
||||||
|
import rtree.RTree;
|
||||||
|
|
||||||
|
|
||||||
public class IndexBatchCreator {
|
|
||||||
|
public class IndexBatchCreator {
|
||||||
|
|
||||||
protected static final Log log = LogUtil.getLog(IndexBatchCreator.class);
|
|
||||||
|
protected static final Log log = LogUtil.getLog(IndexBatchCreator.class);
|
||||||
private final static double MIN_SIZE_TO_UPLOAD = 0.015d;
|
private final static double MIN_SIZE_TO_UPLOAD = 0.015d;
|
||||||
private final static double MIN_SIZE_TO_NOT_ZIP = 2d;
|
private final static double MIN_SIZE_TO_NOT_ZIP = 2d;
|
||||||
private final static double MAX_SIZE_TO_NOT_SPLIT = 190d;
|
private final static double MAX_SIZE_TO_NOT_SPLIT = 190d;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.data.index.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.osm.Entity;
|
import net.osmand.osm.Entity;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.osm.OSMSettings.OSMTagKey;
|
import net.osmand.osm.OSMSettings.OSMTagKey;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package net.osmand;
|
package net.osmand.swing;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import net.osmand.swing.OsmExtractionUI;
|
import net.osmand.LogUtil;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
|
@ -40,9 +40,9 @@ import javax.swing.UIManager;
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.data.DataTileManager;
|
import net.osmand.data.DataTileManager;
|
||||||
import net.osmand.data.preparation.MapTileDownloader;
|
import net.osmand.data.MapTileDownloader;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.map.IMapLocationListener;
|
import net.osmand.map.IMapLocationListener;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager;
|
import net.osmand.map.TileSourceManager;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import net.osmand.ExceptionHandler;
|
|
||||||
import net.osmand.binary.BinaryMapDataObject;
|
import net.osmand.binary.BinaryMapDataObject;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.binary.BinaryRouteDataReader;
|
import net.osmand.binary.BinaryRouteDataReader;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,10 +24,9 @@ import javax.swing.SpinnerNumberModel;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
import net.osmand.ExceptionHandler;
|
import net.osmand.data.MapTileDownloader;
|
||||||
import net.osmand.data.preparation.MapTileDownloader;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.IMapDownloaderCallback;
|
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.swing.MapPanel.MapSelectionArea;
|
import net.osmand.swing.MapPanel.MapSelectionArea;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry excluding="net/osmand/ExceptionHandler.java|net/osmand/LogUtil.java|net/osmand/osm/io/OsmStorageWriter.java|net/osmand/osm/util/|net/osmand/swing/|net/osmand/data/index/IndexBatchCreator.java|net/osmand/data/preparation/DataExtraction.java|net/osmand/data/preparation/IndexCreator.java|rtree/|net/osmand/data/index/DataIndexWriter.java|net/osmand/data/preparation/OsmDbCreator.java|net/osmand/data/preparation/IndexTransportCreator.java|net/osmand/data/preparation/AbstractIndexPartCreator.java|net/osmand/data/preparation/DBDialect.java|net/osmand/data/preparation/IndexAddressCreator.java|net/osmand/data/preparation/IndexPoiCreator.java|net/osmand/data/preparation/IndexVectorMapCreator.java|net/osmand/data/preparation/MapSwingAlgorithms.java|net/osmand/data/preparation/OsmDbAccessor.java|net/osmand/data/preparation/OsmDbAccessorContext.java" kind="src" path="use"/>
|
<classpathentry excluding="net/osmand/LogUtil.java|net/osmand/swing/|net/osmand/data/preparation/|net/osmand/osm/util/|net/osmand/data/index/|net/osmand/osm/io/OsmStorageWriter.java" kind="src" path="use"/>
|
||||||
<classpathentry kind="src" path="gen"/>
|
<classpathentry kind="src" path="gen"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry kind="lib" path="lib/bzip2-20090327.jar"/>
|
<classpathentry kind="lib" path="lib/bzip2-20090327.jar"/>
|
||||||
|
|
1
OsmAnd/.gitignore
vendored
1
OsmAnd/.gitignore
vendored
|
@ -2,3 +2,4 @@ bin/
|
||||||
gen/
|
gen/
|
||||||
assets/
|
assets/
|
||||||
local.properties
|
local.properties
|
||||||
|
raw/
|
||||||
|
|
|
@ -129,16 +129,14 @@
|
||||||
<src path="${source.absolute.dir}" />
|
<src path="${source.absolute.dir}" />
|
||||||
<!-- osmchange -->
|
<!-- osmchange -->
|
||||||
<src path="${use.absolute.dir}" />
|
<src path="${use.absolute.dir}" />
|
||||||
<exclude name="**/ExceptionHandler.java" />
|
|
||||||
<exclude name="**/LogUtil.java" />
|
<exclude name="**/LogUtil.java" />
|
||||||
<exclude name="**/DataIndexWriter.java" />
|
|
||||||
<exclude name="**/IndexBatchCreator.java" />
|
|
||||||
<exclude name="**/DataExtraction.java" />
|
|
||||||
<exclude name="**/IndexCreator.java" />
|
|
||||||
<exclude name="**/OsmStorageWriter.java" />
|
<exclude name="**/OsmStorageWriter.java" />
|
||||||
|
<exclude name="**/net/osmand/data/index/" />
|
||||||
|
<exclude name="**/net/osmand/data/preparation/" />
|
||||||
<exclude name="**/net/osmand/osm/util/" />
|
<exclude name="**/net/osmand/osm/util/" />
|
||||||
<exclude name="**/net/osmand/swing/" />
|
<exclude name="**/net/osmand/swing/" />
|
||||||
<exclude name="**/rtree/" />
|
<exclude name="**/rtree/" />
|
||||||
|
|
||||||
<!-- osmchange -->
|
<!-- osmchange -->
|
||||||
<src path="${gen.absolute.dir}" />
|
<src path="${gen.absolute.dir}" />
|
||||||
<src refid="project.libraries.src" />
|
<src refid="project.libraries.src" />
|
||||||
|
|
|
@ -1,215 +1,216 @@
|
||||||
package net.osmand;
|
package net.osmand;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
import org.xmlpull.v1.XmlSerializer;
|
import org.xmlpull.v1.XmlSerializer;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
|
|
||||||
public class GPXUtilities {
|
public class GPXUtilities {
|
||||||
public final static Log log = LogUtil.getLog(GPXUtilities.class);
|
public final static Log log = LogUtil.getLog(GPXUtilities.class);
|
||||||
|
|
||||||
|
|
||||||
private final static String GPX_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
|
private final static String GPX_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
|
||||||
|
|
||||||
private final static NumberFormat latLonFormat = new DecimalFormat("0.00#####", new DecimalFormatSymbols(Locale.US));
|
private final static NumberFormat latLonFormat = new DecimalFormat("0.00#####", new DecimalFormatSymbols(Locale.US));
|
||||||
|
|
||||||
public static class TrkPt {
|
public static class TrkPt {
|
||||||
public double lat;
|
public double lat;
|
||||||
public double lon;
|
public double lon;
|
||||||
public double ele;
|
public double ele;
|
||||||
public double speed;
|
public double speed;
|
||||||
public long time;
|
public long time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class WptPt {
|
public static class WptPt {
|
||||||
public double lat;
|
public double lat;
|
||||||
public double lon;
|
public double lon;
|
||||||
public String name;
|
public String name;
|
||||||
// by default
|
// by default
|
||||||
public long time = 0;
|
public long time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TrkSegment {
|
public static class TrkSegment {
|
||||||
public List<TrkPt> points = new ArrayList<TrkPt>();
|
public List<TrkPt> points = new ArrayList<TrkPt>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Track {
|
public static class Track {
|
||||||
public List<TrkSegment> segments = new ArrayList<TrkSegment>();
|
public List<TrkSegment> segments = new ArrayList<TrkSegment>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GPXFile {
|
public static class GPXFile {
|
||||||
public List<Track> tracks = new ArrayList<Track>();
|
public List<Track> tracks = new ArrayList<Track>();
|
||||||
public List<WptPt> points = new ArrayList<WptPt>();
|
public List<WptPt> points = new ArrayList<WptPt>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String writeGpxFile(File fout, GPXFile file, Context ctx) {
|
public static String writeGpxFile(File fout, GPXFile file, Context ctx) {
|
||||||
try {
|
try {
|
||||||
SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT);
|
SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT);
|
||||||
format.setTimeZone(TimeZone.getTimeZone("UTC"));
|
format.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
FileOutputStream output = new FileOutputStream(fout);
|
FileOutputStream output = new FileOutputStream(fout);
|
||||||
XmlSerializer serializer = Xml.newSerializer();
|
XmlSerializer serializer = Xml.newSerializer();
|
||||||
serializer.setOutput(output, "UTF-8"); //$NON-NLS-1$
|
serializer.setOutput(output, "UTF-8"); //$NON-NLS-1$
|
||||||
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); //$NON-NLS-1$
|
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); //$NON-NLS-1$
|
||||||
serializer.startDocument("UTF-8", true); //$NON-NLS-1$
|
serializer.startDocument("UTF-8", true); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "gpx"); //$NON-NLS-1$
|
serializer.startTag(null, "gpx"); //$NON-NLS-1$
|
||||||
serializer.attribute(null, "version", "1.1"); //$NON-NLS-1$ //$NON-NLS-2$
|
serializer.attribute(null, "version", "1.1"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.attribute(null, "creator", Version.APP_NAME_VERSION); //$NON-NLS-1$
|
serializer.attribute(null, "creator", Version.APP_NAME_VERSION); //$NON-NLS-1$
|
||||||
serializer.attribute(null, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
serializer.attribute(null, "xmlns", "http://www.topografix.com/GPX/1/1"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.attribute(null, "xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
|
serializer.attribute(null, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||||
|
serializer.attribute(null, "xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
|
||||||
|
|
||||||
for (Track track : file.tracks) {
|
|
||||||
serializer.startTag(null, "trk"); //$NON-NLS-1$
|
for (Track track : file.tracks) {
|
||||||
for (TrkSegment segment : track.segments) {
|
serializer.startTag(null, "trk"); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "trkseg"); //$NON-NLS-1$
|
for (TrkSegment segment : track.segments) {
|
||||||
for (TrkPt p : segment.points) {
|
serializer.startTag(null, "trkseg"); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "trkpt"); //$NON-NLS-1$
|
for (TrkPt p : segment.points) {
|
||||||
serializer.attribute(null, "lat", latLonFormat.format(p.lat)); //$NON-NLS-1$ //$NON-NLS-2$
|
serializer.startTag(null, "trkpt"); //$NON-NLS-1$
|
||||||
serializer.attribute(null, "lon", latLonFormat.format(p.lon)); //$NON-NLS-1$ //$NON-NLS-2$
|
serializer.attribute(null, "lat", latLonFormat.format(p.lat)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.startTag(null, "ele"); //$NON-NLS-1$
|
serializer.attribute(null, "lon", latLonFormat.format(p.lon)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.text(p.ele + ""); //$NON-NLS-1$
|
serializer.startTag(null, "ele"); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "ele"); //$NON-NLS-1$
|
serializer.text(p.ele + ""); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "time"); //$NON-NLS-1$
|
serializer.endTag(null, "ele"); //$NON-NLS-1$
|
||||||
serializer.text(format.format(new Date(p.time)));
|
serializer.startTag(null, "time"); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "time"); //$NON-NLS-1$
|
serializer.text(format.format(new Date(p.time)));
|
||||||
if (p.speed > 0) {
|
serializer.endTag(null, "time"); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "extensions");
|
if (p.speed > 0) {
|
||||||
serializer.startTag(null, "speed"); //$NON-NLS-1$
|
serializer.startTag(null, "extensions");
|
||||||
serializer.text(p.speed + ""); //$NON-NLS-1$
|
serializer.startTag(null, "speed"); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "speed"); //$NON-NLS-1$
|
serializer.text(p.speed + ""); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "extensions");
|
serializer.endTag(null, "speed"); //$NON-NLS-1$
|
||||||
}
|
serializer.endTag(null, "extensions");
|
||||||
|
}
|
||||||
serializer.endTag(null, "trkpt"); //$NON-NLS-1$
|
|
||||||
}
|
serializer.endTag(null, "trkpt"); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "trkseg"); //$NON-NLS-1$
|
}
|
||||||
}
|
serializer.endTag(null, "trkseg"); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "trk"); //$NON-NLS-1$
|
}
|
||||||
}
|
serializer.endTag(null, "trk"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
for (WptPt l : file.points) {
|
|
||||||
serializer.startTag(null, "wpt"); //$NON-NLS-1$
|
for (WptPt l : file.points) {
|
||||||
serializer.attribute(null, "lat", latLonFormat.format(l.lat)); //$NON-NLS-1$
|
serializer.startTag(null, "wpt"); //$NON-NLS-1$
|
||||||
serializer.attribute(null, "lon", latLonFormat.format(l.lon)); //$NON-NLS-1$ //$NON-NLS-2$
|
serializer.attribute(null, "lat", latLonFormat.format(l.lat)); //$NON-NLS-1$
|
||||||
if (l.time != 0) {
|
serializer.attribute(null, "lon", latLonFormat.format(l.lon)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.startTag(null, "time"); //$NON-NLS-1$
|
if (l.time != 0) {
|
||||||
serializer.text(format.format(new Date(l.time)));
|
serializer.startTag(null, "time"); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "time"); //$NON-NLS-1$
|
serializer.text(format.format(new Date(l.time)));
|
||||||
}
|
serializer.endTag(null, "time"); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "name"); //$NON-NLS-1$
|
}
|
||||||
serializer.text(l.name);
|
serializer.startTag(null, "name"); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "name"); //$NON-NLS-1$
|
serializer.text(l.name);
|
||||||
serializer.endTag(null, "wpt"); //$NON-NLS-1$
|
serializer.endTag(null, "name"); //$NON-NLS-1$
|
||||||
}
|
serializer.endTag(null, "wpt"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
serializer.endTag(null, "gpx"); //$NON-NLS-1$
|
|
||||||
serializer.flush();
|
serializer.endTag(null, "gpx"); //$NON-NLS-1$
|
||||||
serializer.endDocument();
|
serializer.flush();
|
||||||
} catch (RuntimeException e) {
|
serializer.endDocument();
|
||||||
log.error("Error saving gpx", e); //$NON-NLS-1$
|
} catch (RuntimeException e) {
|
||||||
return ctx.getString(R.string.error_occurred_saving_gpx);
|
log.error("Error saving gpx", e); //$NON-NLS-1$
|
||||||
} catch (IOException e) {
|
return ctx.getString(R.string.error_occurred_saving_gpx);
|
||||||
log.error("Error saving gpx", e); //$NON-NLS-1$
|
} catch (IOException e) {
|
||||||
return ctx.getString(R.string.error_occurred_saving_gpx);
|
log.error("Error saving gpx", e); //$NON-NLS-1$
|
||||||
}
|
return ctx.getString(R.string.error_occurred_saving_gpx);
|
||||||
return null;
|
}
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static class GPXFileResult {
|
|
||||||
public ArrayList<List<Location>> locations = new ArrayList<List<Location>>();
|
public static class GPXFileResult {
|
||||||
public ArrayList<WptPt> wayPoints = new ArrayList<WptPt>();
|
public ArrayList<List<Location>> locations = new ArrayList<List<Location>>();
|
||||||
// special case for cloudmate gpx : they discourage common schema
|
public ArrayList<WptPt> wayPoints = new ArrayList<WptPt>();
|
||||||
// by using waypoint as track points and rtept are not very close to real way
|
// special case for cloudmate gpx : they discourage common schema
|
||||||
// such as wpt. However they provide additional information into gpx.
|
// by using waypoint as track points and rtept are not very close to real way
|
||||||
public boolean cloudMadeFile;
|
// such as wpt. However they provide additional information into gpx.
|
||||||
public String error;
|
public boolean cloudMadeFile;
|
||||||
}
|
public String error;
|
||||||
|
}
|
||||||
public static GPXFileResult loadGPXFile(Context ctx, File f){
|
|
||||||
GPXFileResult res = new GPXFileResult();
|
public static GPXFileResult loadGPXFile(Context ctx, File f){
|
||||||
try {
|
GPXFileResult res = new GPXFileResult();
|
||||||
boolean cloudMade = false;
|
try {
|
||||||
XmlPullParser parser = Xml.newPullParser();
|
boolean cloudMade = false;
|
||||||
parser.setInput(new FileInputStream(f), "UTF-8"); //$NON-NLS-1$
|
XmlPullParser parser = Xml.newPullParser();
|
||||||
|
parser.setInput(new FileInputStream(f), "UTF-8"); //$NON-NLS-1$
|
||||||
int tok;
|
|
||||||
Location current = null;
|
int tok;
|
||||||
String currentName = ""; //$NON-NLS-1$
|
Location current = null;
|
||||||
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
String currentName = ""; //$NON-NLS-1$
|
||||||
if (tok == XmlPullParser.START_TAG) {
|
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
||||||
if (parser.getName().equals("copyright")) { //$NON-NLS-1$
|
if (tok == XmlPullParser.START_TAG) {
|
||||||
cloudMade |= "cloudmade".equalsIgnoreCase(parser.getAttributeValue("", "author")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
if (parser.getName().equals("copyright")) { //$NON-NLS-1$
|
||||||
|
cloudMade |= "cloudmade".equalsIgnoreCase(parser.getAttributeValue("", "author")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
} else if (parser.getName().equals("trkseg")) { //$NON-NLS-1$
|
|
||||||
res.locations.add(new ArrayList<Location>());
|
} else if (parser.getName().equals("trkseg")) { //$NON-NLS-1$
|
||||||
} else if (parser.getName().equals("wpt") || parser.getName().equals("trkpt") || //$NON-NLS-1$//$NON-NLS-2$
|
res.locations.add(new ArrayList<Location>());
|
||||||
(!cloudMade && parser.getName().equals("rtept"))) { //$NON-NLS-1$
|
} else if (parser.getName().equals("wpt") || parser.getName().equals("trkpt") || //$NON-NLS-1$//$NON-NLS-2$
|
||||||
// currently not distinguish different point represents all as a line
|
(!cloudMade && parser.getName().equals("rtept"))) { //$NON-NLS-1$
|
||||||
try {
|
// currently not distinguish different point represents all as a line
|
||||||
currentName = ""; //$NON-NLS-1$
|
try {
|
||||||
current = new Location("gpx_file"); //$NON-NLS-1$
|
currentName = ""; //$NON-NLS-1$
|
||||||
current.setLatitude(Double.parseDouble(parser.getAttributeValue("", "lat"))); //$NON-NLS-1$ //$NON-NLS-2$
|
current = new Location("gpx_file"); //$NON-NLS-1$
|
||||||
current.setLongitude(Double.parseDouble(parser.getAttributeValue("", "lon"))); //$NON-NLS-1$ //$NON-NLS-2$
|
current.setLatitude(Double.parseDouble(parser.getAttributeValue("", "lat"))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
} catch (NumberFormatException e) {
|
current.setLongitude(Double.parseDouble(parser.getAttributeValue("", "lon"))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
current = null;
|
} catch (NumberFormatException e) {
|
||||||
|
current = null;
|
||||||
}
|
|
||||||
} else if (current != null && parser.getName().equals("name")) { //$NON-NLS-1$
|
}
|
||||||
if (parser.next() == XmlPullParser.TEXT) {
|
} else if (current != null && parser.getName().equals("name")) { //$NON-NLS-1$
|
||||||
currentName = parser.getText();
|
if (parser.next() == XmlPullParser.TEXT) {
|
||||||
}
|
currentName = parser.getText();
|
||||||
}
|
}
|
||||||
} else if (tok == XmlPullParser.END_TAG) {
|
}
|
||||||
if (parser.getName().equals("wpt") || //$NON-NLS-1$
|
} else if (tok == XmlPullParser.END_TAG) {
|
||||||
parser.getName().equals("trkpt") || (!cloudMade && parser.getName().equals("rtept"))) { //$NON-NLS-1$ //$NON-NLS-2$
|
if (parser.getName().equals("wpt") || //$NON-NLS-1$
|
||||||
if (current != null) {
|
parser.getName().equals("trkpt") || (!cloudMade && parser.getName().equals("rtept"))) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if (parser.getName().equals("wpt") && !cloudMade) { //$NON-NLS-1$
|
if (current != null) {
|
||||||
WptPt pt = new WptPt();
|
if (parser.getName().equals("wpt") && !cloudMade) { //$NON-NLS-1$
|
||||||
pt.lat = current.getLatitude();
|
WptPt pt = new WptPt();
|
||||||
pt.lon = current.getLongitude();
|
pt.lat = current.getLatitude();
|
||||||
pt.name = currentName;
|
pt.lon = current.getLongitude();
|
||||||
res.wayPoints.add(pt);
|
pt.name = currentName;
|
||||||
} else {
|
res.wayPoints.add(pt);
|
||||||
if (res.locations.isEmpty()) {
|
} else {
|
||||||
res.locations.add(new ArrayList<Location>());
|
if (res.locations.isEmpty()) {
|
||||||
}
|
res.locations.add(new ArrayList<Location>());
|
||||||
res.locations.get(res.locations.size() - 1).add(current);
|
}
|
||||||
}
|
res.locations.get(res.locations.size() - 1).add(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (XmlPullParserException e) {
|
}
|
||||||
log.error("Error reading gpx", e); //$NON-NLS-1$
|
} catch (XmlPullParserException e) {
|
||||||
res.error = ctx.getString(R.string.error_reading_gpx);
|
log.error("Error reading gpx", e); //$NON-NLS-1$
|
||||||
} catch (IOException e) {
|
res.error = ctx.getString(R.string.error_reading_gpx);
|
||||||
log.error("Error reading gpx", e); //$NON-NLS-1$
|
} catch (IOException e) {
|
||||||
res.error = ctx.getString(R.string.error_reading_gpx);
|
log.error("Error reading gpx", e); //$NON-NLS-1$
|
||||||
}
|
res.error = ctx.getString(R.string.error_reading_gpx);
|
||||||
|
}
|
||||||
return res;
|
|
||||||
}
|
return res;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
|
@ -7,7 +7,6 @@ import net.osmand.data.AmenityType;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class OsmAndFormatter {
|
public class OsmAndFormatter {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import net.osmand.IProgress;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.data.index.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.osm.Entity;
|
import net.osmand.osm.Entity;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.data.index.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Set;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.data.index.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.activities.OsmandApplication;
|
import net.osmand.plus.activities.OsmandApplication;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,174 +1,174 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
import static net.osmand.data.index.IndexConstants.BINARY_MAP_INDEX_EXT;
|
import static net.osmand.data.IndexConstants.BINARY_MAP_INDEX_EXT;
|
||||||
import static net.osmand.data.index.IndexConstants.BINARY_MAP_INDEX_EXT_ZIP;
|
import static net.osmand.data.IndexConstants.BINARY_MAP_INDEX_EXT_ZIP;
|
||||||
import static net.osmand.data.index.IndexConstants.BINARY_MAP_VERSION;
|
import static net.osmand.data.IndexConstants.BINARY_MAP_VERSION;
|
||||||
import static net.osmand.data.index.IndexConstants.POI_INDEX_EXT;
|
import static net.osmand.data.IndexConstants.POI_INDEX_EXT;
|
||||||
import static net.osmand.data.index.IndexConstants.POI_INDEX_EXT_ZIP;
|
import static net.osmand.data.IndexConstants.POI_INDEX_EXT_ZIP;
|
||||||
import static net.osmand.data.index.IndexConstants.POI_TABLE_VERSION;
|
import static net.osmand.data.IndexConstants.POI_TABLE_VERSION;
|
||||||
import static net.osmand.data.index.IndexConstants.VOICE_INDEX_EXT_ZIP;
|
import static net.osmand.data.IndexConstants.VOICE_INDEX_EXT_ZIP;
|
||||||
import static net.osmand.data.index.IndexConstants.VOICE_VERSION;
|
import static net.osmand.data.IndexConstants.VOICE_VERSION;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.data.index.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.plus.DownloadOsmandIndexesHelper;
|
import net.osmand.plus.DownloadOsmandIndexesHelper;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.ProgressDialogImplementation;
|
import net.osmand.plus.ProgressDialogImplementation;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
import net.osmand.plus.DownloadOsmandIndexesHelper.IndexItem;
|
import net.osmand.plus.DownloadOsmandIndexesHelper.IndexItem;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Filter;
|
import android.widget.Filter;
|
||||||
import android.widget.Filterable;
|
import android.widget.Filterable;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class DownloadIndexActivity extends ListActivity {
|
public class DownloadIndexActivity extends ListActivity {
|
||||||
|
|
||||||
private final static Log log = LogUtil.getLog(DownloadIndexActivity.class);
|
private final static Log log = LogUtil.getLog(DownloadIndexActivity.class);
|
||||||
private static final int RELOAD_ID = 0;
|
private static final int RELOAD_ID = 0;
|
||||||
private static final int SELECT_ALL_ID = 1;
|
private static final int SELECT_ALL_ID = 1;
|
||||||
private static final int DESELECT_ALL_ID = 2;
|
private static final int DESELECT_ALL_ID = 2;
|
||||||
private static final int FILTER_EXISTING_REGIONS = 3;
|
private static final int FILTER_EXISTING_REGIONS = 3;
|
||||||
|
|
||||||
private static DownloadIndexListThread downloadListIndexThread = new DownloadIndexListThread();
|
private static DownloadIndexListThread downloadListIndexThread = new DownloadIndexListThread();
|
||||||
|
|
||||||
private ProgressDialog progressFileDlg = null;
|
private ProgressDialog progressFileDlg = null;
|
||||||
private ProgressDialog progressListDlg = null;
|
private ProgressDialog progressListDlg = null;
|
||||||
private Map<String, String> indexFileNames = null;
|
private Map<String, String> indexFileNames = null;
|
||||||
private LinkedHashMap<String, DownloadEntry> entriesToDownload = new LinkedHashMap<String, DownloadEntry>();
|
private LinkedHashMap<String, DownloadEntry> entriesToDownload = new LinkedHashMap<String, DownloadEntry>();
|
||||||
private TextWatcher textWatcher = new TextWatcher() {
|
private TextWatcher textWatcher = new TextWatcher() {
|
||||||
|
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||||
int after) {
|
int after) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before,
|
public void onTextChanged(CharSequence s, int start, int before,
|
||||||
int count) {
|
int count) {
|
||||||
DownloadIndexAdapter adapter = ((DownloadIndexAdapter)getListAdapter());
|
DownloadIndexAdapter adapter = ((DownloadIndexAdapter)getListAdapter());
|
||||||
if(adapter != null){
|
if(adapter != null){
|
||||||
adapter.getFilter().filter(s);
|
adapter.getFilter().filter(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
// recreation upon rotation is prevented in manifest file
|
// recreation upon rotation is prevented in manifest file
|
||||||
setContentView(R.layout.download_index);
|
setContentView(R.layout.download_index);
|
||||||
findViewById(R.id.DownloadButton).setOnClickListener(new View.OnClickListener(){
|
findViewById(R.id.DownloadButton).setOnClickListener(new View.OnClickListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
downloadFiles();
|
downloadFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
indexFileNames = ((OsmandApplication)getApplication()).getResourceManager().getIndexFileNames();
|
indexFileNames = ((OsmandApplication)getApplication()).getResourceManager().getIndexFileNames();
|
||||||
|
|
||||||
EditText filterText = (EditText) findViewById(R.id.search_box);
|
EditText filterText = (EditText) findViewById(R.id.search_box);
|
||||||
filterText.addTextChangedListener(textWatcher);
|
filterText.addTextChangedListener(textWatcher);
|
||||||
|
|
||||||
if(downloadListIndexThread.getCachedIndexFiles() != null){
|
if(downloadListIndexThread.getCachedIndexFiles() != null){
|
||||||
setListAdapter(new DownloadIndexAdapter(downloadListIndexThread.getCachedIndexFiles()));
|
setListAdapter(new DownloadIndexAdapter(downloadListIndexThread.getCachedIndexFiles()));
|
||||||
} else {
|
} else {
|
||||||
downloadIndexList();
|
downloadIndexList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadIndexList() {
|
private void downloadIndexList() {
|
||||||
progressListDlg = ProgressDialog.show(this, getString(R.string.downloading), getString(R.string.downloading_list_indexes));
|
progressListDlg = ProgressDialog.show(this, getString(R.string.downloading), getString(R.string.downloading_list_indexes));
|
||||||
progressListDlg.setCancelable(true);
|
progressListDlg.setCancelable(true);
|
||||||
downloadListIndexThread.setUiActivity(this);
|
downloadListIndexThread.setUiActivity(this);
|
||||||
if(downloadListIndexThread.getState() == Thread.State.NEW){
|
if(downloadListIndexThread.getState() == Thread.State.NEW){
|
||||||
downloadListIndexThread.start();
|
downloadListIndexThread.start();
|
||||||
} else if(downloadListIndexThread.getState() == Thread.State.TERMINATED){
|
} else if(downloadListIndexThread.getState() == Thread.State.TERMINATED){
|
||||||
// possibly exception occurred we don't have cache of files
|
// possibly exception occurred we don't have cache of files
|
||||||
downloadListIndexThread = new DownloadIndexListThread();
|
downloadListIndexThread = new DownloadIndexListThread();
|
||||||
downloadListIndexThread.setUiActivity(this);
|
downloadListIndexThread.setUiActivity(this);
|
||||||
downloadListIndexThread.start();
|
downloadListIndexThread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
super.onPrepareOptionsMenu(menu);
|
super.onPrepareOptionsMenu(menu);
|
||||||
menu.clear();
|
menu.clear();
|
||||||
menu.add(0, RELOAD_ID, 0, R.string.reload);
|
menu.add(0, RELOAD_ID, 0, R.string.reload);
|
||||||
if (getListAdapter() != null) {
|
if (getListAdapter() != null) {
|
||||||
// item.setIcon(R.drawable.ic_menu_refresh);
|
// item.setIcon(R.drawable.ic_menu_refresh);
|
||||||
menu.add(0, SELECT_ALL_ID, 0, R.string.select_all);
|
menu.add(0, SELECT_ALL_ID, 0, R.string.select_all);
|
||||||
menu.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all);
|
menu.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all);
|
||||||
menu.add(0, FILTER_EXISTING_REGIONS, 0, R.string.filter_existing_indexes);
|
menu.add(0, FILTER_EXISTING_REGIONS, 0, R.string.filter_existing_indexes);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if(item.getItemId() == RELOAD_ID){
|
if(item.getItemId() == RELOAD_ID){
|
||||||
//re-create the thread
|
//re-create the thread
|
||||||
downloadListIndexThread = new DownloadIndexListThread();
|
downloadListIndexThread = new DownloadIndexListThread();
|
||||||
downloadIndexList();
|
downloadIndexList();
|
||||||
} else {
|
} else {
|
||||||
final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter)getListAdapter();
|
final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter)getListAdapter();
|
||||||
if(item.getItemId() == SELECT_ALL_ID){
|
if(item.getItemId() == SELECT_ALL_ID){
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
for (int i = 0; i < listAdapter.getCount(); i++) {
|
for (int i = 0; i < listAdapter.getCount(); i++) {
|
||||||
IndexItem es = listAdapter.getItem(i);
|
IndexItem es = listAdapter.getItem(i);
|
||||||
if(!entriesToDownload.containsKey(es.getFileName())){
|
if(!entriesToDownload.containsKey(es.getFileName())){
|
||||||
selected++;
|
selected++;
|
||||||
entriesToDownload.put(es.getFileName(), createDownloadEntry(es));
|
entriesToDownload.put(es.getFileName(), createDownloadEntry(es));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.data.preparation.MapTileDownloader;
|
import net.osmand.data.MapTileDownloader;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
|
@ -1,294 +1,280 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.util.ArrayList;
|
||||||
import java.util.ArrayList;
|
import java.util.Arrays;
|
||||||
import java.util.Arrays;
|
import java.util.Collections;
|
||||||
import java.util.Collection;
|
import java.util.Comparator;
|
||||||
import java.util.Collections;
|
import java.util.List;
|
||||||
import java.util.Comparator;
|
import java.util.Map;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import net.osmand.Algoritms;
|
||||||
import java.util.Map;
|
import net.osmand.FavouritePoint;
|
||||||
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.FavouritePoint;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.Version;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.GPXUtilities.GPXFileResult;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.Version;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.GPXUtilities.GPXFileResult;
|
import net.osmand.data.MapTileDownloader;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.map.IMapLocationListener;
|
||||||
import net.osmand.data.preparation.MapTileDownloader;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.DownloadRequest;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.plus.BusyIndicator;
|
||||||
import net.osmand.map.IMapLocationListener;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.plus.PoiFilter;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.plus.PoiFiltersHelper;
|
||||||
import net.osmand.plus.AmenityIndexRepository;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.AmenityIndexRepositoryOdb;
|
import net.osmand.plus.ResourceManager;
|
||||||
import net.osmand.plus.BusyIndicator;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.OsmandSettings.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.PoiFilter;
|
import net.osmand.plus.activities.search.SearchPoiFilterActivity;
|
||||||
import net.osmand.plus.PoiFiltersHelper;
|
import net.osmand.plus.activities.search.SearchTransportActivity;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.render.MapRenderRepositories;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.render.RendererLayer;
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.OsmandSettings.ApplicationMode;
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.views.FavoritesLayer;
|
||||||
import net.osmand.plus.activities.search.SearchPoiFilterActivity;
|
import net.osmand.plus.views.GPXLayer;
|
||||||
import net.osmand.plus.activities.search.SearchTransportActivity;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.render.MapRenderRepositories;
|
import net.osmand.plus.views.OsmBugsLayer;
|
||||||
import net.osmand.plus.render.RendererLayer;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.POIMapLayer;
|
||||||
import net.osmand.plus.views.ContextMenuLayer;
|
import net.osmand.plus.views.PointLocationLayer;
|
||||||
import net.osmand.plus.views.FavoritesLayer;
|
import net.osmand.plus.views.PointNavigationLayer;
|
||||||
import net.osmand.plus.views.GPXLayer;
|
import net.osmand.plus.views.RouteInfoLayer;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.RouteLayer;
|
||||||
import net.osmand.plus.views.OsmBugsLayer;
|
import net.osmand.plus.views.TransportInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.TransportStopsLayer;
|
||||||
import net.osmand.plus.views.POIMapLayer;
|
import net.osmand.plus.views.YandexTrafficLayer;
|
||||||
import net.osmand.plus.views.PointLocationLayer;
|
import android.app.Activity;
|
||||||
import net.osmand.plus.views.PointNavigationLayer;
|
import android.app.AlertDialog;
|
||||||
import net.osmand.plus.views.RouteInfoLayer;
|
import android.app.Dialog;
|
||||||
import net.osmand.plus.views.RouteLayer;
|
import android.app.Notification;
|
||||||
import net.osmand.plus.views.TransportInfoLayer;
|
import android.app.NotificationManager;
|
||||||
import net.osmand.plus.views.TransportStopsLayer;
|
import android.app.PendingIntent;
|
||||||
import net.osmand.plus.views.YandexTrafficLayer;
|
import android.app.ProgressDialog;
|
||||||
import android.app.Activity;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.app.AlertDialog;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.app.Dialog;
|
import android.content.ComponentName;
|
||||||
import android.app.Notification;
|
import android.content.DialogInterface;
|
||||||
import android.app.NotificationManager;
|
import android.content.Intent;
|
||||||
import android.app.PendingIntent;
|
import android.content.SharedPreferences;
|
||||||
import android.app.ProgressDialog;
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.ComponentName;
|
import android.hardware.Sensor;
|
||||||
import android.content.DialogInterface;
|
import android.hardware.SensorEvent;
|
||||||
import android.content.Intent;
|
import android.hardware.SensorEventListener;
|
||||||
import android.content.SharedPreferences;
|
import android.hardware.SensorManager;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.location.Location;
|
||||||
import android.content.pm.PackageManager;
|
import android.location.LocationListener;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.location.LocationManager;
|
||||||
import android.content.res.Resources;
|
import android.location.LocationProvider;
|
||||||
import android.graphics.Rect;
|
import android.media.AudioManager;
|
||||||
import android.graphics.RectF;
|
import android.net.Uri;
|
||||||
import android.hardware.Sensor;
|
import android.os.Build;
|
||||||
import android.hardware.SensorEvent;
|
import android.os.Bundle;
|
||||||
import android.hardware.SensorEventListener;
|
import android.os.Environment;
|
||||||
import android.hardware.SensorManager;
|
import android.os.Handler;
|
||||||
import android.location.Location;
|
import android.os.Looper;
|
||||||
import android.location.LocationListener;
|
import android.os.Message;
|
||||||
import android.location.LocationManager;
|
import android.os.PowerManager;
|
||||||
import android.location.LocationProvider;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.media.AudioManager;
|
import android.util.Log;
|
||||||
import android.net.Uri;
|
import android.view.KeyEvent;
|
||||||
import android.os.Build;
|
import android.view.Menu;
|
||||||
import android.os.Bundle;
|
import android.view.MenuInflater;
|
||||||
import android.os.Environment;
|
import android.view.MenuItem;
|
||||||
import android.os.Handler;
|
import android.view.MotionEvent;
|
||||||
import android.os.Looper;
|
import android.view.View;
|
||||||
import android.os.Message;
|
import android.view.Window;
|
||||||
import android.os.PowerManager;
|
import android.view.View.OnClickListener;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.widget.CompoundButton;
|
||||||
import android.text.ClipboardManager;
|
import android.widget.ImageButton;
|
||||||
import android.text.Html;
|
import android.widget.LinearLayout;
|
||||||
import android.util.FloatMath;
|
import android.widget.Toast;
|
||||||
import android.util.Log;
|
import android.widget.ToggleButton;
|
||||||
import android.view.KeyEvent;
|
import android.widget.ZoomControls;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuInflater;
|
public class MapActivity extends Activity implements IMapLocationListener, SensorEventListener {
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.MotionEvent;
|
private static final String GPS_STATUS_ACTIVITY = "com.eclipsim.gpsstatus2.GPSStatus"; //$NON-NLS-1$
|
||||||
import android.view.View;
|
private static final String GPS_STATUS_COMPONENT = "com.eclipsim.gpsstatus2"; //$NON-NLS-1$
|
||||||
import android.view.Window;
|
|
||||||
import android.view.View.OnClickListener;
|
// stupid error but anyway hero 2.1 : always lost gps signal (temporarily unavailable) for timeout = 2000
|
||||||
import android.widget.CompoundButton;
|
private static final int GPS_TIMEOUT_REQUEST = 1000;
|
||||||
import android.widget.EditText;
|
private static final int GPS_DIST_REQUEST = 5;
|
||||||
import android.widget.ImageButton;
|
// use only gps (not network) for 12 seconds
|
||||||
import android.widget.LinearLayout;
|
private static final int USE_ONLY_GPS_INTERVAL = 12000;
|
||||||
import android.widget.Toast;
|
|
||||||
import android.widget.ToggleButton;
|
private boolean providerSupportsBearing = false;
|
||||||
import android.widget.ZoomControls;
|
@SuppressWarnings("unused")
|
||||||
|
private boolean providerSupportsSpeed = false;
|
||||||
public class MapActivity extends Activity implements IMapLocationListener, SensorEventListener {
|
private String currentLocationProvider = null;
|
||||||
|
private long lastTimeAutoZooming = 0;
|
||||||
private static final String GPS_STATUS_ACTIVITY = "com.eclipsim.gpsstatus2.GPSStatus"; //$NON-NLS-1$
|
private long lastTimeGPXLocationFixed = 0;
|
||||||
private static final String GPS_STATUS_COMPONENT = "com.eclipsim.gpsstatus2"; //$NON-NLS-1$
|
|
||||||
|
/** Called when the activity is first created. */
|
||||||
// stupid error but anyway hero 2.1 : always lost gps signal (temporarily unavailable) for timeout = 2000
|
private OsmandMapTileView mapView;
|
||||||
private static final int GPS_TIMEOUT_REQUEST = 1000;
|
private MapActivityActions mapActions = new MapActivityActions(this);
|
||||||
private static final int GPS_DIST_REQUEST = 5;
|
|
||||||
// use only gps (not network) for 12 seconds
|
private ImageButton backToLocation;
|
||||||
private static final int USE_ONLY_GPS_INTERVAL = 12000;
|
private ImageButton backToMenu;
|
||||||
|
|
||||||
private boolean providerSupportsBearing = false;
|
// the order of layer should be preserved ! when you are inserting new layer
|
||||||
@SuppressWarnings("unused")
|
private RendererLayer rendererLayer;
|
||||||
private boolean providerSupportsSpeed = false;
|
private GPXLayer gpxLayer;
|
||||||
private String currentLocationProvider = null;
|
private RouteLayer routeLayer;
|
||||||
private long lastTimeAutoZooming = 0;
|
private YandexTrafficLayer trafficLayer;
|
||||||
private long lastTimeGPXLocationFixed = 0;
|
private OsmBugsLayer osmBugsLayer;
|
||||||
|
private POIMapLayer poiMapLayer;
|
||||||
/** Called when the activity is first created. */
|
private FavoritesLayer favoritesLayer;
|
||||||
private OsmandMapTileView mapView;
|
private TransportStopsLayer transportStopsLayer;
|
||||||
private MapActivityActions mapActions = new MapActivityActions(this);
|
private TransportInfoLayer transportInfoLayer;
|
||||||
|
private PointLocationLayer locationLayer;
|
||||||
private ImageButton backToLocation;
|
private PointNavigationLayer navigationLayer;
|
||||||
private ImageButton backToMenu;
|
private MapInfoLayer mapInfoLayer;
|
||||||
|
private ContextMenuLayer contextMenuLayer;
|
||||||
// the order of layer should be preserved ! when you are inserting new layer
|
private RouteInfoLayer routeInfoLayer;
|
||||||
private RendererLayer rendererLayer;
|
|
||||||
private GPXLayer gpxLayer;
|
private SavingTrackHelper savingTrackHelper;
|
||||||
private RouteLayer routeLayer;
|
private RoutingHelper routingHelper;
|
||||||
private YandexTrafficLayer trafficLayer;
|
|
||||||
private OsmBugsLayer osmBugsLayer;
|
|
||||||
private POIMapLayer poiMapLayer;
|
private WakeLock wakeLock;
|
||||||
private FavoritesLayer favoritesLayer;
|
private boolean sensorRegistered = false;
|
||||||
private TransportStopsLayer transportStopsLayer;
|
|
||||||
private TransportInfoLayer transportInfoLayer;
|
private NotificationManager mNotificationManager;
|
||||||
private PointLocationLayer locationLayer;
|
private Handler mapPositionHandler = null;
|
||||||
private PointNavigationLayer navigationLayer;
|
private int APP_NOTIFICATION_ID;
|
||||||
private MapInfoLayer mapInfoLayer;
|
private int currentScreenOrientation;
|
||||||
private ContextMenuLayer contextMenuLayer;
|
private int currentMapRotation;
|
||||||
private RouteInfoLayer routeInfoLayer;
|
private boolean currentShowingAngle;
|
||||||
|
|
||||||
private SavingTrackHelper savingTrackHelper;
|
private Dialog progressDlg = null;
|
||||||
private RoutingHelper routingHelper;
|
private SharedPreferences settings;
|
||||||
|
|
||||||
|
private boolean isMapLinkedToLocation(){
|
||||||
private WakeLock wakeLock;
|
return OsmandSettings.isMapSyncToGpsLocation(settings);
|
||||||
private boolean sensorRegistered = false;
|
}
|
||||||
|
|
||||||
private NotificationManager mNotificationManager;
|
private Notification getNotification(){
|
||||||
private Handler mapPositionHandler = null;
|
Intent notificationIndent = new Intent(this, MapActivity.class);
|
||||||
private int APP_NOTIFICATION_ID;
|
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
private int currentScreenOrientation;
|
Notification notification = new Notification(R.drawable.icon, "", //$NON-NLS-1$
|
||||||
private int currentMapRotation;
|
System.currentTimeMillis());
|
||||||
private boolean currentShowingAngle;
|
notification.setLatestEventInfo(this, Version.APP_NAME,
|
||||||
|
getString(R.string.go_back_to_osmand), PendingIntent.getActivity(
|
||||||
private Dialog progressDlg = null;
|
this, 0, notificationIndent,
|
||||||
private SharedPreferences settings;
|
PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
|
return notification;
|
||||||
private boolean isMapLinkedToLocation(){
|
}
|
||||||
return OsmandSettings.isMapSyncToGpsLocation(settings);
|
|
||||||
}
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
private Notification getNotification(){
|
super.onCreate(savedInstanceState);
|
||||||
Intent notificationIndent = new Intent(this, MapActivity.class);
|
settings = OsmandSettings.getPrefs(this);
|
||||||
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
// for voice navigation
|
||||||
Notification notification = new Notification(R.drawable.icon, "", //$NON-NLS-1$
|
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||||
System.currentTimeMillis());
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
notification.setLatestEventInfo(this, Version.APP_NAME,
|
// Full screen is not used here
|
||||||
getString(R.string.go_back_to_osmand), PendingIntent.getActivity(
|
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
this, 0, notificationIndent,
|
setContentView(R.layout.main);
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT));
|
ProgressDialog dlg = ((OsmandApplication)getApplication()).checkApplicationIsBeingInitialized(this);
|
||||||
return notification;
|
if(dlg != null){
|
||||||
}
|
// Do some action on close
|
||||||
|
dlg.setOnDismissListener(new DialogInterface.OnDismissListener(){
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
super.onCreate(savedInstanceState);
|
OsmandApplication app = ((OsmandApplication)getApplication());
|
||||||
settings = OsmandSettings.getPrefs(this);
|
if(OsmandSettings.isUsingMapVectorData(settings) && app.getResourceManager().getRenderer().isEmpty()){
|
||||||
// for voice navigation
|
Toast.makeText(MapActivity.this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
||||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
}
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
}
|
||||||
// Full screen is not used here
|
});
|
||||||
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
}
|
||||||
setContentView(R.layout.main);
|
parseLaunchIntentLocation();
|
||||||
ProgressDialog dlg = ((OsmandApplication)getApplication()).checkApplicationIsBeingInitialized(this);
|
|
||||||
if(dlg != null){
|
mapView = (OsmandMapTileView) findViewById(R.id.MapView);
|
||||||
// Do some action on close
|
mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener(){
|
||||||
dlg.setOnDismissListener(new DialogInterface.OnDismissListener(){
|
@Override
|
||||||
@Override
|
public boolean onTrackBallEvent(MotionEvent e) {
|
||||||
public void onDismiss(DialogInterface dialog) {
|
showAndHideMapPosition();
|
||||||
OsmandApplication app = ((OsmandApplication)getApplication());
|
return MapActivity.this.onTrackballEvent(e);
|
||||||
if(OsmandSettings.isUsingMapVectorData(settings) && app.getResourceManager().getRenderer().isEmpty()){
|
}
|
||||||
Toast.makeText(MapActivity.this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
});
|
||||||
}
|
MapTileDownloader.getInstance().addDownloaderCallback(new IMapDownloaderCallback(){
|
||||||
});
|
@Override
|
||||||
}
|
public void tileDownloaded(DownloadRequest request) {
|
||||||
parseLaunchIntentLocation();
|
if(request != null && !request.error && request.fileToSave != null){
|
||||||
|
ResourceManager mgr = ((OsmandApplication)getApplication()).getResourceManager();
|
||||||
mapView = (OsmandMapTileView) findViewById(R.id.MapView);
|
mgr.tileDownloaded(request);
|
||||||
mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener(){
|
}
|
||||||
@Override
|
mapView.tileDownloaded(request);
|
||||||
public boolean onTrackBallEvent(MotionEvent e) {
|
|
||||||
showAndHideMapPosition();
|
}
|
||||||
return MapActivity.this.onTrackballEvent(e);
|
});
|
||||||
}
|
|
||||||
|
mapView.setMapLocationListener(this);
|
||||||
});
|
routingHelper = ((OsmandApplication) getApplication()).getRoutingHelper();
|
||||||
MapTileDownloader.getInstance().addDownloaderCallback(new IMapDownloaderCallback(){
|
|
||||||
@Override
|
// 0.5 layer
|
||||||
public void tileDownloaded(DownloadRequest request) {
|
rendererLayer = new RendererLayer();
|
||||||
if(request != null && !request.error && request.fileToSave != null){
|
mapView.addLayer(rendererLayer, 0.5f);
|
||||||
ResourceManager mgr = ((OsmandApplication)getApplication()).getResourceManager();
|
|
||||||
mgr.tileDownloaded(request);
|
// 0.6 gpx layer
|
||||||
}
|
gpxLayer = new GPXLayer();
|
||||||
mapView.tileDownloaded(request);
|
mapView.addLayer(gpxLayer, 0.6f);
|
||||||
|
|
||||||
}
|
// 1. route layer
|
||||||
});
|
routeLayer = new RouteLayer(routingHelper);
|
||||||
|
mapView.addLayer(routeLayer, 1);
|
||||||
mapView.setMapLocationListener(this);
|
|
||||||
routingHelper = ((OsmandApplication) getApplication()).getRoutingHelper();
|
// 1.5. traffic layer
|
||||||
|
trafficLayer = new YandexTrafficLayer();
|
||||||
// 0.5 layer
|
mapView.addLayer(trafficLayer, 1.5f);
|
||||||
rendererLayer = new RendererLayer();
|
|
||||||
mapView.addLayer(rendererLayer, 0.5f);
|
|
||||||
|
// 2. osm bugs layer
|
||||||
// 0.6 gpx layer
|
osmBugsLayer = new OsmBugsLayer(this);
|
||||||
gpxLayer = new GPXLayer();
|
// 3. poi layer
|
||||||
mapView.addLayer(gpxLayer, 0.6f);
|
poiMapLayer = new POIMapLayer();
|
||||||
|
// 4. favorites layer
|
||||||
// 1. route layer
|
favoritesLayer = new FavoritesLayer();
|
||||||
routeLayer = new RouteLayer(routingHelper);
|
// 5. transport layer
|
||||||
mapView.addLayer(routeLayer, 1);
|
transportStopsLayer = new TransportStopsLayer();
|
||||||
|
// 5.5 transport info layer
|
||||||
// 1.5. traffic layer
|
transportInfoLayer = new TransportInfoLayer(TransportRouteHelper.getInstance());
|
||||||
trafficLayer = new YandexTrafficLayer();
|
mapView.addLayer(transportInfoLayer, 5.5f);
|
||||||
mapView.addLayer(trafficLayer, 1.5f);
|
// 6. point navigation layer
|
||||||
|
navigationLayer = new PointNavigationLayer();
|
||||||
|
mapView.addLayer(navigationLayer, 6);
|
||||||
// 2. osm bugs layer
|
// 7. point location layer
|
||||||
osmBugsLayer = new OsmBugsLayer(this);
|
locationLayer = new PointLocationLayer();
|
||||||
// 3. poi layer
|
mapView.addLayer(locationLayer, 7);
|
||||||
poiMapLayer = new POIMapLayer();
|
// 8. map info layer
|
||||||
// 4. favorites layer
|
mapInfoLayer = new MapInfoLayer(this, routeLayer);
|
||||||
favoritesLayer = new FavoritesLayer();
|
mapView.addLayer(mapInfoLayer, 8);
|
||||||
// 5. transport layer
|
// 9. context menu layer
|
||||||
transportStopsLayer = new TransportStopsLayer();
|
contextMenuLayer = new ContextMenuLayer(this);
|
||||||
// 5.5 transport info layer
|
mapView.addLayer(contextMenuLayer, 9);
|
||||||
transportInfoLayer = new TransportInfoLayer(TransportRouteHelper.getInstance());
|
// 10. route info layer
|
||||||
mapView.addLayer(transportInfoLayer, 5.5f);
|
routeInfoLayer = new RouteInfoLayer(routingHelper, (LinearLayout) findViewById(R.id.RouteLayout));
|
||||||
// 6. point navigation layer
|
mapView.addLayer(routeInfoLayer, 10);
|
||||||
navigationLayer = new PointNavigationLayer();
|
|
||||||
mapView.addLayer(navigationLayer, 6);
|
|
||||||
// 7. point location layer
|
|
||||||
locationLayer = new PointLocationLayer();
|
savingTrackHelper = new SavingTrackHelper(this);
|
||||||
mapView.addLayer(locationLayer, 7);
|
|
||||||
// 8. map info layer
|
LatLon pointToNavigate = OsmandSettings.getPointToNavigate(settings);
|
||||||
mapInfoLayer = new MapInfoLayer(this, routeLayer);
|
|
||||||
mapView.addLayer(mapInfoLayer, 8);
|
|
||||||
// 9. context menu layer
|
|
||||||
contextMenuLayer = new ContextMenuLayer(this);
|
|
||||||
mapView.addLayer(contextMenuLayer, 9);
|
|
||||||
// 10. route info layer
|
|
||||||
routeInfoLayer = new RouteInfoLayer(routingHelper, (LinearLayout) findViewById(R.id.RouteLayout));
|
|
||||||
mapView.addLayer(routeInfoLayer, 10);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
savingTrackHelper = new SavingTrackHelper(this);
|
|
||||||
|
|
||||||
LatLon pointToNavigate = OsmandSettings.getPointToNavigate(settings);
|
|
||||||
|
|
||||||
// This situtation could be when navigation suddenly crashed and after restarting
|
// This situtation could be when navigation suddenly crashed and after restarting
|
||||||
// it tries to continue the last route
|
// it tries to continue the last route
|
||||||
if(!Algoritms.objectEquals(routingHelper.getFinalLocation(), pointToNavigate)){
|
if(!Algoritms.objectEquals(routingHelper.getFinalLocation(), pointToNavigate)){
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.text.MessageFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.osm.MapUtils;
|
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.RoutingHelper.RouteDirectionInfo;
|
import net.osmand.plus.activities.RoutingHelper.RouteDirectionInfo;
|
||||||
|
|
|
@ -24,8 +24,8 @@ import net.osmand.binary.BinaryMapDataObject;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
||||||
import net.osmand.data.index.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.osm.MapRenderingTypes;
|
import net.osmand.osm.MapRenderingTypes;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.osm.MultyPolygon;
|
import net.osmand.osm.MultyPolygon;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.Map;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.binary.BinaryMapDataObject;
|
import net.osmand.binary.BinaryMapDataObject;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.osm.MapRenderingTypes;
|
import net.osmand.osm.MapRenderingTypes;
|
||||||
import net.osmand.osm.MultyPolygon;
|
import net.osmand.osm.MultyPolygon;
|
||||||
import net.sf.junidecode.Junidecode;
|
import net.sf.junidecode.Junidecode;
|
||||||
|
|
|
@ -7,9 +7,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.data.preparation.MapTileDownloader;
|
import net.osmand.data.MapTileDownloader;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.preparation.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.map.IMapLocationListener;
|
import net.osmand.map.IMapLocationListener;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.data.index.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
|
|
Loading…
Reference in a new issue