Compare commits

...

56 commits
master ... r2.0

Author SHA1 Message Date
Victor Shcherb
ece96a1b18 Fix bug with POI https://github.com/osmandapp/Osmand/issues/1221 2015-06-03 16:24:04 +02:00
Victor Shcherb
04b738c236 Fix refresh issue 2015-06-02 01:22:34 +02:00
Victor Shcherb
9db293dbc3 FIX
- POI doesn't refresh map after delete
https://github.com/osmandapp/Osmand/issues/1281
- No delete in context menu for POI/Editing
https://github.com/osmandapp/Osmand/issues/1278

Conflicts:
	OsmAnd/res/values/strings.xml
2015-06-02 01:15:33 +02:00
Victor Shcherb
e666da21b1 - Fix Tab : SHow all notes / All tracks
- Search coordinates show full cordinates
- Search coordinates On Resume don't restore coordinates to let user enter lat & lon separately
- Fix SHOW LAT/LON Doesn't save to History
2015-06-02 00:37:47 +02:00
Victor Shcherb
0e3d3c9104 Fix av notes 2015-06-01 01:44:49 +02:00
Victor Shcherb
7b43ee0832 Fix 2015-06-01 01:18:26 +02:00
Victor Shcherb
95f8644db6 Fix 2015-06-01 01:15:53 +02:00
Victor Shcherb
044fc666db Fix https://github.com/osmandapp/Osmand/issues/1270 2015-06-01 01:13:48 +02:00
Victor Shcherb
f355bd5779 Fix issue https://github.com/osmandapp/Osmand/issues/1267 2015-06-01 00:51:43 +02:00
Victor Shcherb
eff51518ce Fix issue with route calculation 2015-05-31 23:34:46 +02:00
Victor Shcherb
24a7543840 Merge branch 'r2.0' of github.com:osmandapp/Osmand into r2.0 2015-05-31 18:55:16 +02:00
Victor Shcherb
4f108b05ae Fix https://github.com/osmandapp/Osmand/issues/1283 2015-05-31 18:55:05 +02:00
Alexey Pelykh
5bb338dc8c Backport of f1ddccb7c3 2015-05-21 18:31:00 +03:00
Victor Shcherb
eb1a94c4f6 Clean unnecessary settings 2015-05-21 15:31:47 +03:00
Victor Shcherb
01ad603c4d SHow always map source but ask to enable plugin first 2015-05-21 15:31:40 +03:00
Victor Shcherb
040d116852 Add translations to search 2015-05-21 15:31:32 +03:00
Victor Shcherb
6ba1768018 Fix road only maps 2015-05-13 22:07:57 +02:00
Victor Shcherb
32f4f47e79 Merge branch 'r2.0' of github.com:osmandapp/Osmand into r2.0 2015-05-08 23:52:57 +02:00
Victor Shcherb
cd6801f554 Fix appcompat 2015-05-08 23:52:49 +02:00
vshcherb
293899d58f Update GPXUtilities.java 2015-05-08 23:27:03 +02:00
Victor Shcherb
7c2745d4c1 Updates in download activity 2015-05-07 00:38:25 +02:00
Victor Shcherb
f40cc08002 Fix UI for 12 2015-05-07 00:21:00 +02:00
Victor Shcherb
ef643006b9 Fix shorten route calculation 2015-05-06 23:21:50 +02:00
Victor Shcherb
583f58f480 Fix pre19 moving to external sdcard 2015-05-06 20:23:27 +02:00
Victor Shcherb
dd601c6b72 Merge branch 'r2.0' of github.com:osmandapp/Osmand into r2.0 2015-05-05 02:20:24 +02:00
Victor Shcherb
864607feda Fix checkboxes pre 17 2015-05-05 02:20:14 +02:00
vshcherb
1a4a686387 Update MapActivity.java 2015-05-04 20:00:29 +02:00
vshcherb
842cd7a1cb Update MapActivity.java 2015-05-04 20:00:07 +02:00
xmd5a
5aa59c8913 Rename town_hall to townhall to match tag's value 2015-05-04 16:03:38 +03:00
xmd5a
ee7b5baca1 Fix phrases 2015-05-04 15:37:02 +03:00
xmd5a
49bb5558ad Fix phrases 2015-05-04 15:06:31 +03:00
Victor Shcherb
1e886dd70f Merge branch 'r2.0' of github.com:osmandapp/Osmand into r2.0 2015-05-03 23:20:14 +02:00
Victor Shcherb
98ca8486ca Fix route recalculation 2015-05-03 23:20:05 +02:00
xmd5a
35efe0daa8 Merge branch 'r2.0' of https://github.com/osmandapp/Osmand into r2.0 2015-05-03 23:28:42 +03:00
xmd5a
18664a153a Fix phrases 2015-05-03 23:27:59 +03:00
vshcherb
12eed80d9e Update build.gradle 2015-05-03 19:49:27 +02:00
Victor Shcherb
ec16c91f1e Update gradle 2015-05-03 19:47:30 +02:00
Victor Shcherb
9f3c0f9de2 Update gradle 2015-05-03 19:44:48 +02:00
Victor Shcherb
a935ff6ea4 Update gradle 2015-05-03 19:36:16 +02:00
Victor Shcherb
f6090ff64a Remove support libs 2015-05-03 17:04:36 +02:00
Victor Shcherb
354bebde18 Update package 2015-05-03 16:58:58 +02:00
Victor Shcherb
630c5016ac update gradle 2015-05-03 16:56:18 +02:00
Victor Shcherb
b45e62de7a Merge branch 'r2.0' of github.com:osmandapp/Osmand into r2.0 2015-05-03 15:18:57 +02:00
Victor Shcherb
282adfce7c Remove fab 2015-05-03 15:18:49 +02:00
xmd5a
9ab60c08d8 Merge pull request #1171 from aelmahmoudy/r2.0
Fix reference to toll_booth icon
2015-05-03 15:59:14 +03:00
أحمد المحمودي (Ahmed El-Mahmoudy)
d6103b4633 Fix reference to toll_booth icon 2015-05-03 14:36:05 +02:00
Victor Shcherb
7f199aae48 Update version 2015-05-03 01:02:32 +02:00
xmd5a
4e80bf1728 Better nautical descr ru string 2015-05-03 01:03:43 +03:00
Victor Shcherb
accba7899f Fix 33% display for poi 2015-05-02 23:59:22 +02:00
Victor Shcherb
2e0a3fe7aa Merge branch 'r2.0' of github.com:osmandapp/Osmand into r2.0 2015-05-02 23:31:10 +02:00
Victor Shcherb
7056eeb65d Update poi reader 2015-05-02 23:31:05 +02:00
vshcherb
156f21d058 Update style.css 2015-05-02 23:15:14 +02:00
Victor Shcherb
61a7510ac5 Fix poi display with track 2015-05-02 20:42:49 +02:00
Victor Shcherb
33eb95caaa Simplify layer structure make poi/favorites layers all the time present 2015-05-02 15:44:57 +02:00
Victor Shcherb
f52c305403 Update proguard to fix the issue 2015-05-02 11:53:15 +02:00
Victor Shcherb
dcfb6fe3b8 Fix crashes 2015-05-01 19:19:46 +02:00
648 changed files with 41036 additions and 8506 deletions

View file

@ -4,6 +4,7 @@ package net.osmand.binary;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.map.hash.TLongObjectHashMap;
import gnu.trove.set.hash.TIntHashSet;
import java.io.BufferedInputStream;
@ -288,6 +289,18 @@ public class BinaryMapIndexReader {
return routingIndexes.size() > 0;
}
public boolean containsRouteData(int left31x, int top31y, int right31x, int bottom31y, int zoom) {
for (RouteRegion ri : routingIndexes) {
List<RouteSubregion> sr = ri.getSubregions();
for (RouteSubregion r : sr) {
if (right31x >= r.left && left31x <= r.right && r.top <= bottom31y && r.bottom >= top31y) {
return true;
}
}
}
return false;
}
public boolean containsPoiData(double latitude, double longitude) {
for (PoiRegion index : poiIndexes) {
if (index.rightLongitude >= longitude && index.leftLongitude <= longitude &&
@ -536,7 +549,7 @@ public class BinaryMapIndexReader {
return r;
}
}
throw new IllegalArgumentException(name);
return null;
}
public List<City> getCities(String region, SearchRequest<City> resultMatcher,
@ -547,6 +560,9 @@ public class BinaryMapIndexReader {
int cityType) throws IOException {
List<City> cities = new ArrayList<City>();
AddressRegion r = getRegionByName(region);
if(r == null) {
return cities;
}
for(CitiesBlock block : r.cities) {
if(block.type == cityType) {
codedIS.seek(block.filePointer);
@ -1416,7 +1432,7 @@ public class BinaryMapIndexReader {
SearchPoiTypeFilter poiTypeFilter, ResultMatcher<Amenity> resultMatcher) {
SearchRequest<Amenity> request = new SearchRequest<Amenity>();
float coeff = (float) (radius / MapUtils.getTileDistanceWidth(SearchRequest.ZOOM_TO_SEARCH_POI));
TIntObjectHashMap<List<Location>> zooms = new TIntObjectHashMap<List<Location>>();
TLongObjectHashMap<List<Location>> zooms = new TLongObjectHashMap<List<Location>>();
for(int i = 1; i < route.size(); i++) {
Location cr = route.get(i);
Location pr = route.get(i - 1);
@ -1430,7 +1446,7 @@ public class BinaryMapIndexReader {
double bottomRightY = Math.max(ty, py) + coeff;
for(int x = (int) topLeftX; x <= bottomRightX; x++) {
for(int y = (int) topLeftY; y <= bottomRightY; y++) {
int hash = (x << SearchRequest.ZOOM_TO_SEARCH_POI) + y;
long hash = (((long)x) << SearchRequest.ZOOM_TO_SEARCH_POI) + y;
if(!zooms.containsKey(hash)) {
zooms.put(hash, new LinkedList<Location>());
}
@ -1441,14 +1457,14 @@ public class BinaryMapIndexReader {
}
}
int sleft = 0, sright = Integer.MAX_VALUE, stop = 0, sbottom = Integer.MAX_VALUE;
for(int vl : zooms.keys()) {
int x = (vl >> SearchRequest.ZOOM_TO_SEARCH_POI) << (31 - SearchRequest.ZOOM_TO_SEARCH_POI);
int y = (vl & ((1 << SearchRequest.ZOOM_TO_SEARCH_POI) -1)) << (31 - SearchRequest.ZOOM_TO_SEARCH_POI);
sleft = Math.min(x, sleft);
stop = Math.min(y, stop);
sbottom = Math.max(y, sbottom);
sright = Math.max(x, sright);
int sleft = Integer.MAX_VALUE , sright = 0, stop = Integer.MAX_VALUE, sbottom = 0;
for(long vl : zooms.keys()) {
long x = (vl >> SearchRequest.ZOOM_TO_SEARCH_POI) << (31 - SearchRequest.ZOOM_TO_SEARCH_POI);
long y = (vl & ((1 << SearchRequest.ZOOM_TO_SEARCH_POI) -1)) << (31 - SearchRequest.ZOOM_TO_SEARCH_POI);
sleft = (int) Math.min(x, sleft);
stop = (int) Math.min(y, stop);
sbottom = (int) Math.max(y, sbottom);
sright = (int) Math.max(x, sright);
}
request.radius = radius;
request.left = sleft;
@ -1598,7 +1614,7 @@ public class BinaryMapIndexReader {
// search on the path
// stores tile of 16 index and pairs (even length always) of points intersecting tile
TIntObjectHashMap<List<Location>> tiles = null;
TLongObjectHashMap<List<Location>> tiles = null;
double radius = -1;
@ -1628,9 +1644,9 @@ public class BinaryMapIndexReader {
protected SearchRequest(){
}
public int getTileHashOnPath(double lat, double lon) {
int x = (int) MapUtils.getTileNumberX(SearchRequest.ZOOM_TO_SEARCH_POI, lon);
int y = (int) MapUtils.getTileNumberY(SearchRequest.ZOOM_TO_SEARCH_POI, lat);
public long getTileHashOnPath(double lat, double lon) {
long x = (int) MapUtils.getTileNumberX(SearchRequest.ZOOM_TO_SEARCH_POI, lon);
long y = (int) MapUtils.getTileNumberY(SearchRequest.ZOOM_TO_SEARCH_POI, lat);
return (x << SearchRequest.ZOOM_TO_SEARCH_POI) | y;
}
@ -1937,6 +1953,7 @@ public class BinaryMapIndexReader {
private static boolean testMapSearch = false;
private static boolean testAddressSearch = false;
private static boolean testPoiSearch = false;
private static boolean testPoiSearchOnPath = true;
private static boolean testTransportSearch = false;
private static int sleft = MapUtils.get31TileNumberX(6.3);
private static int sright = MapUtils.get31TileNumberX(6.5);
@ -1949,7 +1966,7 @@ public class BinaryMapIndexReader {
}
public static void main(String[] args) throws IOException {
RandomAccessFile raf = new RandomAccessFile("", "r");
RandomAccessFile raf = new RandomAccessFile("/Users/victorshcherb/osmand/maps/Netherlands_europe_2.obf", "r");
BinaryMapIndexReader reader = new BinaryMapIndexReader(raf);
println("VERSION " + reader.getVersion()); //$NON-NLS-1$
@ -1966,11 +1983,15 @@ public class BinaryMapIndexReader {
testTransportSearch(reader);
}
if (testPoiSearch) {
if (testPoiSearch || testPoiSearchOnPath) {
PoiRegion poiRegion = reader.getPoiIndexes().get(0);
testPoiSearch(reader, poiRegion);
testPoiSearchByName(reader);
testSearchOnthePath(reader);
if(testPoiSearch) {
testPoiSearch(reader, poiRegion);
testPoiSearchByName(reader);
}
if(testPoiSearchOnPath) {
testSearchOnthePath(reader);
}
}
println("MEMORY " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())); //$NON-NLS-1$
@ -1983,7 +2004,7 @@ public class BinaryMapIndexReader {
long now = System.currentTimeMillis();
println("Searching poi on the path...");
final List<Location> locations = readGPX(new File(
""));
"/Users/victorshcherb/osmand/maps/2015-03-07_19-07_Sat.gpx"));
SearchRequest<Amenity> req = buildSearchPoiRequest(locations, radius, new SearchPoiTypeFilter() {
@Override
public boolean accept(PoiCategory type, String subcategory) {

View file

@ -21,11 +21,9 @@ import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
import net.osmand.binary.OsmandOdb.OsmAndPoiNameIndex.OsmAndPoiNameIndexData;
import net.osmand.data.Amenity;
import net.osmand.data.Amenity.AmenityRoutePoint;
import net.osmand.data.AmenityType;
import net.osmand.data.LatLon;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import net.sf.junidecode.Junidecode;
@ -40,6 +38,7 @@ public class BinaryMapPoiReaderAdapter {
public static final int SHIFT_BITS_CATEGORY = 7;
private static final int CATEGORY_MASK = (1 << SHIFT_BITS_CATEGORY) - 1 ;
private static final int ZOOM_TO_SKIP_FILTER_READ = 6;
private static final int ZOOM_TO_SKIP_FILTER = 3;
private static final int BUCKET_SEARCH_BY_NAME = 5;
@ -324,7 +323,7 @@ public class BinaryMapPoiReaderAdapter {
LOG.info("Searched poi structure in "+(System.currentTimeMillis() - time) +
"ms. Found " + offKeys.length +" subtress");
"ms. Found " + offKeys.length +" subtrees");
for (int j = 0; j < offKeys.length; j++) {
codedIS.seek(offKeys[j] + indexOffset);
int len = readInt();
@ -451,10 +450,8 @@ public class BinaryMapPoiReaderAdapter {
int indexOffset = codedIS.getTotalBytesRead();
long time = System.currentTimeMillis();
TLongHashSet skipTiles = null;
int zoomToSkip = 31;
if(req.zoom != -1){
skipTiles = new TLongHashSet();
zoomToSkip = req.zoom + ZOOM_TO_SKIP_FILTER;
}
int length ;
int oldLimit ;
@ -481,13 +478,27 @@ public class BinaryMapPoiReaderAdapter {
if(skipTiles != null){
skipTiles.clear();
}
LOG.info("Searched poi structure in "+(System.currentTimeMillis() - time) +
"ms. Found " + offsets.length +" subtress");
LOG.info("Searched poi structure in " + (System.currentTimeMillis() - time) + " ms. Found "
+ offsets.length + " subtrees");
for (int j = 0; j < offsets.length; j++) {
long skipVal = offsetsMap.get(offsets[j]);
if (skipTiles != null && skipVal != -1) {
int dzoom = ZOOM_TO_SKIP_FILTER_READ - ZOOM_TO_SKIP_FILTER;
long dx = (skipVal >> ZOOM_TO_SKIP_FILTER_READ);
long dy = skipVal - (dx << ZOOM_TO_SKIP_FILTER_READ);
skipVal = ((dx >> dzoom) << ZOOM_TO_SKIP_FILTER) | (dy >> dzoom);
if (skipVal != -1 && skipTiles.contains(skipVal)) {
continue;
}
}
codedIS.seek(offsets[j] + indexOffset);
int len = readInt();
int oldLim = codedIS.pushLimit(len);
readPoiData(left31, right31, top31, bottom31, req, region, skipTiles, zoomToSkip);
boolean read = readPoiData(left31, right31, top31, bottom31, req, region, skipTiles,
req.zoom == -1 ? 31 : req.zoom + ZOOM_TO_SKIP_FILTER );
if(read && skipVal != -1 && skipTiles != null) {
skipTiles.add(skipVal);
}
codedIS.popLimit(oldLim);
if(req.isCancelled()){
return;
@ -542,20 +553,21 @@ public class BinaryMapPoiReaderAdapter {
}
}
private void readPoiData(int left31, int right31, int top31, int bottom31,
private boolean readPoiData(int left31, int right31, int top31, int bottom31,
SearchRequest<Amenity> req, PoiRegion region, TLongHashSet toSkip, int zSkip) throws IOException {
int x = 0;
int y = 0;
int zoom = 0;
boolean read = false;
while(true){
if(req.isCancelled()){
return;
return read;
}
int t = codedIS.readTag();
int tag = WireFormat.getTagFieldNumber(t);
switch (tag) {
case 0:
return;
return read;
case OsmandOdb.OsmAndPoiBoxData.X_FIELD_NUMBER :
x = codedIS.readUInt32();
break;
@ -574,19 +586,21 @@ public class BinaryMapPoiReaderAdapter {
if (toSkip != null) {
int xp = (int) MapUtils.getTileNumberX(zSkip, am.getLocation().getLongitude());
int yp = (int) MapUtils.getTileNumberY(zSkip, am.getLocation().getLatitude());
long val = (((long) xp) << zSkip) | yp;
if (!toSkip.contains(val)) {
long valSkip = (((long) xp) << zSkip) | yp;
if (!toSkip.contains(valSkip)) {
boolean publish = req.publish(am);
if(publish) {
toSkip.add(val);
read = true;
toSkip.add(valSkip);
}
}
if(zSkip <= zoom){
} else if(zSkip <= zoom){
codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
return;
return read;
}
} else {
req.publish(am);
if(req.publish(am)) {
read = true;
}
}
}
break;
@ -788,9 +802,10 @@ public class BinaryMapPoiReaderAdapter {
}
private boolean readBoxField(int left31, int right31, int top31, int bottom31,
int px, int py, int pzoom, TIntLongHashMap offsetsMap, TLongHashSet skipTiles, SearchRequest<Amenity> req, PoiRegion region) throws IOException {
int px, int py, int pzoom, TIntLongHashMap offsetsMap, TLongHashSet skipTiles,
SearchRequest<Amenity> req, PoiRegion region) throws IOException {
req.numberOfReadSubtrees++;
int zoomToSkip = req.zoom + ZOOM_TO_SKIP_FILTER;
int zoomToSkip = req.zoom == -1 ? 31 : req.zoom + ZOOM_TO_SKIP_FILTER_READ;
boolean checkBox = true;
boolean existsCategories = false;
int zoom = pzoom;
@ -863,20 +878,21 @@ public class BinaryMapPoiReaderAdapter {
case OsmandOdb.OsmAndPoiBox.SHIFTTODATA_FIELD_NUMBER: {
int x = dx + (px << (zoom - pzoom));
int y = dy + (py << (zoom - pzoom));
long l = ((((x << zoom) | y) << 5) | zoom);
boolean read = true;
if(req.tiles != null) {
int zx = x << (SearchRequest.ZOOM_TO_SEARCH_POI - zoom);
int zy = y << (SearchRequest.ZOOM_TO_SEARCH_POI - zoom);
long zx = x << (SearchRequest.ZOOM_TO_SEARCH_POI - zoom);
long zy = y << (SearchRequest.ZOOM_TO_SEARCH_POI - zoom);
read = req.tiles.contains((zx << SearchRequest.ZOOM_TO_SEARCH_POI) + zy);
}
int offset = readInt();
if (read) {
offsetsMap.put(offset, l);
if (skipTiles != null && zoom >= zoomToSkip) {
long val = ((((long) x) >> (zoom - zoomToSkip)) << zoomToSkip)
long valSkip = ((((long) x) >> (zoom - zoomToSkip)) << zoomToSkip)
| (((long) y) >> (zoom - zoomToSkip));
skipTiles.add(val);
offsetsMap.put(offset, valSkip);
skipTiles.add(valSkip);
} else {
offsetsMap.put(offset, -1);
}
}
} break;

View file

@ -126,7 +126,7 @@ public class MapPoiTypes {
return null;
}
public Map<String, PoiType> getAllTranslatedNames() {
public Map<String, PoiType> getAllTranslatedNames(boolean onlyTranslation) {
Map<String, PoiType> translation = new TreeMap<String, PoiType>();
for(PoiCategory pc : categories) {
for(PoiType pt : pc.getPoiTypes()) {
@ -134,6 +134,12 @@ public class MapPoiTypes {
continue;
}
translation.put(pt.getTranslation(), pt);
if(!onlyTranslation) {
String kn = pt.getKeyName().replace('_', ' ');
if(!pt.getTranslation().toLowerCase().contains(kn)) {
translation.put(Algorithms.capitalizeFirstLetterAndLowercase(kn), pt);
}
}
}
}
return translation;
@ -169,8 +175,10 @@ public class MapPoiTypes {
for (PoiType pt : pc.getPoiTypes()) {
translation.put(pt.getTranslation(), pt);
if (!onlyTranslation) {
// translation.put(pt.getKeyName(), pt);
translation.put(Algorithms.capitalizeFirstLetterAndLowercase(pt.getKeyName().replace('_', ' ')), pt);
String kn = pt.getKeyName().replace('_', ' ');
if(!pt.getTranslation().toLowerCase().contains(kn)) {
translation.put(Algorithms.capitalizeFirstLetterAndLowercase(kn), pt);
}
}
}
return translation;

View file

@ -334,7 +334,7 @@ public class RoutePlannerFrontEnd {
runRecalculation = rlist.size() > 0;
if (rlist.size() > 0) {
RouteSegment previous = null;
for (int i = 0; i < rlist.size() - 1; i++) {
for (int i = 0; i <= rlist.size() - 1; i++) {
RouteSegmentResult rr = rlist.get(i);
RouteSegment segment = new RouteSegment(rr.getObject(), rr.getEndPointIndex());
if (previous != null) {

View file

@ -1,7 +1,43 @@
h3 { text-align: center}
h4 { text-align: center}
div {border-width: 1px; padding: 10px;
border: groove; margin-left:auto;margin-right:auto; }
li { text-align:justify;"}
img { max-width: 75%; width: auto; height: auto; }
p.img {text-align: center}
body{padding:0; margin:0; }
a {color:#536DFE;}
xmp{white-space: pre-wrap;}
.main{ margin:0 auto; font-family:arial; font-size:11pt;}
.main{width:95%;}
xmp{max-width:95%;}
.code{font-style:italic;}
.list li{padding-bottom:10px; color:#000; }
.list li a{ text-decoration:none;}
.subtitle{border-bottom:1px solid #F3F3F3; font-size:13pt; margin-top:10px; font-weight:bold;}
.blocksubtitle{font-weight:bold; margin-top:10px;}
h1{background-color:#FF8F00; font-size:15pt; color:#fff; padding-left:15px; padding-top:30px; padding-bottom:15px; font-weight:bold;
-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px; margin-top:-5px;}
.content{padding:15px; padding-top:5px;}
.content ul{padding-left:20px;}
/************home page*****************/
.mainlist{list-style-type: none; margin:0; padding:0;}
.mainlist li{border-bottom: 1px solid #F3F3F3; padding:15px; }
.mainlist li.last{border-bottom:none;}
h1.sub{background-color:#536DFE; margin-top:0;}
h1.sub small{display:block; font-weight:normal; color:#ACB9FF; margin-top:5px;}
/*****features**********************/
.featuretitle{border-bottom:1px solid #F3F3F3; font-size:14pt; margin-top:10px; font-weight:bold;}
.features li{padding-bottom:10px;}
/*************frequently asked questions**************/
.toc .list li{color:#D2D2D2;}
.toc .subtitle{font-weight:normal;}
.screenshot{max-width:95%; max-height:100%; padding:7px; border:1px solid #ddd;}
.imgcontainer{margin:20px 30px;}
.legendcontainer{margin:0;}
.legend{width:100%;}
/*div {border-width: 1px; padding: 10px;
border: groove; margin-left:auto;margin-right:auto; width:480pt}
h3.help { text-align: center}
h4.help { text-align: center}
li.help { text-align:justify}
img.help { width:auto; height:auto; max-width: 50%;}
p.img {text-align: center}*/

View file

@ -141,9 +141,11 @@ android {
buildTypes {
debug {
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
signingConfig signingConfigs.development
}
release {
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
signingConfig signingConfigs.publishing
}
}
@ -276,6 +278,12 @@ tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn << [collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore]
}
clean.dependsOn 'cleanNoTranslate'
task cleanNoTranslate() {
delete ('res/values/no_translate.xml')
}
repositories {
ivy {
name = "OsmAndBinariesIvy"
@ -288,6 +296,7 @@ repositories {
}
dependencies {
compile project(":eclipse-compile:appcompat")
compile project(path: ":OsmAnd-java", configuration: "android")
compile fileTree(
dir: "libs",
@ -298,9 +307,6 @@ dependencies {
"android-support*.jar",
"OsmAndCore_android.jar",
"OsmAndCore_wrapper.jar"])
compile "com.github.ksoichiro:android-observablescrollview:1.5.0"
compile "com.android.support:appcompat-v7:21.0.3"
compile "com.github.shell-software:fab:1.0.5"
legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"

Binary file not shown.

View file

@ -1,20 +1,35 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
-dontoptimize
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}
-keep class net.osmand.** { *; }
-keep interface net.osmand.** { *; }
-keep class com.** { *; }
-keep interface com.** { *; }
-keep class net.** { *; }
-keep interface net.** { *; }
-keep class gnu.** { *; }
-keep interface gnu.** { *; }
-keep class org.** { *; }
-keep interface org.** { *; }
-keep class bsh.** { *; }
-keep interface bsh.** { *; }
-keep class btools.** { *; }
-keep interface btools.** { *; }
-keep class alice.** { *; }
-keep interface alice.** { *; }
-dontwarn alice.**

View file

@ -13,6 +13,3 @@ split.density=false
target=android-21
dex.force.jumbo=true
android.library.reference.1=../eclipse-compile/appcompat
android.library.reference.2=../eclipse-compile/observable
android.library.reference.2=../eclipse-compile/observable
android.library.reference.3=../eclipse-compile/fab

View file

@ -58,6 +58,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/default_sub_text_size"
android:textColor="@color/color_ok"
tools:text="@string/lorem_ipsum"
android:visibility="gone"
android:maxLines="1"/>

View file

@ -49,7 +49,7 @@
android:id="@+id/LatitudeEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:inputType="phone"></EditText>
android:inputType="numberSigned|numberDecimal|time"></EditText>
</TableRow>
<TableRow android:layout_width="fill_parent" android:id="@+id/lon_row">
@ -67,7 +67,7 @@
android:id="@+id/LongitudeEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:inputType="phone"></EditText>
android:inputType="numberSigned|numberDecimal|time"></EditText>
</TableRow>
<TableRow android:layout_width="fill_parent" android:id="@+id/northing_row">
@ -84,7 +84,7 @@
android:id="@+id/NorthingEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:inputType="phone"></EditText>
android:inputType="numberSigned|numberDecimal|time"></EditText>
</TableRow>
<TableRow android:layout_width="fill_parent" android:id="@+id/easting_row">
@ -102,7 +102,7 @@
android:id="@+id/EastingEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:inputType="phone"></EditText>
android:inputType="numberSigned|numberDecimal|time"></EditText>
</TableRow>
<TableRow android:layout_width="fill_parent" android:id="@+id/zone_row">

View file

@ -30,7 +30,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/osmo_grop_name_length_alert"
android:textColor="@color/fab_material_red_500"/>
android:textColor="@color/osmbug_closed"/>
<TextView
android:layout_width="wrap_content"

View file

@ -18,7 +18,8 @@
android:id="@+id/spinner_nav"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
android:layout_gravity="center_horizontal"
android:popupBackground="?attr/spinnerListBackground"/>
<ProgressBar android:id="@+id/ProgressBar"
android:layout_width="wrap_content"

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:singleLine="true"
android:background="?attr/expandable_list_background"
android:textSize="@dimen/default_list_text_size"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:ellipsize="marquee"/>
android:id="@android:id/text1"
android:singleLine="true"
android:textColor="?attr/spinnerItemTextColor"
android:textSize="@dimen/default_list_text_size"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:ellipsize="marquee"/>

View file

@ -151,7 +151,7 @@
<string name="poi_subway_station">Станцыя мэтро</string>
<string name="poi_taxi">Стаянка таксі</string>
<string name="poi_airport">Аэрапорт</string>
<string name="poi_aerodrome">Аэрапорт</string>
<string name="poi_helipad">Шрубалётная пляцоўка</string>
<string name="poi_runway">Узлётная паласа</string>
<string name="poi_aeroway_terminal">Тэрмінал аэрапорту</string>
@ -192,7 +192,7 @@
<string name="poi_waterway_turning_point">Паваротная кропка на вадзе</string>
<string name="poi_weir">Невялікая плаціна</string>
<string name="poi_dam">Дамба</string>
<string name="poi_water_mill">Вадзяны млын</string>
<string name="poi_watermill">Вадзяны млын</string>
<string name="poi_power_substation">Падстанцыя</string>
<string name="poi_power_transformer">Трансфарматар</string>
@ -285,7 +285,7 @@
<string name="poi_lawyer">Юрыдычныя паслугі</string>
<string name="poi_office_telecommunication">Тэлекамунікацыйная кампанія</string>
<string name="poi_ngo">Грамадзкая арганізацыя</string>
<string name="poi_town_hall">Адміністрацыя населенага пункта</string>
<string name="poi_townhall">Адміністрацыя населенага пункта</string>
<string name="poi_employment_agency">Біржа працы</string>
<string name="poi_research">Дасьледчы цэнтар</string>
<string name="poi_it">Інфармацыйныя тэхналёгіі</string>

View file

@ -127,7 +127,7 @@
<string name="poi_subway_station">Estació de metro</string>
<string name="poi_taxi">Parada de taxis</string>
<string name="poi_airport">Aeroport</string>
<string name="poi_aerodrome">Aeroport</string>
<string name="poi_helipad">Heliport</string>
<string name="poi_runway">Pista d\'aterratge</string>
<string name="poi_aeroway_terminal">Terminal d\'aeroport</string>
@ -163,7 +163,7 @@
<string name="poi_lock_gate">Resclosa</string>
<string name="poi_weir">Sobreeixidor</string>
<string name="poi_dam">Presa d\'aigua</string>
<string name="poi_water_mill">Molí hidràulic</string>
<string name="poi_watermill">Molí hidràulic</string>
<string name="poi_power_substation">Subestació elèctrica</string>
<string name="poi_power_transformer">Transformador elèctric</string>
@ -249,7 +249,7 @@
<string name="poi_lawyer">Gabinet d\'advocats</string>
<string name="poi_office_telecommunication">Empresa de telecomunicacions</string>
<string name="poi_ngo">ONG</string>
<string name="poi_town_hall">Ajuntament</string>
<string name="poi_townhall">Ajuntament</string>
<string name="poi_employment_agency">Oficina d\'ocupació</string>
<string name="poi_research">Oficina de recerca i desenvolupament</string>
<string name="poi_it">Consultoria en TIC</string>

View file

@ -61,7 +61,7 @@
<string name="poi_bus_stop">Zastávka autobusu</string>
<string name="poi_public_transport_platform_tram">Tramvajová zastávka</string>
<string name="poi_public_transport_station">Zastávka veřejné dopravy</string>
<string name="poi_airport">Letiště</string>
<string name="poi_aerodrome">Letiště</string>
<string name="poi_lighthouse">Maják</string>
<string name="poi_bicycle_rental">Půjčovna kol</string>
@ -393,7 +393,7 @@
<string name="poi_waterway_turning_point">Vodní obratiště</string>
<string name="poi_weir">Hráz</string>
<string name="poi_dam">Přehrada</string>
<string name="poi_water_mill">Vodní mlýn</string>
<string name="poi_watermill">Vodní mlýn</string>
<string name="poi_power_substation">Transformátorová stanice</string>
<string name="poi_power_transformer">Transformátor</string>
@ -482,7 +482,7 @@
<string name="poi_estate_agent">Realitní kancelář</string>
<string name="poi_office_telecommunication">Telekomunikace</string>
<string name="poi_ngo">Nezisková organizace</string>
<string name="poi_town_hall">Radnice</string>
<string name="poi_townhall">Radnice</string>
<string name="poi_employment_agency">Úřad práce</string>
<string name="poi_research">Výzkumný ústav</string>
<string name="poi_it">Informační technologie</string>

View file

@ -146,7 +146,7 @@
<string name="poi_subway_station">Metrostation</string>
<string name="poi_taxi">Taxaholdeplads</string>
<string name="poi_airport">Lufthavn</string>
<string name="poi_aerodrome">Lufthavn</string>
<string name="poi_helipad">Helikopterlandingsplads</string>
<string name="poi_runway">Landingsbane</string>
<string name="poi_aeroway_terminal">Lufthavnsterminal</string>
@ -188,7 +188,7 @@
<string name="poi_waterway_turning_point">Vendepunkt på vandet</string>
<string name="poi_weir">Stemmeværk</string>
<string name="poi_dam">Dæmning</string>
<string name="poi_water_mill">Vandmølle</string>
<string name="poi_watermill">Vandmølle</string>
<string name="poi_power_substation">Transformerstation</string>
<string name="poi_power_transformer">Transformator</string>
@ -257,7 +257,7 @@
<string name="poi_lawyer">Advokat</string>
<string name="poi_office_telecommunication">Telekommunikation selskab</string>
<string name="poi_ngo">NGO</string>
<string name="poi_town_hall">Rådhus</string>
<string name="poi_townhall">Rådhus</string>
<string name="poi_employment_agency">Arbejdsformidling</string>
<string name="poi_research">Forskning</string>
<string name="poi_it">IT kontor</string>

View file

@ -21,7 +21,7 @@
<string name="poi_aeroway_gate">Flughafengate</string>
<string name="poi_aeroway_terminal">Flughafenterminal</string>
<string name="poi_craft_agricultural_engines">Landmaschinen</string>
<string name="poi_airport">Flughafen</string>
<string name="poi_aerodrome">Flughafen</string>
<string name="poi_alcohol">Spirituosenladen</string>
<string name="poi_alpine_hut">Berghütte</string>
<string name="poi_ambulance_station">Rettungswache</string>
@ -538,7 +538,7 @@
<string name="poi_toll_booth">Mautstelle</string>
<string name="poi_information">Fremdenverkehrsamt</string>
<string name="poi_town">Kleinstadt</string>
<string name="poi_town_hall">Rathaus</string>
<string name="poi_townhall">Rathaus</string>
<string name="poi_toys">Spielwarenhandlung</string>
<string name="poi_trade">Geschäftszentrum</string>
<string name="poi_traffic_calming_bump">Bodenwelle</string>
@ -571,7 +571,7 @@
<string name="poi_waste_disposal">Deponie</string>
<string name="poi_wastewater_plant">Abwasseranlage</string>
<string name="poi_craft_watchmaker">Uhrmacher</string>
<string name="poi_water_mill">Wassermühle</string>
<string name="poi_watermill">Wassermühle</string>
<string name="poi_water_park">Wasserpark</string>
<string name="poi_water_tower">Wasserturm</string>
<string name="poi_water_well">Wasserbrunnen</string>

View file

@ -145,7 +145,7 @@
<string name="poi_halt">Parada de tren</string>
<string name="poi_railway_subway_entrance">Entrada de metro</string>
<string name="poi_subway_station">Estación de metro</string>
<string name="poi_airport">Aeropuerto</string>
<string name="poi_aerodrome">Aeropuerto</string>
<string name="poi_helipad">Helipuerto</string>
<string name="poi_taxi">Parada de taxi</string>
@ -229,7 +229,7 @@
<string name="poi_company">Empresa</string>
<string name="poi_estate_agent">Inmobiliaria</string>
<string name="poi_lawyer">Abogado</string>
<string name="poi_town_hall">Municipio</string>
<string name="poi_townhall">Municipio</string>
<string name="poi_employment_agency">Oficina de empleo</string>
<string name="poi_studio">Estudio</string>
<string name="poi_stadium">Estadio</string>
@ -471,7 +471,7 @@
<string name="poi_waterway_turning_point">Punto de giro fluvial</string>
<string name="poi_weir">Aliviadero</string>
<string name="poi_dam">Presa</string>
<string name="poi_water_mill">Molino de agua</string>
<string name="poi_watermill">Molino de agua</string>
<string name="poi_telephone_exchange">Central telefónica</string>

View file

@ -151,7 +151,7 @@
<string name="poi_subway_station">ایستگاه مترو</string>
<string name="poi_taxi">ایستگاه تاکسی</string>
<string name="poi_airport">فرودگاه</string>
<string name="poi_aerodrome">فرودگاه</string>
<string name="poi_helipad">جایگاه هلیکوپتر</string>
<string name="poi_runway">باند فرودگاه</string>
<string name="poi_aeroway_terminal">ترمینال Aeroway</string>
@ -194,7 +194,7 @@
<string name="poi_waterway_turning_point">نقطه گردش آب</string>
<string name="poi_weir">خاکریز</string>
<string name="poi_dam">سد</string>
<string name="poi_water_mill">اسیاب</string>
<string name="poi_watermill">اسیاب</string>
<string name="poi_power_substation">ایستگاه فرعی</string>
<string name="poi_power_transformer">ترانسفورماتور</string>
@ -289,7 +289,7 @@
<string name="poi_lawyer">دفتر وکالت</string>
<string name="poi_office_telecommunication">دفتر مخابراتی</string>
<string name="poi_ngo">NGO</string>
<string name="poi_town_hall">شهرداری</string>
<string name="poi_townhall">شهرداری</string>
<string name="poi_employment_agency">کاریابی</string>
<string name="poi_research">مرکز تحقیقاتی</string>
<string name="poi_it">دفتر فناوری اطلاعات</string>

View file

@ -12,7 +12,7 @@
<string name="poi_aerialway_station">Station de transport aérien par câble</string>
<string name="poi_aeroway_gate">Porte d\'embarquement</string>
<string name="poi_runway">Aérodrome : piste</string>
<string name="poi_airport">Aérodrome</string>
<string name="poi_aerodrome">Aérodrome</string>
<string name="poi_alcohol">Magasin de boissons alcoolisées</string>
<string name="poi_alpine_hut">Refuge</string>
<string name="poi_ambulance_station">Station d\'ambulances</string>
@ -372,7 +372,7 @@
<string name="poi_water_well">Puits</string>
<string name="poi_water_works">Usine d\'eau potable</string>
<string name="poi_waterfall">Chute d\'eau</string>
<string name="poi_water_mill">Moulin à eau</string>
<string name="poi_watermill">Moulin à eau</string>
<string name="poi_wayside_cross">Calvaire</string>
<string name="poi_wayside_shrine">Oratoire</string>
<string name="poi_wetland">Zone humide</string>
@ -420,7 +420,7 @@
<string name="poi_podiatrist">Podologue</string>
<string name="poi_psychotherapist">Psychothérapeute</string>
<string name="poi_company">Entreprise</string>
<string name="poi_town_hall">Mairie</string>
<string name="poi_townhall">Mairie</string>
<string name="poi_educational_institution">Institution éducative</string>
<string name="poi_bicycle_track">Piste cycable</string>
<string name="poi_australian_football">Football autralien</string>

View file

@ -82,7 +82,7 @@
<string name="poi_subway_station">Estación de metro</string>
<string name="poi_taxi">Parada de taxis</string>
<string name="poi_airport">Aeroporto</string>
<string name="poi_aerodrome">Aeroporto</string>
<string name="poi_helipad">Heliporto</string>
<string name="poi_lighthouse">Faro</string>
@ -100,7 +100,7 @@
<string name="poi_wastewater_plant">Estación depuradora de augas residuais</string>
<string name="poi_water_tower">Depósito de auga</string>
<string name="poi_dam">Encoro</string>
<string name="poi_water_mill">Aceña</string>
<string name="poi_watermill">Aceña</string>
<string name="poi_power_substation">Subestación</string>
<string name="poi_power_transformer">Transformador</string>
@ -167,7 +167,7 @@
<string name="poi_lawyer">Avogado</string>
<string name="poi_office_telecommunication">Oficina de telecomunicacións</string>
<string name="poi_ngo">ONG</string>
<string name="poi_town_hall">Casa do Concello</string>
<string name="poi_townhall">Casa do Concello</string>
<string name="poi_employment_agency">Oficina de emprego</string>
<string name="poi_research">Oficina de investigación</string>
<string name="poi_advertising_agency">Axencia de publicidade</string>

View file

@ -71,7 +71,7 @@
<string name="poi_subway_station">Metrómegálló</string>
<string name="poi_taxi">Taxidroszt</string>
<string name="poi_airport">Repülőtér</string>
<string name="poi_aerodrome">Repülőtér</string>
<string name="poi_runway">Kifutópálya</string>
<string name="poi_aeroway_terminal">Utasterminál</string>
<string name="poi_aeroway_gate">Reptér kapu</string>
@ -122,7 +122,7 @@
<string name="poi_dentist">Fogorvos</string>
<string name="poi_veterinary">Állatorvos</string>
<string name="poi_sanatorium">Szanatórium</string>
<string name="poi_town_hall">Városháza</string>
<string name="poi_townhall">Városháza</string>
<string name="poi_stadium">Stadion</string>
<string name="poi_sports_centre">Sportközpont</string>
<string name="poi_golf_course">Golfpálya</string>

View file

@ -73,7 +73,7 @@
<string name="poi_bus_station">Stazione bus (obsoleto)</string>
<string name="poi_railway_subway_entrance">Entrata metropolitana</string>
<string name="poi_subway_station">Stazione metropolitana</string>
<string name="poi_airport">Aeroporto</string>
<string name="poi_aerodrome">Aeroporto</string>
<string name="poi_helipad">Eliporto</string>
<string name="poi_bicycle_rental">Noleggio bici</string>
<string name="poi_bicycle_parking">Parcheggio bici</string>
@ -135,7 +135,7 @@
<string name="poi_speed_camera">Autovelox</string>
<string name="poi_turning_circle">Rotonda per inversione di marcia</string>
<string name="poi_wastewater_plant">Depuratore acque</string>
<string name="poi_water_mill">Mulino ad acqua</string>
<string name="poi_watermill">Mulino ad acqua</string>
<string name="poi_power_substation">Sottostazione</string>
<string name="poi_power_transformer">Trasformatore</string>
@ -484,7 +484,7 @@
<string name="poi_craft_tinsmith">Lattoniere</string>
<string name="poi_craft_upholsterer">Tappezziere</string>
<string name="poi_funeral_directors">Impresa di pompe funebri</string>
<string name="poi_town_hall">Municipio</string>
<string name="poi_townhall">Municipio</string>
<string name="poi_research">Centro di ricerca e sviluppo</string>
<string name="poi_it">Ufficio IT</string>
<string name="poi_newspaper">Redazione giornalistica</string>

View file

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="poi_airport">空港(Aireport)</string>
<string name="poi_aerodrome">空港(Aireport)</string>
<string name="poi_bank">銀行(Bank)</string>
<string name="poi_bus_stop">バス停(Bus stop)</string>
<string name="poi_car_rental">レンタカー(Car rental)</string>
@ -252,7 +252,7 @@
<string name="poi_waterway_turning_point">船舶転回所(Waterway turning point)</string>
<string name="poi_weir">堰(Weir)</string>
<string name="poi_dam">ダム(Dam)</string>
<string name="poi_water_mill">水車小屋(Water mill)</string>
<string name="poi_watermill">水車小屋(Water mill)</string>
<string name="poi_power_substation">変電所(Substation)</string>
<string name="poi_power_transformer">変圧器・トランス(Transformer)</string>
@ -383,7 +383,7 @@
<string name="poi_lawyer">法律事務所(Lawyer)</string>
<string name="poi_office_telecommunication">通信会社事務所(Telecommunication office)</string>
<string name="poi_ngo">NGO・非政府組織(NGO)</string>
<string name="poi_town_hall">町役場・市庁舎(Town hall)</string>
<string name="poi_townhall">町役場・市庁舎(Town hall)</string>
<string name="poi_employment_agency">職業紹介所(Employment office)</string>
<string name="poi_research">研究所(Research office)</string>
<string name="poi_it">IT関連事務所(IT office)</string>

View file

@ -145,7 +145,7 @@
<string name="poi_subway_station">지하철 역</string>
<string name="poi_taxi">택시 승차장</string>
<string name="poi_airport">공항</string>
<string name="poi_aerodrome">공항</string>
<string name="poi_helipad">헬리콥터 이착륙지</string>
<string name="poi_runway">활주로</string>
<string name="poi_aeroway_terminal">Aeroway 터미널</string>
@ -182,7 +182,7 @@
<string name="poi_lock_gate">게이트 잠금</string>
<string name="poi_waterway_turning_point">수로 터닝 포인트</string>
<string name="poi_dam"></string>
<string name="poi_water_mill">물방앗간</string>
<string name="poi_watermill">물방앗간</string>
<string name="poi_power_substation">변전소</string>
<string name="poi_power_transformer">변압기</string>
@ -277,7 +277,7 @@
<string name="poi_lawyer">변호사</string>
<string name="poi_office_telecommunication">원거리 통신 사무실</string>
<string name="poi_ngo">NGO</string>
<string name="poi_town_hall">타운 홀</string>
<string name="poi_townhall">타운 홀</string>
<string name="poi_employment_agency">Employment 사무실</string>
<string name="poi_research">연구 사무실</string>
<string name="poi_it">IT 사무실</string>

View file

@ -39,7 +39,7 @@
<string name="poi_subway_station">T-banestasjon</string>
<string name="poi_taxi">Taxiholdeplass</string>
<string name="poi_airport">Flyplass</string>
<string name="poi_aerodrome">Flyplass</string>
<string name="poi_ferry_terminal">Fergeterminal</string>
<string name="poi_lighthouse">Fyrtårn</string>

View file

@ -139,7 +139,7 @@
<string name="poi_subway_station">Metrostation</string>
<string name="poi_taxi">Taxistandplaats</string>
<string name="poi_airport">Luchthaven</string>
<string name="poi_aerodrome">Luchthaven</string>
<string name="poi_helipad">Helikopterplatform</string>
<string name="poi_runway">Landingsbaan</string>
<string name="poi_aeroway_terminal">Terminal</string>
@ -209,7 +209,7 @@
<string name="poi_estate_agent">Vastgoedmakelaar</string>
<string name="poi_lawyer">Advocaat</string>
<string name="poi_ngo">NGO</string>
<string name="poi_town_hall">Stadhuis</string>
<string name="poi_townhall">Stadhuis</string>
<string name="poi_advertising_agency">Reclamebureau</string>
<string name="poi_educational_institution">Onderwijsinstelling</string>
<string name="poi_architect">Architectenkantoor</string>
@ -433,7 +433,7 @@
<string name="poi_lock_gate">Schutsluis</string>
<string name="poi_waterway_turning_point">Zwaaikom</string>
<string name="poi_weir">Stuw</string>
<string name="poi_water_mill">Watermolen</string>
<string name="poi_watermill">Watermolen</string>
<string name="poi_power_substation">Onderstation</string>
<string name="poi_power_transformer">Transformator</string>

View file

@ -146,7 +146,7 @@
<string name="poi_subway_station">Stacja metra</string>
<string name="poi_taxi">Postój TAXI</string>
<string name="poi_airport">Lotnisko</string>
<string name="poi_aerodrome">Lotnisko</string>
<string name="poi_helipad">Lądowisko helikopterów</string>
<string name="poi_runway">Pas startowy</string>
<string name="poi_aeroway_terminal">Terminal lotniczy</string>
@ -188,7 +188,7 @@
<string name="poi_wastewater_plant">Oczyszczalnia ścieków</string>
<string name="poi_water_tower">Wieża ciśnień</string>
<string name="poi_dam">Tama</string>
<string name="poi_water_mill">Młyn wodny</string>
<string name="poi_watermill">Młyn wodny</string>
<string name="poi_power_substation">Podstacja</string>
<string name="poi_power_transformer">Transformator</string>
@ -269,7 +269,7 @@
<string name="poi_estate_agent">Agent nieruchomości</string>
<string name="poi_lawyer">Prawnik</string>
<string name="poi_ngo">Organizacja pozarządowa</string>
<string name="poi_town_hall">Ratusz</string>
<string name="poi_townhall">Ratusz</string>
<string name="poi_employment_agency">Urząd pracy</string>
<string name="poi_advertising_agency">Agencja reklamowa</string>
<string name="poi_educational_institution">Instytucja edukacyjna</string>

View file

@ -2,7 +2,7 @@
<resources>
<string name="poi_bakery">Булочная</string>
<string name="poi_alcohol">Винно-водочный магазин</string>
<string name="poi_convenience">Магазин</string>
<string name="poi_convenience">Продуктовый магазин</string>
<string name="poi_mall">Торговый центр</string>
<string name="poi_beverages">Напитки</string>
<string name="poi_butcher">Мясная лавка</string>
@ -12,7 +12,7 @@
<string name="poi_confectionery">Кондитерская</string>
<string name="poi_ice_cream">Мороженое</string>
<string name="poi_supermarket">Супермаркет</string>
<string name="poi_shop_tea">Чайный магазин</string>
<string name="poi_tea">Чайный магазин</string>
<string name="poi_dairy">Молочный магазин</string>
<string name="poi_vending_machine">Торговый автомат</string>
@ -58,7 +58,7 @@
<string name="poi_interior_decoration">Декор и оформление</string>
<string name="poi_jewelry">Ювелирный магазин</string>
<string name="poi_kiosk">Киоск, ларёк</string>
<string name="poi_kitchen">Кухонные принадлежности</string>
<string name="poi_kitchen">Кухни</string>
<string name="poi_mobile_phone">Салон связи</string>
<string name="poi_motorcycle">Мотоциклы</string>
<string name="poi_musical_instrument">Музыкальные инструменты</string>
@ -147,7 +147,7 @@
<string name="poi_subway_station">Станция метро</string>
<string name="poi_taxi">Стоянка такси</string>
<string name="poi_airport">Аэропорт</string>
<string name="poi_aerodrome">Аэропорт</string>
<string name="poi_helipad">Вертолётная площадка</string>
<string name="poi_runway">Взлётная полоса</string>
<string name="poi_aeroway_terminal">Терминал аэропорта</string>
@ -189,7 +189,7 @@
<string name="poi_waterway_turning_point">Поворотная точка на воде</string>
<string name="poi_weir">Небольшая плотина</string>
<string name="poi_dam">Дамба</string>
<string name="poi_water_mill">Водяная мельница</string>
<string name="poi_watermill">Водяная мельница</string>
<string name="poi_power_substation">Подстанция</string>
<string name="poi_power_transformer">Трансформатор</string>
@ -271,7 +271,7 @@
<string name="poi_lawyer">Юридические услуги</string>
<string name="poi_office_telecommunication">Телекоммуникационная компания</string>
<string name="poi_ngo">Общественная организация</string>
<string name="poi_town_hall">Администрация населенного пункта</string>
<string name="poi_townhall">Администрация населенного пункта</string>
<string name="poi_employment_agency">Биржа труда</string>
<string name="poi_research">Исследовательский центр</string>
<string name="poi_it">Информационные технологии</string>

View file

@ -310,7 +310,7 @@
<string name="local_index_installed">Локальная версия</string>
<string name="local_index_installed">Загружено</string>
<string name="local_index_items_backuped">%1$d из %2$d объектов успешно архивированы.</string>
<string name="local_index_items_deleted">%1$d из %2$d объектов успешно удалены.</string>
<string name="local_index_items_restored">%1$d из %2$d объектов успешно активированы.</string>
@ -1933,8 +1933,8 @@
<string name="delay_to_start_navigation">Задержка начала навигации…</string>
<string name="shared_string_go">Поехали</string>
<string name="shared_string_not_use">Не использовать</string>
<string name="plugin_nautical_descr">"Плагин обогащает карты и навигацию OsmAnd, а также делает доступными морские карты для катания на лодках, парусного спорта, и других видов спорта.
\n\nСпециальная карта дополнение для OsmAnd добавляет морские навигационные и условные знаки, для внутренней, так и для прибрежной навигации. Описание каждой навигационной отметки содержит информацию, необходимую для идентификации, а также её значение (категория, форма, цвет, последовательность, ссылка и т.д.).\n\nЧтобы вернуться к одному из традиционных стилей карт в OsmAnd, просто деактивируйте этот плагин или измените на желаемый \"Стиль карты\" в разделе \"Настройка карты\". "</string>
<string name="plugin_nautical_descr">"Плагин расширяет возможности OsmAnd, делая доступными морские карты для катания на лодках, парусного спорта и других видов спорта.
\n\nСпециальная дополнительная карта для OsmAnd добавляет морские навигационные и условные знаки как для внутренней, так и для прибрежной навигации. Описание навигационных отметок содержит информацию, необходимую для их идентификации, а также их характеристики (категория, форма, цвет, последовательность мерцания огней и т.д.).\n\nЧтобы вернуться к одному из традиционных стилей карт в OsmAnd, просто деактивируйте этот плагин или измените на желаемый \"Стиль карты\" в разделе \"Настройка карты\". "</string>
<string name="local_osm_changes_upload_all_confirm">Вы собираетесь загрузить %1$d изменений OSM. Вы уверены?</string>
<string name="confirmation_to_clear_history">Вы хотите очистить историю?</string>
<string name="plugin_ski_descr">"Плагин обеспечивает вам доступ к данным о горнолыжных трассах, маршрутах для беговых лыж, альпийских спусках, фуникулерах и горнолыжных подъемниках. Маршруты и спуски отмечены разными цветами в зависимости от их сложности и изображены с использованием специального \"зимнего\" стиля карты, который заключается в том, что используются \"снежные\" цвета зимнего пейзажа.\n\nВ случае активации этого вида, стиль карты меняется на \"Winter and ski\", показывая все детали пейзажа так, как они выглядят зимой. Такой (зимний) вид может быть отменен либо путем деактивации здесь, либо если вы поменяете \"Стиль карты\" в меню \"Настройка карты\" на желаемый вид. "</string>

View file

@ -124,7 +124,7 @@
<string name="poi_subway_station">Istatzione de sa metropolitana</string>
<string name="poi_taxi">Postèggiu de sos taxi</string>
<string name="poi_airport">Aeroportu</string>
<string name="poi_aerodrome">Aeroportu</string>
<string name="poi_helipad">Eliportu</string>
<string name="poi_runway">Pista d\'aterazu</string>
<string name="poi_slipway">Lassinadòrju</string>
@ -155,7 +155,7 @@
<string name="poi_wastewater_plant">Depuradore de sas abbas</string>
<string name="poi_water_tower">Turre ìdrica</string>
<string name="poi_dam">Diga</string>
<string name="poi_water_mill">Mulinu ad abba</string>
<string name="poi_watermill">Mulinu ad abba</string>
<string name="poi_power_transformer">Trasformadore</string>
<string name="poi_power_plant">Tzentrale elètrica</string>
@ -224,7 +224,7 @@
<string name="poi_estate_agent">Butega immobiliare</string>
<string name="poi_lawyer">Abogadu</string>
<string name="poi_ngo">ONG</string>
<string name="poi_town_hall">Munitzìpiu</string>
<string name="poi_townhall">Munitzìpiu</string>
<string name="poi_employment_agency">Ufìtziu pro su traballu</string>
<string name="poi_it">Ufìtziu IT</string>
<string name="poi_newspaper">Redatzione de giornale</string>

View file

@ -163,7 +163,7 @@
<string name="poi_railway_buffer_stop">Železničná zarážka</string>
<string name="poi_taxi">Stanovište taxíkov</string>
<string name="poi_airport">Letisko</string>
<string name="poi_aerodrome">Letisko</string>
<string name="poi_helipad">Plocha pre vrtuľníky</string>
<string name="poi_runway">Pristávacia dráha</string>
<string name="poi_aeroway_terminal">Terminál</string>
@ -205,7 +205,7 @@
<string name="poi_waterway_turning_point">Obratisko na vode</string>
<string name="poi_weir">Vzdúvacia hrádza</string>
<string name="poi_dam">Priehrada/Hrádza</string>
<string name="poi_water_mill">Vodný mlyn</string>
<string name="poi_watermill">Vodný mlyn</string>
<string name="poi_power_substation">Elektrická stanica</string>
<string name="poi_power_transformer">Transformátor</string>
@ -291,7 +291,7 @@
<string name="poi_lawyer">Právnik</string>
<string name="poi_office_telecommunication">Telekomunikácie</string>
<string name="poi_ngo">Nezisková organizácia</string>
<string name="poi_town_hall">Radnica</string>
<string name="poi_townhall">Radnica</string>
<string name="poi_employment_agency">Personálna agentúra</string>
<string name="poi_research">Výskumný ústav</string>
<string name="poi_it">Informačné technológie</string>

View file

@ -12,6 +12,7 @@
<attr name="btn_flat_bg" format="reference" />
<attr name="card_bg_color" format="reference" />
<attr name="spinnerItemTextColor" format="reference" />
<attr name="spinnerListBackground" format="color|reference" />
<attr name="dashboard_divider" format="reference" />
<attr name="dashboard_button" format="reference" />
<attr name="search_background" format="reference" />

View file

@ -151,4 +151,7 @@
<color name="plugin_details_install_header_bg_light">#dbdbdb</color>
<color name="plugin_details_install_header_bg_dark">#2d3438</color>
<color name="spinner_list_background_light">#eeeeee</color>
<color name="spinner_list_background_dark">#303030</color>
</resources>

View file

@ -57,7 +57,7 @@
<string name="poi_confectionery">Confectionery</string>
<string name="poi_ice_cream">Ice cream parlor</string>
<string name="poi_supermarket">Supermarket</string>
<string name="poi_shop_tea">Tea shop</string>
<string name="poi_tea">Tea shop</string>
<string name="poi_dairy">Dairy shop</string>
<string name="poi_vending_machine">Vending machine</string>
<string name="poi_wine">Wine shop</string>
@ -221,7 +221,7 @@
<string name="poi_railway_buffer_stop">Railway buffer stop</string>
<string name="poi_taxi">Taxi stand</string>
<string name="poi_airport">Airport</string>
<string name="poi_aerodrome">Airport</string>
<string name="poi_helipad">Helipad</string>
<string name="poi_runway">Runway</string>
<string name="poi_aeroway_terminal">Aeroway terminal</string>
@ -266,7 +266,7 @@
<string name="poi_waterway_turning_point">Waterway turning point</string>
<string name="poi_weir">Weir</string>
<string name="poi_dam">Dam</string>
<string name="poi_water_mill">Water mill</string>
<string name="poi_watermill">Water mill</string>
<string name="poi_power_substation">Substation</string>
<string name="poi_power_transformer">Transformer</string>
@ -379,7 +379,7 @@
<string name="poi_lawyer">Lawyer</string>
<string name="poi_office_telecommunication">Telecommunication office</string>
<string name="poi_ngo">NGO</string>
<string name="poi_town_hall">Town hall</string>
<string name="poi_townhall">Town hall</string>
<string name="poi_employment_agency">Employment office</string>
<string name="poi_research">Research office</string>
<string name="poi_it">IT office</string>

View file

@ -9,6 +9,13 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="osm_edit_context_menu_delete">Delete Osm Edit</string>
<string name="rendering_value_disabled_name">Disabled</string>
<string name="rendering_value_walkingRoutesScopeOSMC_name">Coloring according to route scope</string>
<string name="rendering_value_walkingRoutesOSMC_name">Coloring according to OSMC</string>
<string name="osmo_share_my_location">Share my location</string>
<string name="shared_string_logoff">Log Off</string>
<string name="rendering_attr_hideHouseNumbers_name">Hide house numbers</string>
<string name="application_dir_change_warning3">Do you want OsmAnd to also copy its data files to the new destination?</string>
<string name="specified_directiory_not_writeable">Maps could not be created in specified directory</string>
<string name="copying_osmand_file_failed">Copying files failed</string>

View file

@ -86,7 +86,8 @@
<item name="dashboard_general_button_text_color">@color/dashboard_general_button_text_light</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_light</item>
<item name="android:textColorPrimary">@color/color_black</item>
<item name="spinnerItemTextColor">@color/color_white</item>
<item name="spinnerItemTextColor">@color/color_black</item>
<item name="spinnerListBackground">@color/spinner_list_background_light</item>
<item name="android:actionModeBackground">@color/actionbar_light_color</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
@ -128,6 +129,7 @@
<item name="android:listChoiceIndicatorMultiple">@drawable/check_dark</item>
<item name="android:textColorPrimary">@color/color_white</item>
<item name="spinnerItemTextColor">@color/color_white</item>
<item name="spinnerListBackground">@color/spinner_list_background_dark</item>
<item name="android:actionModeBackground">@color/actionbar_dark_color</item>

View file

@ -19,6 +19,8 @@ public class PointDescription {
private String type = "";
private String name = "";
private String typeName;
private double lat = 0;
private double lon = 0;
public static final String POINT_TYPE_FAVORITE = "favorite";
public static final String POINT_TYPE_WPT = "wpt";
@ -36,6 +38,12 @@ public class PointDescription {
public static final PointDescription LOCATION_POINT = new PointDescription(POINT_TYPE_LOCATION, "");
public PointDescription(double lat, double lon) {
this(POINT_TYPE_LOCATION, "");
this.lat = lat;
this.lon = lon;
}
public PointDescription(String type, String name) {
this.type = type;
@ -53,6 +61,14 @@ public class PointDescription {
this.name = "";
}
}
public void setLat(double lat) {
this.lat = lat;
}
public void setLon(double lon) {
this.lon = lon;
}
public void setTypeName(String typeName){
this.typeName = typeName;
@ -72,7 +88,7 @@ public class PointDescription {
}
@NonNull
public String getSimpleName(Context ctx, double lat, double lon, boolean addTypeName) {
public String getSimpleName(Context ctx, boolean addTypeName) {
if (isLocation()) {
return getLocationName(ctx, lat, lon, true).replace('\n', ' ');
}
@ -86,7 +102,7 @@ public class PointDescription {
return name;
}
public String getFullPlainName(Context ctx, double lat, double lon) {
public String getFullPlainName(Context ctx) {
if (isLocation()) {
return getLocationName(ctx, lat, lon, false);
} else {
@ -117,7 +133,13 @@ public class PointDescription {
return pnt.zone_number + "" + pnt.zone_letter + " " + ((long) pnt.northing) + " "
+ ((long) pnt.easting);
} else {
return ctx.getString( sh? R.string.short_location_on_map : R.string.location_on_map, convert(lat, f), convert(lon, f));
try {
return ctx.getString(sh ? R.string.short_location_on_map : R.string.location_on_map, convert(lat, f),
convert(lon, f));
} catch(RuntimeException e) {
e.printStackTrace();
return ctx.getString(sh ? R.string.short_location_on_map : R.string.location_on_map, 0, 0);
}
}
}
@ -161,6 +183,8 @@ public class PointDescription {
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
result = prime * result + ((lat == 0) ? 0 : new Double(lat).hashCode());
result = prime * result + ((lon == 0) ? 0 : new Double(lon).hashCode());
return result;
}
@ -173,6 +197,8 @@ public class PointDescription {
PointDescription other = (PointDescription) obj;
if (Algorithms.objectEquals(other.name, name)
&& Algorithms.objectEquals(other.type, type)
&& Algorithms.objectEquals(other.lat, lat)
&& Algorithms.objectEquals(other.lon, lon)
&& Algorithms.objectEquals(other.typeName, typeName)) {
return true;
}
@ -182,7 +208,7 @@ public class PointDescription {
public static String getSimpleName(LocationPoint o, Context ctx) {
PointDescription pd = o.getPointDescription(ctx);
return pd.getSimpleName(ctx, o.getLatitude(), o.getLongitude(), true);
return pd.getSimpleName(ctx, true);
// return o.getPointDescription(ctx).getFullPlainName(ctx, o.getLatitude(), o.getLongitude());
}
@ -197,20 +223,25 @@ public class PointDescription {
return tp + "#" + p.name;
}
public static PointDescription deserializeFromString(String s) {
public static PointDescription deserializeFromString(String s, LatLon l) {
PointDescription pd = null;
if (s != null && s.length() > 0) {
int in = s.indexOf('#');
if (in >= 0) {
String nm = s.substring(in + 1).trim();
String tp = s.substring(0, in);
if(tp.contains(".")) {
return new PointDescription(tp.substring(0, tp.indexOf('.')), tp.substring(tp.indexOf('.') + 1), nm);
pd = new PointDescription(tp.substring(0, tp.indexOf('.')), tp.substring(tp.indexOf('.') + 1), nm);
} else {
return new PointDescription(tp, nm);
pd = new PointDescription(tp, nm);
}
}
}
return null;
if(pd != null && pd.isLocation() && l != null) {
pd.setLat(l.getLatitude());
pd.setLon(l.getLongitude());
}
return pd;
}

View file

@ -729,7 +729,7 @@ public class GPXUtilities {
writeNotNullText(serializer, "desc", p.desc);
if(p.link != null) {
serializer.startTag(null, "link");
serializer.attribute(null, "link", p.link);
serializer.attribute(null, "href", p.link);
serializer.endTag(null, "link");
}
writeNotNullText(serializer, "type", p.category);

View file

@ -90,9 +90,9 @@ public class OsmAndFormatter {
if (meters >= 100 * mainUnitInMeters) {
return (int) (meters / mainUnitInMeters + 0.5) + " " + ctx.getString(mainUnitStr); //$NON-NLS-1$
} else if (meters > 9.99f * mainUnitInMeters) {
return MessageFormat.format("{0,number,#.#} " + ctx.getString(mainUnitStr), ((float) meters) / mainUnitInMeters); //$NON-NLS-1$
return MessageFormat.format("{0,number,#.#} " + ctx.getString(mainUnitStr), ((float) meters) / mainUnitInMeters).replace('\n', ' '); //$NON-NLS-1$
} else if (meters > 0.999f * mainUnitInMeters) {
return MessageFormat.format("{0,number,#.##} " + ctx.getString(mainUnitStr), ((float) meters) / mainUnitInMeters); //$NON-NLS-1$
return MessageFormat.format("{0,number,#.##} " + ctx.getString(mainUnitStr), ((float) meters) / mainUnitInMeters).replace('\n', ' '); //$NON-NLS-1$
} else {
if (mc == MetricsConstants.KILOMETERS_AND_METERS) {
return ((int) (meters + 0.5)) + " " + ctx.getString(R.string.m); //$NON-NLS-1$

View file

@ -433,7 +433,7 @@ public class OsmandSettings {
@Override
protected boolean setValue(Object prefs, Integer val) {
return settingsAPI.edit( prefs).putInt(getId(), val).commit();
return settingsAPI.edit(prefs).putInt(getId(), val).commit();
}
}
@ -747,9 +747,6 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> SHOW_POI_OVER_MAP = new BooleanPreference("show_poi_over_map", false).makeGlobal();
public final OsmandPreference<Boolean> SHOW_POI_LABEL = new BooleanPreference("show_poi_label", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
@ -925,7 +922,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> DEBUG_RENDERING_INFO = new BooleanPreference("debug_rendering", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> SHOW_FAVORITES = new BooleanPreference("show_favorites", false).makeGlobal();
public final OsmandPreference<Boolean> SHOW_FAVORITES = new BooleanPreference("show_favorites", false).makeGlobal().cache();
public final CommonPreference<Boolean> SHOW_ZOOM_BUTTONS_NAVIGATION = new BooleanPreference("show_zoom_buttons_navigation", false).makeProfile().cache();
{
@ -1325,10 +1322,10 @@ public class OsmandSettings {
return new LatLon(lat, lon);
}
public PointDescription getAndClearMapLabelToShow(){
public PointDescription getAndClearMapLabelToShow(LatLon l){
String label = settingsAPI.getString(globalPreferences,MAP_LABEL_TO_SHOW, null);
settingsAPI.edit(globalPreferences).remove(MAP_LABEL_TO_SHOW).commit();
return PointDescription.deserializeFromString(label);
return PointDescription.deserializeFromString(label, l);
}
private Object objectToShow;
@ -1417,12 +1414,12 @@ public class OsmandSettings {
public PointDescription getStartPointDescription() {
return
PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, START_POINT_DESCRIPTION, ""));
PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, START_POINT_DESCRIPTION, ""), getPointToStart());
}
public PointDescription getPointNavigateDescription() {
return
PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION, ""));
PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION, ""), getPointToNavigate());
}
@ -1672,15 +1669,8 @@ public class OsmandSettings {
return settingsAPI.edit(globalPreferences).putString(LAST_SEARCHED_INTERSECTED_STREET, street).commit();
}
public static final String SELECTED_POI_FILTER_FOR_MAP = "selected_poi_filter_for_map"; //$NON-NLS-1$
public boolean setPoiFilterForMap(String filterId) {
return settingsAPI.edit(globalPreferences).putString(SELECTED_POI_FILTER_FOR_MAP, filterId).commit();
}
public String getPoiFilterForMap(){
return settingsAPI.getString(globalPreferences,SELECTED_POI_FILTER_FOR_MAP, null);
}
public final OsmandPreference<String> SELECTED_POI_FILTER_FOR_MAP = new StringPreference("selected_poi_filter_for_map", null).makeGlobal().cache();
public static final String VOICE_PROVIDER_NOT_USE = "VOICE_PROVIDER_NOT_USE";
// this value string is synchronized with settings_pref.xml preference name

View file

@ -102,7 +102,7 @@ public class TargetPointsHelper {
List<LatLon> ips = settings.getIntermediatePoints();
List<String> desc = settings.getIntermediatePointDescriptions(ips.size());
for(int i = 0; i < ips.size(); i++) {
intermediatePoints.add(new TargetPoint(ips.get(i), PointDescription.deserializeFromString(desc.get(i)), i));
intermediatePoints.add(new TargetPoint(ips.get(i), PointDescription.deserializeFromString(desc.get(i), ips.get(i)), i));
}
}

View file

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

View file

@ -368,9 +368,6 @@ public class MapActivity extends AccessibleActivity {
settings.APPLICATION_MODE.addListener(applicationModeListener);
updateApplicationModeSettings();
String filterId = settings.getPoiFilterForMap();
PoiLegacyFilter poiFilter = app.getPoiFilters().getFilterById(filterId);
mapLayers.getPoiMapLayer().setFilter(poiFilter);
// if destination point was changed try to recalculate route
TargetPointsHelper targets = app.getTargetPointsHelper();
@ -463,7 +460,7 @@ public class MapActivity extends AccessibleActivity {
public void readLocationToShow() {
LatLon cur = new LatLon(mapView.getLatitude(), mapView.getLongitude());
LatLon latLonToShow = settings.getAndClearMapLocationToShow();
PointDescription mapLabelToShow = settings.getAndClearMapLabelToShow();
PointDescription mapLabelToShow = settings.getAndClearMapLabelToShow(latLonToShow);
Object toShow = settings.getAndClearObjectToShow();
int status = settings.isRouteToPointNavigateAndClear();
if (status != 0) {
@ -483,7 +480,7 @@ public class MapActivity extends AccessibleActivity {
if (mapLabelToShow != null) {
mapLayers.getContextMenuLayer().setSelectedObject(toShow);
mapLayers.getContextMenuLayer().setLocation(latLonToShow,
mapLabelToShow.getFullPlainName(this, latLonToShow.getLatitude(), latLonToShow.getLongitude()));
mapLabelToShow.getFullPlainName(this));
}
if (!latLonToShow.equals(cur)) {
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
@ -845,8 +842,8 @@ public class MapActivity extends AccessibleActivity {
Intent intent = getIntent();
if (intent != null && intent.getData() != null) {
Uri data = intent.getData();
if ("http".equalsIgnoreCase(data.getScheme()) && "download.osmand.net".equals(data.getHost())
&& "/go".equals(data.getPath())) {
if ("http".equalsIgnoreCase(data.getScheme()) && data.getHost() != null && data.getHost().contains("osmand.net") &&
data.getPath() != null && data.getPath().startsWith("/go")) {
String lat = data.getQueryParameter("lat");
String lon = data.getQueryParameter("lon");
if (lat != null && lon != null) {

View file

@ -46,6 +46,7 @@ import net.osmand.plus.views.PointNavigationLayer;
import net.osmand.plus.views.RouteLayer;
import net.osmand.plus.views.TransportInfoLayer;
import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
@ -76,9 +77,15 @@ public class MapActivityLayers {
private ContextMenuLayer contextMenuLayer;
private MapControlsLayer mapControlsLayer;
private DownloadedRegionsLayer downloadedRegionsLayer;
private MapWidgetRegistry mapWidgetRegistry;
public MapActivityLayers(MapActivity activity) {
this.activity = activity;
this.mapWidgetRegistry = new MapWidgetRegistry(activity.getMyApplication().getSettings());
}
public MapWidgetRegistry getMapWidgetRegistry() {
return mapWidgetRegistry;
}
public OsmandApplication getApplication(){
@ -117,8 +124,10 @@ public class MapActivityLayers {
// 2. osm bugs layer
// 3. poi layer
poiMapLayer = new POIMapLayer(activity);
mapView.addLayer(poiMapLayer, 3);
// 4. favorites layer
favoritesLayer = new FavoritesLayer();
mapView.addLayer(favoritesLayer, 4);
// 5. transport layer
transportStopsLayer = new TransportStopsLayer();
// 5.5 transport info layer
@ -166,22 +175,6 @@ public class MapActivityLayers {
mapView.removeLayer(transportStopsLayer);
}
}
if(mapView.getLayers().contains(poiMapLayer) != settings.SHOW_POI_OVER_MAP.get()){
if(settings.SHOW_POI_OVER_MAP.get()){
mapView.addLayer(poiMapLayer, 3);
} else {
mapView.removeLayer(poiMapLayer);
}
}
if(mapView.getLayers().contains(favoritesLayer) != settings.SHOW_FAVORITES.get()){
if(settings.SHOW_FAVORITES.get()){
mapView.addLayer(favoritesLayer, 4);
} else {
mapView.removeLayer(favoritesLayer);
}
}
OsmandPlugin.refreshLayers(mapView, activity);
}
@ -276,12 +269,11 @@ public class MapActivityLayers {
activity.getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.POI_TAB_INDEX);
activity.startActivity(search);
} else {
getApplication().getSettings().setPoiFilterForMap(filterId);
pf = poiFilters.getFilterById(filterId);
if (pf != null) {
pf.setFilterByName(pf.getSavedFilterByName());
}
poiMapLayer.setFilter(pf);
getApplication().getSettings().SELECTED_POI_FILTER_FOR_MAP.set(filterId);
mapView.refreshMap();
if(selected != null && selected.length > 0) {
selected[0] = pf;

View file

@ -11,6 +11,7 @@ import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import android.app.Dialog;
import android.content.Intent;
@ -178,26 +179,19 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
public void onResume() {
super.onResume();
//Hardy: onResume() code is needed so that search origin is properly reflected in tab contents when origin has been changed on one tab, then tab is changed to another one.
location = null;
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
//Intent intent = getSherlockActivity().getIntent();
//if (intent != null) {
// if (intent.hasExtra(SearchActivity.SEARCH_LAT) && intent.hasExtra(SearchActivity.SEARCH_LON)) {
// double lat = intent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0);
// double lon = intent.getDoubleExtra(SearchActivity.SEARCH_LON, 0);
// if (lat != 0 || lon != 0) {
// location = new LatLon(lat, lon);
// }
// }
//}
if (location == null && getActivity() instanceof SearchActivity) {
location = ((SearchActivity) getActivity()).getSearchPoint();
LatLon loc = null;
if (getActivity() instanceof SearchActivity) {
loc = ((SearchActivity) getActivity()).getSearchPoint();
}
if (location == null) {
location = app.getSettings().getLastKnownMapLocation();
if (loc == null) {
loc = app.getSettings().getLastKnownMapLocation();
}
if(!Algorithms.objectEquals(loc, location)) {
location = loc;
locationUpdate(location);
}
locationUpdate(location);
}
@Override
@ -385,19 +379,20 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
LatLon loc = parseLocation();
double lat = loc.getLatitude();
double lon = loc.getLongitude();
PointDescription pd = new PointDescription(lat, lon);
if(mode == ADD_TO_FAVORITE) {
Bundle b = new Bundle();
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
dlg.show();
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, lat, lon, PointDescription.LOCATION_POINT);
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, lat, lon, pd);
} else if (mode == NAVIGATE_TO) {
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), lat, lon, PointDescription.LOCATION_POINT);
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), lat, lon, pd);
} else if (mode == ADD_WAYPOINT) {
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), lat, lon, PointDescription.LOCATION_POINT);
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), lat, lon, pd);
} else if (mode == SHOW_ON_MAP){
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
app.getSettings().setMapLocationToShow(lat, lon, Math.max(12, app.getSettings().getLastKnownMapZoom()),
PointDescription.LOCATION_POINT);
pd);
MapActivity.launchMapActivityMoveToTop(getActivity());
}

View file

@ -70,8 +70,7 @@ public class SettingsActivity extends SettingsBaseActivity {
startActivity(new Intent(this, SettingsNavigationActivity.class));
}
}
if ((Version.getBuildAppEdition(getMyApplication()).length() > 0
|| Version.isDeveloperVersion(getMyApplication())) &&
if ((Version.isDeveloperVersion(getMyApplication())) &&
OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) != null){
version = new Preference(this);
version.setOnPreferenceClickListener(this);

View file

@ -453,8 +453,12 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
private void warnAboutChangingStorage(final String newValue) {
final String newDir = newValue != null ? newValue.trim() : newValue;
File path = new File(newDir);
String newDir = newValue != null ? newValue.trim() : newValue;
if(!newDir.replace('/', ' ').trim().
toLowerCase().endsWith(IndexConstants.APP_DIR.replace('/', ' ').trim())) {
newDir += "/" +IndexConstants.APP_DIR;
}
final File path = new File(newDir);
path.mkdirs();
if (!path.canRead() || !path.exists()) {
AccessibleToast.makeText(this, R.string.specified_dir_doesnt_exist, Toast.LENGTH_LONG).show();
@ -467,12 +471,11 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
public void onClick(DialogInterface dialog, int which) {
MoveFilesToDifferentDirectory task =
new MoveFilesToDifferentDirectory(SettingsGeneralActivity.this,
new File(settings.getExternalStorageDirectory(), IndexConstants.APP_DIR), new File(newDir,
IndexConstants.APP_DIR));
settings.getExternalStorageDirectory(), path);
task.setRunOnSuccess(new Runnable() {
@Override
public void run() {
updateSettingsToNewDir(newDir);
updateSettingsToNewDir(path.getParentFile().getAbsolutePath());
}
});
task.execute();
@ -482,7 +485,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
updateSettingsToNewDir(newDir);
updateSettingsToNewDir(path.getParentFile().getAbsolutePath());
}
});
builder.setNegativeButton(R.string.shared_string_cancel, null);
@ -490,7 +493,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
}
private void updateSettingsToNewDir(final String newDir) {
// TODO v19
// edit the preference
settings.setExternalStorageDirectoryPre19(newDir);
getMyApplication().getResourceManager().resetStoreDirectory();

View file

@ -14,14 +14,16 @@ import android.support.v4.view.ViewPager;
public class TabActivity extends ActionBarProgressActivity {
public TabItem getTabIndicator(int resId, Class<?> fragment){
return new TabItem(getString(resId), fragment);
return new TabItem(resId, getString(resId), fragment);
}
public static class TabItem {
public final CharSequence mTitle;
public final Class<?> fragment;
public final int resId;
public TabItem(CharSequence mTitle, Class<?> fragment) {
public TabItem(int resId, CharSequence mTitle, Class<?> fragment) {
this.resId = resId;
this.mTitle = mTitle;
this.fragment = fragment;
}

View file

@ -72,7 +72,6 @@ public class TrackActivity extends TabActivity {
setViewPagerAdapter(mViewPager, new ArrayList<TabActivity.TabItem>());
mSlidingTabLayout.setViewPager(mViewPager);
new AsyncTask<Void, Void, GPXFile>() {
protected void onPreExecute() {
@ -114,6 +113,9 @@ public class TrackActivity extends TabActivity {
}
public List<GpxSelectionHelper.GpxDisplayGroup> getResult() {
if(result == null) {
return new ArrayList<GpxSelectionHelper.GpxDisplayGroup>();
}
if (result.modifiedTime != modifiedTime) {
modifiedTime = result.modifiedTime;
GpxSelectionHelper selectedGpxHelper = ((OsmandApplication) getApplication()).getSelectedGpxHelper();
@ -171,11 +173,11 @@ public class TrackActivity extends TabActivity {
}
boolean isHavingWayPoints(){
return getGpx().hasWptPt();
return getGpx() != null && getGpx().hasWptPt();
}
boolean isHavingRoutePoints(){
return getGpx().hasRtePt();
return getGpx() != null && getGpx().hasRtePt();
}
public GPXFile getGpx() {

View file

@ -168,7 +168,7 @@ public class GeoIntentActivity extends OsmandListActivity {
} else {
distanceLabel.setText(""); //$NON-NLS-1$
}
label.setText(getString(model).getFullPlainName(getApplication(), 0, 0));
label.setText(getString(model).getFullPlainName(getApplication()));
return row;
}
}

View file

@ -253,7 +253,7 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
}
distanceText.setText(distance);
PointDescription pd = historyEntry.getName();
nameText.setText(pd.getSimpleName(activity, historyEntry.getLat(), historyEntry.getLon(), false), BufferType.SPANNABLE);
nameText.setText(pd.getSimpleName(activity, false), BufferType.SPANNABLE);
ImageView icon = ((ImageView) row.findViewById(R.id.icon));
if (historyEntry.getName().isAddress()) {

View file

@ -162,8 +162,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
public boolean onMenuItemClick(MenuItem item) {
OsmandSettings settings = app.getSettings();
filter.setFilterByName(searchFilter.getText().toString().trim());
settings.setPoiFilterForMap(filter.getFilterId());
settings.SHOW_POI_OVER_MAP.set(true);
settings.SELECTED_POI_FILTER_FOR_MAP.set(filter.getFilterId());
if (location != null) {
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), 15);
}
@ -410,6 +409,9 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
} else {
this.filter.updateTypesToAccept(custom);
}
filter.clearPreviousZoom();
// run query again
runNewSearchQuery(location, NEW_SEARCH_INIT);
}
if (filter == null || filter.isEmpty()) {
finish();

View file

@ -44,6 +44,7 @@ public class SearchRegionByNameActivity extends SearchByNameAbstractActivity<Reg
protected LatLon getLocation(RegionAddressRepository item) {
return item.getEstimatedRegionCenter();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View file

@ -83,6 +83,7 @@ import android.widget.Toast;
public class AudioVideoNotesPlugin extends OsmandPlugin {
public static final int NOTES_TAB = R.string.notes;
public static final String ID = "osmand.audionotes";
public static final String THREEGP_EXTENSION = "3gp";
public static final String MPEG4_EXTENSION = "mp4";
@ -133,6 +134,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
private MediaRecorder mediaRec;
private File lastTakingPhoto;
private final static char SPLIT_DESC = ' ';
public static class Recording {
public Recording(File f) {
this.file = f;
@ -174,18 +176,12 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
public File getFile() {
return file;
}
public boolean setName(String name) {
File directory = file.getParentFile();
File directory = file.getParentFile();
String fileName = getFileName();
final String hashAndExtension;
int hashInd = fileName.lastIndexOf('_');
if (hashInd == -1) {
hashAndExtension = "_" + fileName;
} else {
hashAndExtension = fileName.substring(hashInd, fileName.length());
}
File to = new File(directory, name+hashAndExtension);
File to = new File(directory, name + SPLIT_DESC + getOtherName(fileName));
if (file.renameTo(to)) {
file = to;
return true;
@ -196,13 +192,35 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
public String getFileName() {
return file.getName();
}
public String getDescriptionName(String fileName) {
int hashInd = fileName.lastIndexOf(SPLIT_DESC);
//backward compatibility
if( fileName.indexOf('.') - fileName.indexOf('_') > 12 &&
hashInd < fileName.indexOf('_')) {
hashInd = fileName.indexOf('_');
}
if(hashInd == -1) {
return null;
} else {
return fileName.substring(0, hashInd);
}
}
public String getOtherName(String fileName) {
String descriptionName = getDescriptionName(fileName);
if(descriptionName != null) {
return fileName.substring(descriptionName.length() + 1); // SPLIT_DESC
} else {
return fileName;
}
}
public String getName(Context ctx) {
String fileName = file.getName();
int hashInd = fileName.lastIndexOf('_');
if (hashInd != -1) {
return fileName.substring(0, hashInd);
String desc = getDescriptionName(fileName);
if (desc != null) {
return desc;
} else if (this.isAudio()) {
return ctx.getResources().getString(R.string.shared_string_audio);
} else if (this.isVideo()) {
@ -605,7 +623,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
f.mkdirs();
File fl;
do {
fl = new File(f, basename + "-" + (k++) + "." + ext);
fl = new File(f, basename + "." + (k++) + "." + ext);
} while (fl.exists());
return fl;
}
@ -977,9 +995,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
@Override
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabItem> mTabs, Intent intent) {
if (getAllRecordings().size() > 0) {
mTabs.add(favoritesActivity.getTabIndicator(R.string.notes, NotesFragment.class));
mTabs.add(favoritesActivity.getTabIndicator(NOTES_TAB, NotesFragment.class));
if (intent != null && "AUDIO".equals(intent.getStringExtra("TAB"))) {
app.getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB);
app.getSettings().FAVORITES_TAB.set(NOTES_TAB);
}
}
}
@ -990,17 +1008,14 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
return false;
}
Recording r = new Recording(f);
String encodeName = f.getName();
int i = encodeName.lastIndexOf('_');
String fileName = f.getName();
String otherName = r.getOtherName(fileName);
int i = otherName.indexOf('.');
if (i > 0) {
encodeName = encodeName.substring(i + 1);
}
i = encodeName.indexOf('.');
if (i > 0) {
encodeName = encodeName.substring(0, i);
otherName = otherName.substring(0, i);
}
r.file = f;
GeoParsedPoint geo = MapUtils.decodeShortLinkString(encodeName);
GeoParsedPoint geo = MapUtils.decodeShortLinkString(otherName);
r.lat = geo.getLatitude();
r.lon = geo.getLongitude();
Float heading = app.getLocationProvider().getHeading();

View file

@ -38,7 +38,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startFavoritesActivity(FavoritesActivity.NOTES_TAB);
startFavoritesActivity(AudioVideoNotesPlugin.NOTES_TAB);
}
});
return view;

View file

@ -39,7 +39,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startFavoritesActivity(FavoritesActivity.FAVORITES_TAB);
startFavoritesActivity(FavoritesActivity.FAV_TAB);
}
});
return view;

View file

@ -31,6 +31,7 @@ import net.osmand.plus.osmo.DashOsMoFragment;
import net.osmand.plus.parkingpoint.DashParkingFragment;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.DownloadedRegionsLayer;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapTileView;
import android.annotation.SuppressLint;
import android.app.Activity;
@ -422,8 +423,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
} else {
scrollView.setVisibility(View.GONE);
listViewLayout.setVisibility(View.VISIBLE);
if(listView instanceof ObservableListView) {
onScrollChanged(((ObservableListView)listView).getScrollY(), false, false);
if (listView instanceof ObservableListView) {
onScrollChanged(((ObservableListView) listView).getScrollY(), false, false);
}
if(refresh) {
refreshContent(false);
@ -471,7 +472,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
} else {
if (DashboardType.CONFIGURE_SCREEN == visibleType) {
cm = mapActivity.getMapLayers().getMapInfoLayer().getViewConfigureMenuAdapter();
cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity);
} else if(DashboardType.CONFIGURE_MAP == visibleType) {
cm = new ConfigureMapMenu().createListAdapter(mapActivity);
} else if(DashboardType.LIST_MENU == visibleType) {
@ -779,7 +780,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
// Translate list background
if (portrait) {
setTranslationY(listBackgroundView, Math.max(0, -scrollY + mFlexibleSpaceImageHeight));
if(listBackgroundView != null) {
setTranslationY(listBackgroundView, Math.max(0, -scrollY + mFlexibleSpaceImageHeight));
}
}
if (portrait) {
setTranslationY(toolbar, Math.min(0, -scrollY + mFlexibleSpaceImageHeight - mFlexibleBlurSpaceHeight));
@ -839,7 +842,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private void updateListAdapter(ArrayAdapter<?> listAdapter, OnItemClickListener listener) {
this.listAdapter = listAdapter;
this.listAdapterOnClickListener = listener;
if(this.listView != null) {
if (this.listView != null) {
listView.setAdapter(listAdapter);
if(!portrait) {
listView.setOnItemClickListener(this.listAdapterOnClickListener);

View file

@ -17,10 +17,12 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.activities.TransportRouteHelper;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.corenative.NativeCoreContext;
@ -33,6 +35,7 @@ import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.view.View;
import android.widget.ArrayAdapter;
@ -92,7 +95,7 @@ public class ConfigureMapMenu {
@Override
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) {
if(itemId == R.string.layer_poi && cm.getSelection(pos) == 1) {
if(itemId == R.string.layer_poi) {
selectPOILayer(ma.getMyApplication().getSettings());
return false;
} else if(itemId == R.string.layer_gpx_layer && cm.getSelection(pos) == 1) {
@ -107,13 +110,18 @@ public class ConfigureMapMenu {
public boolean onContextMenuClick(final ArrayAdapter<?> adapter, int itemId, final int pos, boolean isChecked) {
final OsmandSettings settings = ma.getMyApplication().getSettings();
if (itemId == R.string.layer_poi) {
settings.setPoiFilterForMap(null);
ma.getMapLayers().getPoiMapLayer().setFilter(null);
settings.SHOW_POI_OVER_MAP.set(isChecked);
settings.SELECTED_POI_FILTER_FOR_MAP.set(null);
if (isChecked) {
selectPOILayer(settings);
}
} else if (itemId == R.string.layer_map) {
if(OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) {
Intent intent = new Intent(ma, PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandRasterMapsPlugin.ID);
ma.startActivity(intent);
} else {
ma.getMapLayers().selectMapLayer(ma.getMapView());
}
} else if (itemId == R.string.layer_amenity_label) {
settings.SHOW_POI_LABEL.set(isChecked);
} else if (itemId == R.string.shared_string_favorites) {
@ -140,15 +148,12 @@ public class ConfigureMapMenu {
}
protected void selectPOILayer(final OsmandSettings settings) {
final PoiLegacyFilter[] selected = new PoiLegacyFilter[1];
final PoiLegacyFilter[] selected = new PoiLegacyFilter[1];
AlertDialog dlg = ma.getMapLayers().selectPOIFilterLayer(ma.getMapView(), selected);
dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if(selected[0] == null) {
settings.SHOW_POI_OVER_MAP.set(selected[0] != null);
}
ma.getDashboard().refreshContent(true);
}
});
@ -161,8 +166,10 @@ public class ConfigureMapMenu {
LayerMenuListener l = new LayerMenuListener(activity, adapter);
adapter.item(R.string.shared_string_show).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
// String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] ";
adapter.item(R.string.layer_poi).selected(settings.SHOW_POI_OVER_MAP.get() ? 1 : 0)
adapter.item(R.string.layer_poi).selected(settings.SELECTED_POI_FILTER_FOR_MAP.get() != null ? 1 : 0)
.iconColor(R.drawable.ic_action_info_dark).listen(l).reg();
adapter.item(R.string.layer_map).iconColor(R.drawable.ic_world_globe_dark)
.listen(l).reg();
adapter.item(R.string.layer_amenity_label).selected(settings.SHOW_POI_LABEL.get() ? 1 : 0)
.iconColor(R.drawable.ic_action_text_dark).listen(l).reg();
adapter.item(R.string.shared_string_favorites).selected(settings.SHOW_FAVORITES.get() ? 1 : 0)
@ -221,6 +228,7 @@ public class ConfigureMapMenu {
AccessibleToast.makeText(app, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();
}
adapter.setItemDescription(pos, getRenderDescr(activity));
activity.getDashboard().refreshContent(true);
dialog.dismiss();
}

View file

@ -38,11 +38,11 @@ public class BaseDownloadActivity extends ActionBarProgressActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
settings = ((OsmandApplication) getApplication()).getSettings();
if (downloadListIndexThread == null) {
downloadListIndexThread = new DownloadIndexesThread(this);
}
super.onCreate(savedInstanceState);
// Having the next line here causes bug AND-197: The storage folder dialogue popped up upon EVERY app startup, because the map list is not indexed yet.
// Hence line moved to updateDownloads() now.
// prepareDownloadDirectory();

View file

@ -99,9 +99,12 @@ public class DownloadActivity extends BaseDownloadActivity {
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_local), LocalIndexesFragment.class));
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_downloads), DownloadIndexFragment.class));
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_updates), UpdatesIndexFragment.class));
mTabs.add(new TabActivity.TabItem(R.string.download_tab_local,
getString(R.string.download_tab_local), LocalIndexesFragment.class));
mTabs.add(new TabActivity.TabItem(R.string.download_tab_downloads,
getString(R.string.download_tab_downloads), DownloadIndexFragment.class));
mTabs.add(new TabActivity.TabItem(R.string.download_tab_updates,
getString(R.string.download_tab_updates), UpdatesIndexFragment.class));
viewPager.setAdapter(new TabActivity.OsmandFragmentPagerAdapter(getSupportFragmentManager(), mTabs));
mSlidingTabLayout.setViewPager(viewPager);

View file

@ -84,8 +84,9 @@ public class DownloadOsmandIndexesHelper {
if (target.endsWith("-tts/_ttsconfig.p") && target.startsWith("voice/")) {
String voice = target.substring("voice/".length(), target.length() - "/_ttsconfig.p".length());
File destFile = new File(voicePath, voice + File.separatorChar + "_ttsconfig.p");
result.add(new AssetIndexItem(voice +ext, "voice", date, dateModified,
"0.1", 1024*100, key, destFile.getPath(), DownloadActivityType.VOICE_FILE));
result.add(new AssetIndexItem(voice + ext, "voice", date, dateModified, "0.1", destFile.length(), key,
destFile.getPath(), DownloadActivityType.VOICE_FILE));
}
}
result.sort();

View file

@ -103,7 +103,6 @@ public class UpdatesIndexFragment extends ListFragment {
private void createListView() {
updateHeader();
if (indexItems.size() == 0) {
indexItems.clear();
if (DownloadActivity.downloadListIndexThread.isDownloadedFromInternet()) {
indexItems.add(new IndexItem(getString(R.string.everything_up_to_date), "", 0, "", 0, 0, null));
} else {

View file

@ -3,12 +3,12 @@ package net.osmand.plus.helpers;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -416,22 +416,22 @@ public class SearchHistoryHelper {
"SELECT " + HISTORY_COL_NAME + ", " + HISTORY_COL_LAT + "," + HISTORY_COL_LON +", " +
HISTORY_COL_TIME + ", " + HISTORY_COL_FREQ_INTERVALS + ", " + HISTORY_COL_FREQ_VALUES +
" FROM " + HISTORY_TABLE_NAME , null); //$NON-NLS-1$//$NON-NLS-2$
Map<String, HistoryEntry> st = new TreeMap<String, HistoryEntry>();
Map<PointDescription, HistoryEntry> st = new HashMap<PointDescription, HistoryEntry>();
if (query.moveToFirst()) {
boolean reinsert = false;
do {
String name = query.getString(0);
PointDescription p = PointDescription.deserializeFromString(name, new LatLon(query.getDouble(1), query.getDouble(2)));
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2),
PointDescription.deserializeFromString(name));
p);
long time = query.getLong(3);
e.setLastAccessTime(time);
e.setFrequency(query.getString(4), query.getString(5));
if(st.containsKey(name) || st.containsKey(e.getSerializedName())
|| !Algorithms.objectEquals(name, e.getSerializedName())) {
if(st.containsKey(p)) {
reinsert = true;
}
entries.add(e);
st.put(e.getSerializedName(), e);
st.put(p, e);
} while (query.moveToNext());
if(reinsert) {
System.err.println("Reinsert all values");

View file

@ -238,7 +238,7 @@ public class WaypointDialogHelper {
private void selectPoi(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
final boolean enable, Activity ctx) {
if (ctx instanceof MapActivity &&
!PoiLegacyFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
!PoiLegacyFilter.CUSTOM_FILTER_ID.equals(app.getSettings().SELECTED_POI_FILTER_FOR_MAP.get())) {
MapActivity map = (MapActivity) ctx;
final PoiLegacyFilter[] selected = new PoiLegacyFilter[1];
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);

View file

@ -592,7 +592,7 @@ public class WaypointHelper {
///
public PoiLegacyFilter getPoiFilter() {
return app.getPoiFilters().getFilterById(app.getSettings().getPoiFilterForMap());
return app.getPoiFilters().getFilterById(app.getSettings().SELECTED_POI_FILTER_FOR_MAP.get());
}
public boolean showPOI() {
return app.getSettings().SHOW_NEARBY_POI.get();
@ -700,7 +700,7 @@ public class WaypointHelper {
return uiCtx.getResources().getDrawable(R.drawable.list_warnings_traffic_calming);
}
} else if(((AlarmInfo) point).getType().toString() == "TOLL_BOOTH") {
return uiCtx.getResources().getDrawable(R.drawable.mx_barrier_toll_booth);
return uiCtx.getResources().getDrawable(R.drawable.mx_toll_booth);
} else if(((AlarmInfo) point).getType().toString() == "STOP") {
return uiCtx.getResources().getDrawable(R.drawable.list_stop);
} else if(((AlarmInfo) point).getType().toString() == "PEDESTRIAN") {

View file

@ -15,7 +15,6 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.FavoritesTreeFragment;
import net.osmand.plus.activities.TabActivity;
import net.osmand.plus.myplaces.AvailableGPXFragment;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
import android.app.Activity;
@ -24,12 +23,10 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
/**
@ -39,12 +36,9 @@ public class FavoritesActivity extends TabActivity {
// private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
private static final String TRACKS = "TRACKS";
public static final int GPX_TAB = R.string.shared_string_my_tracks;
public static final int FAV_TAB = R.string.shared_string_my_favorites;
// private static final String SELECTED_TRACK = "SELECTED_TRACK";
public static int FAVORITES_TAB = 0;
public static int GPX_TAB = 1;
public static int SELECTED_GPX_TAB = 2;
public static int NOTES_TAB = 3;
public static int OSM_EDITS_TAB = 4;
public static String TAB_PARAM = "TAB_PARAM";
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
@ -79,25 +73,15 @@ public class FavoritesActivity extends TabActivity {
mTabs.add(getTabIndicator(R.string.shared_string_my_tracks, AvailableGPXFragment.class));
}
OsmandPlugin.addMyPlacesTabPlugins(this, mTabs, getIntent());
Integer tab = settings.FAVORITES_TAB.get();
if (tab == NOTES_TAB) {
if (OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class) != null){
tab = mTabs.size() - 2;
} else {
tab = mTabs.size() - 1;
Integer tabId = settings.FAVORITES_TAB.get();
int tab = 0;
for(int i = 0; i < mTabs.size(); i++) {
if(mTabs.get(i).resId == tabId) {
tab = i;
}
} else if (tab == OSM_EDITS_TAB) {
tab = mTabs.size() - 1;
}
setViewPagerAdapter(mViewPager, mTabs);
mSlidingTabLayout.setViewPager(mViewPager);
if (tab > mTabs.size() - 1){
tab = 0;
}
mViewPager.setCurrentItem(tab);
// setupHomeButton();
}

View file

@ -106,7 +106,7 @@ public class SelectedGPXFragment extends ListFragment {
super.onResume();
updateContent();
updateEnable = true;
if(getGpx().showCurrentTrack && filterType() == GpxDisplayItemType.TRACK_POINTS) {
if(getGpx() != null && getGpx().showCurrentTrack && filterType() == GpxDisplayItemType.TRACK_POINTS) {
startHandler();
}
}
@ -121,8 +121,8 @@ public class SelectedGPXFragment extends ListFragment {
protected List<GpxDisplayGroup> filterGroups(GpxDisplayItemType type) {
List<GpxDisplayGroup> result = ((TrackActivity)getActivity()).getResult();
List<GpxDisplayGroup> groups = new ArrayList<GpxSelectionHelper.GpxDisplayGroup>();
List<GpxDisplayGroup> result = ((TrackActivity) getActivity()).getResult();
List<GpxDisplayGroup> groups = new ArrayList<GpxSelectionHelper.GpxDisplayGroup>();
for (GpxDisplayGroup group : result) {
boolean add = group.getType() == type || type == null;
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
@ -238,7 +238,7 @@ public class SelectedGPXFragment extends ListFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
((TrackActivity) getActivity()).getClearToolbar(false);
if (getGpx().path != null && !getGpx().showCurrentTrack) {
if (getGpx() != null && getGpx().path != null && !getGpx().showCurrentTrack) {
MenuItem item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark)
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override

View file

@ -1,5 +1,16 @@
package net.osmand.plus.osmedit;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import net.osmand.access.AccessibleToast;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
@ -12,18 +23,6 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.access.AccessibleToast;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.myplaces.FavoritesActivity;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Denis
@ -46,7 +45,7 @@ public class DashOsmEditsFragment extends DashBaseFragment implements OsmEditsUp
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startFavoritesActivity(FavoritesActivity.OSM_EDITS_TAB);
startFavoritesActivity(R.string.osm_edits);
}
});
@ -135,17 +134,14 @@ public class DashOsmEditsFragment extends DashBaseFragment implements OsmEditsUp
getString(R.string.uploading), getString(R.string.local_openstreetmap_uploading),
ProgressDialog.STYLE_HORIZONTAL).getDialog();
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog,
DashOsmEditsFragment.this, remotepoi, remotebug, toUpload.length);
DashOsmEditsFragment.this, plugin, remotepoi, remotebug, toUpload.length);
uploadTask.execute(toUpload);
dialog.show();
}
private void getOsmPoints(ArrayList<OsmPoint> dataPoints) {
OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(getActivity());
OsmBugsDbHelper dbbug = new OsmBugsDbHelper(getActivity());
List<OpenstreetmapPoint> l1 = dbpoi.getOpenstreetmapPoints();
List<OsmNotesPoint> l2 = dbbug.getOsmbugsPoints();
List<OpenstreetmapPoint> l1 = plugin.getDBPOI().getOpenstreetmapPoints();
List<OsmNotesPoint> l2 = plugin.getDBBug().getOsmbugsPoints();
if (l1.isEmpty()){
int i = 0;
for(OsmPoint point : l2){

View file

@ -108,14 +108,14 @@ public class EditingPOIDialogProvider implements DialogProvider {
private void prepareProvider() {
poiTypes = ((OsmandApplication) activity.getApplication()).getPoiTypes();
allTranslatedSubTypes = poiTypes.getAllTranslatedNames();
allTranslatedSubTypes = poiTypes.getAllTranslatedNames(false);
settings = ((OsmandApplication) activity.getApplication()).getSettings();
isLocalEdit = true;
if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
this.openstreetmapUtil = new OpenstreetmapLocalUtil(activity);
this.openstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
this.openstreetmapUtilToLoad = openstreetmapUtil;
} else if(!settings.isInternetConnectionAvailable(true)) {
this.openstreetmapUtil = new OpenstreetmapLocalUtil(activity);
this.openstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
this.openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(activity);
} else {
isLocalEdit = false;
@ -610,7 +610,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
private Map<String, PoiType> getSubCategoriesMap(PoiCategory poiCategory) {
Map<String, PoiType> subCategories = new LinkedHashMap<>(poiTypes.getAllTranslatedNames(poiCategory, false));
for (Map.Entry<String, PoiType> s : poiTypes.getAllTranslatedNames().entrySet()) {
for (Map.Entry<String, PoiType> s : allTranslatedSubTypes.entrySet()) {
if (!subCategories.containsKey(s.getKey())) {
subCategories.put(s.getKey(), s.getValue());
}
@ -692,7 +692,6 @@ public class EditingPOIDialogProvider implements DialogProvider {
@Override
protected void onPostExecute(Node result) {
progress.dismiss();
plugin.collectLocalOsmEdits();
if (result != null) {
successAction.run();
}

View file

@ -15,13 +15,14 @@ import android.content.Context;
public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
private final Context ctx;
private final OpenstreetmapsDbHelper db;
public final static Log log = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
public OpenstreetmapLocalUtil(Context uiContext) {
private OsmEditingPlugin plugin;
public OpenstreetmapLocalUtil(OsmEditingPlugin plugin, Context uiContext) {
this.plugin = plugin;
this.ctx = uiContext;
this.db = new OpenstreetmapsDbHelper(ctx);
}
@Override
@ -33,16 +34,16 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
public Node commitNodeImpl(OsmPoint.Action action, Node n, EntityInfo info, String comment, boolean closeChangeSet){
Node newNode = n;
if (n.getId() == -1) {
newNode = new Node(n, Math.min(-2, db.getMinID() - 1)); // generate local id for the created node
newNode = new Node(n, Math.min(-2, plugin.getDBPOI().getMinID() - 1)); // generate local id for the created node
}
OpenstreetmapPoint p = new OpenstreetmapPoint();
p.setEntity(newNode);
p.setAction(action);
p.setComment(comment);
if (p.getAction() == OsmPoint.Action.DELETE && newNode.getId() < 0) { //if it is our local poi
db.deletePOI(p);
plugin.getDBPOI().deletePOI(p);
} else {
db.addOpenstreetmap(p);
plugin.getDBPOI().addOpenstreetmap(p);
}
return newNode;
}

View file

@ -12,7 +12,6 @@ import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.LinkedHashMap;
import java.util.Map;
@ -40,7 +39,6 @@ import org.xmlpull.v1.XmlSerializer;
import android.content.Context;
import android.util.Xml;
import android.view.View;
import android.widget.Toast;
public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {

View file

@ -27,7 +27,7 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
OPENSTREETMAP_COL_LAT + " double," + OPENSTREETMAP_COL_LON + " double," +
OPENSTREETMAP_COL_TAGS + " VARCHAR(2048)," +
OPENSTREETMAP_COL_ACTION + " TEXT, " + OPENSTREETMAP_COL_COMMENT + " TEXT);"; //$NON-NLS-1$ //$NON-NLS-2$
List<OpenstreetmapPoint> cache = null;
public OpenstreetmapsDbHelper(Context context) {
super(context, OPENSTREETMAP_DB_NAME, null, DATABASE_VERSION);
@ -47,11 +47,13 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
}
public List<OpenstreetmapPoint> getOpenstreetmapPoints() {
return checkOpenstreetmapPoints();
if(cache == null ) {
return checkOpenstreetmapPoints();
}
return cache;
}
public boolean addOpenstreetmap(OpenstreetmapPoint p) {
checkOpenstreetmapPoints();
SQLiteDatabase db = getWritableDatabase();
if (db != null) {
StringBuilder tags = new StringBuilder();
@ -67,6 +69,8 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
" (" + OPENSTREETMAP_COL_ID + ", " + OPENSTREETMAP_COL_LAT + ", " + OPENSTREETMAP_COL_LON + ", " + OPENSTREETMAP_COL_TAGS + ", " + OPENSTREETMAP_COL_ACTION + "," + OPENSTREETMAP_COL_COMMENT + ")" +
" VALUES (?, ?, ?, ?, ?, ?)",
new Object[] { p.getId(),p.getLatitude(), p.getLongitude(), tags.toString() , OsmPoint.stringAction.get(p.getAction()), p.getComment(), }); //$NON-NLS-1$ //$NON-NLS-2$
db.close();
checkOpenstreetmapPoints();
return true;
}
return false;
@ -75,11 +79,12 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
public boolean deletePOI(OpenstreetmapPoint p) {
checkOpenstreetmapPoints();
SQLiteDatabase db = getWritableDatabase();
if (db != null) {
db.execSQL("DELETE FROM " + OPENSTREETMAP_TABLE_NAME +
" WHERE " + OPENSTREETMAP_COL_ID + " = ?", new Object[] { p.getId() }); //$NON-NLS-1$ //$NON-NLS-2$
db.close();
checkOpenstreetmapPoints();
return true;
}
return false;
@ -87,8 +92,8 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
private List<OpenstreetmapPoint> checkOpenstreetmapPoints(){
SQLiteDatabase db = getWritableDatabase();
List<OpenstreetmapPoint> cachedOpenstreetmapPoints = new ArrayList<OpenstreetmapPoint>();
SQLiteDatabase db = getReadableDatabase();
List<OpenstreetmapPoint> points = new ArrayList<OpenstreetmapPoint>();
if (db != null) {
Cursor query = db.rawQuery("SELECT " + OPENSTREETMAP_COL_ID + ", " + OPENSTREETMAP_COL_LAT + "," + OPENSTREETMAP_COL_LON + "," + OPENSTREETMAP_COL_ACTION + "," + OPENSTREETMAP_COL_COMMENT + "," + OPENSTREETMAP_COL_TAGS+ " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
OPENSTREETMAP_TABLE_NAME, null);
@ -106,12 +111,13 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
p.setEntity(entity);
p.setAction(query.getString(3));
p.setComment(query.getString(4));
cachedOpenstreetmapPoints.add(p);
points.add(p);
} while (query.moveToNext());
}
query.close();
}
return cachedOpenstreetmapPoints;
cache = points;
return points;
}
public long getMinID() {

View file

@ -23,7 +23,7 @@ public class OsmBugsDbHelper extends SQLiteOpenHelper {
OSMBUGS_COL_ID + " INTEGER, " + OSMBUGS_COL_TEXT + " TEXT, " + //$NON-NLS-1$ //$NON-NLS-2$
OSMBUGS_COL_LAT + " double, " + OSMBUGS_COL_LON + " double, " + //$NON-NLS-1$ //$NON-NLS-2$
OSMBUGS_COL_ACTION + " TEXT, " + OSMBUGS_COL_AUTHOR + " TEXT);"; //$NON-NLS-1$ //$NON-NLS-2$
List<OsmNotesPoint> cache = null;
public OsmBugsDbHelper(Context context) {
super(context, OSMBUGS_DB_NAME, null, DATABASE_VERSION);
}
@ -38,11 +38,13 @@ public class OsmBugsDbHelper extends SQLiteOpenHelper {
}
public List<OsmNotesPoint> getOsmbugsPoints() {
return checkOsmbugsPoints();
if (cache == null) {
return checkOsmbugsPoints();
}
return cache;
}
public boolean addOsmbugs(OsmNotesPoint p) {
checkOsmbugsPoints();
SQLiteDatabase db = getWritableDatabase();
if (db != null) {
db.execSQL(
@ -50,24 +52,27 @@ public class OsmBugsDbHelper extends SQLiteOpenHelper {
+ OSMBUGS_COL_LON + "," + OSMBUGS_COL_ACTION + "," + OSMBUGS_COL_AUTHOR + ")" + " VALUES (?, ?, ?, ?, ?, ?)",
new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(),
OsmPoint.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$
db.close();
checkOsmbugsPoints();
return true;
}
return false;
}
public boolean deleteAllBugModifications(OsmNotesPoint p) {
checkOsmbugsPoints();
SQLiteDatabase db = getWritableDatabase();
if (db != null) {
db.execSQL("DELETE FROM " + OSMBUGS_TABLE_NAME +
" WHERE " + OSMBUGS_COL_ID + " = ?", new Object[] { p.getId() }); //$NON-NLS-1$ //$NON-NLS-2$
db.close();
checkOsmbugsPoints();
return true;
}
return false;
}
private List<OsmNotesPoint> checkOsmbugsPoints(){
SQLiteDatabase db = getWritableDatabase();
SQLiteDatabase db = getReadableDatabase();
List<OsmNotesPoint> cachedOsmbugsPoints = new ArrayList<OsmNotesPoint>();
if (db != null) {
Cursor query = db.rawQuery("SELECT " + OSMBUGS_COL_ID + ", " + OSMBUGS_COL_TEXT + ", " + OSMBUGS_COL_LAT + "," + OSMBUGS_COL_LON + "," + OSMBUGS_COL_ACTION + "," + OSMBUGS_COL_AUTHOR + " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@ -88,6 +93,7 @@ public class OsmBugsDbHelper extends SQLiteOpenHelper {
}
query.close();
}
cache = cachedOsmbugsPoints;
return cachedOsmbugsPoints;
}

View file

@ -1,20 +1,14 @@
package net.osmand.plus.osmedit;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Xml;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleToast;
@ -39,13 +33,20 @@ import org.apache.commons.logging.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Xml;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Toast;
public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider, DialogProvider {
@ -220,9 +221,6 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
if(data != null) {
data.clearCache();
}
if (plugin != null){
plugin.collectLocalOsmEdits();
}
}
private static String readText(XmlPullParser parser, String key) throws XmlPullParserException, IOException {

View file

@ -1,23 +1,9 @@
package net.osmand.plus.osmedit;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import java.util.List;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
import net.osmand.data.DataTileManager;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.OsmandApplication;
@ -33,21 +19,48 @@ import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
public class OsmEditingPlugin extends OsmandPlugin {
private static final String ID = "osm.editing";
private OsmandSettings settings;
private OsmandApplication app;
DataTileManager<OsmPoint> localOsmEditsInternal = null;
OpenstreetmapsDbHelper dbpoi ;
OsmBugsDbHelper dbbug ;
@Override
public String getId() {
return ID;
}
public OpenstreetmapsDbHelper getDBPOI() {
if(dbpoi == null) {
dbpoi = new OpenstreetmapsDbHelper(app);
}
return dbpoi;
}
public OsmBugsDbHelper getDBBug() {
if(dbbug == null) {
dbbug = new OsmBugsDbHelper(app);
}
return dbbug;
}
public OsmEditingPlugin(OsmandApplication app) {
this.app = app;
}
@ -150,12 +163,10 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) {
OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(favoritesActivity);
OsmBugsDbHelper dbbug = new OsmBugsDbHelper(favoritesActivity);
if (dbpoi.getOpenstreetmapPoints().size() > 0 || dbbug.getOsmbugsPoints().size() > 0){
if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0){
mTabs.add(favoritesActivity.getTabIndicator(R.string.osm_edits, OsmEditsFragment.class));
if (intent != null && "OSM".equals(intent.getStringExtra("TAB"))) {
app.getSettings().FAVORITES_TAB.set(FavoritesActivity.OSM_EDITS_TAB);
app.getSettings().FAVORITES_TAB.set(R.string.osm_edits);
}
}
}
@ -223,11 +234,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
}
public void onLocalItemDeleted(OsmPoint point) {
if(localOsmEditsInternal != null) {
localOsmEditsInternal.unregisterObject(point.getLatitude(), point.getLongitude(), point);
}
}
public enum UploadVisibility implements IEnumWithResource {
Public(R.string.gpxup_public),
@ -285,40 +292,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
return true;
}
public void onLocalOsmEditAdded(OsmPoint point){
if(localOsmEditsInternal != null) {
localOsmEditsInternal.registerObject(point.getLatitude(), point.getLongitude(), point);
}
}
public void collectLocalOsmEdits() {
DataTileManager<OsmPoint> res = new DataTileManager<OsmPoint>();
OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(app);
OsmBugsDbHelper dbbug = new OsmBugsDbHelper(app);
List<OpenstreetmapPoint> l1 = dbpoi.getOpenstreetmapPoints();
List<OsmNotesPoint> l2 = dbbug.getOsmbugsPoints();
for (OsmPoint point : l1) {
res.registerObject(point.getLatitude(), point.getLongitude(), point);
}
for (OsmPoint point : l2) {
res.registerObject(point.getLatitude(), point.getLongitude(), point);
}
localOsmEditsInternal = res;
}
public DataTileManager<OsmPoint> getLocalOsmEdits(){
if(localOsmEditsInternal == null) {
collectLocalOsmEdits();
}
return localOsmEditsInternal;
}
public List<OsmPoint> getAllEdits(){
return getLocalOsmEdits().getAllObjects();
}
@Override
public String getName() {
return app.getString(R.string.osm_settings);

View file

@ -61,9 +61,6 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
private boolean selectionMode = false;
private OpenstreetmapsDbHelper dbpoi;
private OsmBugsDbHelper dbbug;
private OpenstreetmapRemoteUtil remotepoi;
private OsmBugsRemoteUtil remotebug;
@ -82,8 +79,6 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
plugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
((TextView) view.findViewById(R.id.header)).setText(R.string.your_edits);
dbpoi = new OpenstreetmapsDbHelper(getActivity());
dbbug = new OsmBugsDbHelper(getActivity());
remotepoi = new OpenstreetmapRemoteUtil(getActivity());
remotebug = new OsmBugsRemoteUtil(getMyApplication());
@ -307,13 +302,12 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
while (it.hasNext()) {
OsmPoint omsPoint = it.next();
if (omsPoint.getGroup() == OsmPoint.Group.POI) {
dbpoi.deletePOI((OpenstreetmapPoint) omsPoint);
plugin.getDBPOI().deletePOI((OpenstreetmapPoint) omsPoint);
} else if (omsPoint.getGroup() == OsmPoint.Group.BUG) {
dbbug.deleteAllBugModifications((OsmNotesPoint) omsPoint);
plugin.getDBBug().deleteAllBugModifications((OsmNotesPoint) omsPoint);
}
it.remove();
listAdapter.delete(omsPoint);
plugin.onLocalItemDeleted(omsPoint);
}
listAdapter.notifyDataSetChanged();
@ -327,8 +321,8 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
public void onResume() {
super.onResume();
dataPoints = new ArrayList<>();
List<OpenstreetmapPoint> l1 = dbpoi.getOpenstreetmapPoints();
List<OsmNotesPoint> l2 = dbbug.getOsmbugsPoints();
List<OpenstreetmapPoint> l1 = plugin.getDBPOI().getOpenstreetmapPoints();
List<OsmNotesPoint> l2 = plugin.getDBBug().getOsmbugsPoints();
dataPoints.addAll(l1);
dataPoints.addAll(l2);
listAdapter = new OsmEditsAdapter(dataPoints);
@ -507,7 +501,7 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
getString(R.string.uploading),
getString(R.string.local_openstreetmap_uploading),
ProgressDialog.STYLE_HORIZONTAL).getDialog();
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, this, remotepoi,
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, this, plugin, remotepoi,
remotebug, toUpload.length);
uploadTask.execute(toUpload);
@ -621,7 +615,6 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
@Override
public void uploadUpdated(OsmPoint point) {
plugin.onLocalItemDeleted(point);
listAdapter.delete(point);
}

View file

@ -1,24 +1,23 @@
package net.osmand.plus.osmedit;
import java.util.List;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PointF;
import net.osmand.data.DataTileManager;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import java.util.List;
import android.widget.ArrayAdapter;
/**
* Created by Denis on
@ -71,25 +70,26 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
@Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
if (tileBox.getZoom() >= startZoom) {
DataTileManager<OsmPoint> points = plugin.getLocalOsmEdits();
final QuadRect latlon = tileBox.getLatLonBounds();
List<OsmPoint> objects = points.getObjects(latlon. top, latlon.left, latlon.bottom, latlon.right);
for (OsmPoint o : objects) {
int locationX = tileBox.getPixXFromLonNoRot(o.getLongitude());
int locationY = tileBox.getPixYFromLatNoRot(o.getLatitude());
canvas.rotate(-view.getRotate(), locationX, locationY);
Bitmap b;
if (o.getGroup() == OsmPoint.Group.POI) {
b = poi;
} else if (o.getGroup() == OsmPoint.Group.BUG) {
b = bug;
} else {
b = poi;
}
canvas.drawBitmap(b, locationX - b.getWidth() / 2, locationY - b.getHeight(), paintIcon);
canvas.rotate(view.getRotate(), locationX, locationY);
drawPoints(canvas, tileBox, plugin.getDBBug().getOsmbugsPoints());
drawPoints(canvas, tileBox, plugin.getDBPOI().getOpenstreetmapPoints());
}
}
private void drawPoints(Canvas canvas, RotatedTileBox tileBox, List<? extends OsmPoint> objects) {
for (OsmPoint o : objects) {
int locationX = tileBox.getPixXFromLonNoRot(o.getLongitude());
int locationY = tileBox.getPixYFromLatNoRot(o.getLatitude());
canvas.rotate(-view.getRotate(), locationX, locationY);
Bitmap b;
if (o.getGroup() == OsmPoint.Group.POI) {
b = poi;
} else if (o.getGroup() == OsmPoint.Group.BUG) {
b = bug;
} else {
b = poi;
}
canvas.drawBitmap(b, locationX - b.getWidth() / 2, locationY - b.getHeight(), paintIcon);
canvas.rotate(view.getRotate(), locationX, locationY);
}
}
@ -109,7 +109,13 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
int ey = (int) point.y;
int compare = getRadiusPoi(tileBox);
int radius = compare * 3 / 2;
for (OsmPoint n : plugin.getAllEdits()) {
compare = getFromPoint(tileBox, am, ex, ey, compare, radius, plugin.getDBBug().getOsmbugsPoints());
compare = getFromPoint(tileBox, am, ex, ey, compare, radius, plugin.getDBPOI().getOpenstreetmapPoints());
}
private int getFromPoint(RotatedTileBox tileBox, List<? super OsmPoint> am, int ex, int ey, int compare,
int radius, List<? extends OsmPoint> pnts) {
for (OsmPoint n : pnts) {
int x = (int) tileBox.getPixXFromLatLon(n.getLatitude(), n.getLongitude());
int y = (int) tileBox.getPixYFromLatLon(n.getLatitude(), n.getLongitude());
if (calculateBelongs(ex, ey, x, y, compare)) {
@ -117,6 +123,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
am.add(n);
}
}
return compare;
}
private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) {
@ -145,6 +152,28 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
}
return null;
}
@Override
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
if (o instanceof OsmPoint) {
final OsmPoint r = (OsmPoint) o;
adapter.item(R.string.osm_edit_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark
).listen(new ContextMenuAdapter.OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
if(r instanceof OsmNotesPoint) {
plugin.getDBBug().deleteAllBugModifications((OsmNotesPoint) r);
} else if(r instanceof OpenstreetmapPoint) {
plugin.getDBPOI().deletePOI((OpenstreetmapPoint) r);
}
view.refreshMap();
return true;
}
}).reg();
}
}
@Override
public String getObjectDescription(Object o) {

View file

@ -46,7 +46,7 @@ public class SettingsOsmEditingActivity extends SettingsBaseActivity {
final Intent favorites = new Intent(SettingsOsmEditingActivity.this,
appCustomization.getFavoritesActivity());
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.OSM_EDITS_TAB);
getMyApplication().getSettings().FAVORITES_TAB.set(R.string.osm_edits);
startActivity(favorites);
return true;
}

View file

@ -20,8 +20,6 @@ public class UploadOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPo
private OsmBugsRemoteUtil remotebug;
private OpenstreetmapsDbHelper dbpoi;
private OsmBugsDbHelper dbbug;
private int listSize = 0;
@ -29,15 +27,18 @@ public class UploadOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPo
private Fragment ctx;
public UploadOpenstreetmapPointAsyncTask(ProgressDialog progress,Fragment ctx, OpenstreetmapRemoteUtil remotepoi, OsmBugsRemoteUtil remotebug,
private OsmEditingPlugin plugin;
public UploadOpenstreetmapPointAsyncTask(ProgressDialog progress,Fragment ctx,
OsmEditingPlugin plugin,
OpenstreetmapRemoteUtil remotepoi, OsmBugsRemoteUtil remotebug,
int listSize) {
this.progress = progress;
this.plugin = plugin;
this.remotepoi = remotepoi;
this.remotebug = remotebug;
this.listSize = listSize;
this.ctx = ctx;
dbpoi = new OpenstreetmapsDbHelper(ctx.getActivity());
dbbug = new OsmBugsDbHelper(ctx.getActivity());
}
@Override
@ -56,7 +57,8 @@ public class UploadOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPo
}
Node n = remotepoi.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo, p.getComment(), false);
if (n != null) {
dbpoi.deletePOI(p);
plugin.getDBPOI().deletePOI(p);
publishProgress(p);
uploaded++;
}
@ -71,7 +73,7 @@ public class UploadOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPo
success = remotebug.closingBug(p.getId(), p.getText(), p.getAuthor()) == null;
}
if (success) {
dbbug.deleteAllBugModifications(p);
plugin.getDBBug().deleteAllBugModifications(p);
uploaded++;
publishProgress(p);
}

View file

@ -3,6 +3,7 @@ package net.osmand.plus.osmo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import net.osmand.Location;
@ -201,13 +202,16 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
}
//remove all inactive devices
for (OsMoGroupsStorage.OsMoDevice device : devices) {
if (!device.isActive() && !device.isEnabled() && devices.size() > 2) {
devices.remove(device);
}
Iterator<OsMoDevice> it = devices.iterator();
while (it.hasNext()) {
if (devices.size() < 4) {
break;
}
OsMoGroupsStorage.OsMoDevice device = it.next();
if (!device.isActive() && !device.isEnabled() && devices.size() > 2) {
it.remove();
}
}
sortDevices(devices);

View file

@ -126,8 +126,10 @@ public class PoiFiltersHelper {
AbstractPoiType tp = application.getPoiTypes().getAnyPoiTypeByKey(typeId);
if(tp != null) {
PoiLegacyFilter lf = new PoiLegacyFilter(tp, application);
cacheTopStandardFilters.add(lf);
sortListOfFilters(cacheTopStandardFilters);
ArrayList<PoiLegacyFilter> copy = new ArrayList<PoiLegacyFilter>(cacheTopStandardFilters);
copy.add(lf);
sortListOfFilters(copy);
cacheTopStandardFilters = copy;
return lf;
}
}
@ -136,9 +138,9 @@ public class PoiFiltersHelper {
public void reloadAllPoiFilters() {
cacheTopStandardFilters = null;
showAllPOIFilter = null;
getShowAllPOIFilter();
cacheTopStandardFilters = null;
getTopDefinedPoiFilters();
}
@ -168,15 +170,16 @@ public class PoiFiltersHelper {
public List<PoiLegacyFilter> getTopDefinedPoiFilters() {
if (cacheTopStandardFilters == null) {
cacheTopStandardFilters = new ArrayList<PoiLegacyFilter>();
List<PoiLegacyFilter> top = new ArrayList<PoiLegacyFilter>();
// user defined
cacheTopStandardFilters.addAll(getUserDefinedPoiFilters());
top.addAll(getUserDefinedPoiFilters());
// default
MapPoiTypes poiTypes = application.getPoiTypes();
for (PoiFilter t : poiTypes.getTopVisibleFilters()) {
cacheTopStandardFilters.add(new PoiLegacyFilter(t, application));
top.add(new PoiLegacyFilter(t, application));
}
sortListOfFilters(cacheTopStandardFilters);
sortListOfFilters(top);
cacheTopStandardFilters = top;
}
List<PoiLegacyFilter> result = new ArrayList<PoiLegacyFilter>();
if(OsmandPlugin.getEnabledPlugin(AccessibilityPlugin.class) != null) {
@ -205,7 +208,9 @@ public class PoiFiltersHelper {
}
boolean res = helper.deleteFilter(helper.getWritableDatabase(), filter);
if(res){
cacheTopStandardFilters.remove(filter);
ArrayList<PoiLegacyFilter> copy = new ArrayList<>(cacheTopStandardFilters);
copy.remove(filter);
cacheTopStandardFilters = copy;
}
helper.close();
return res;
@ -225,8 +230,10 @@ public class PoiFiltersHelper {
}
res = helper.addFilter(filter, helper.getWritableDatabase(), false);
if(res){
cacheTopStandardFilters.add(filter);
sortListOfFilters(cacheTopStandardFilters);
ArrayList<PoiLegacyFilter> copy = new ArrayList<>(cacheTopStandardFilters);
copy.add(filter);
sortListOfFilters(copy);
cacheTopStandardFilters = copy;
}
helper.close();
return res;

View file

@ -41,7 +41,7 @@ import android.widget.Spinner;
import android.widget.Toast;
public class OsmandRasterMapsPlugin extends OsmandPlugin {
private static final String ID = "osmand.rastermaps";
public static final String ID = "osmand.rastermaps";
private OsmandSettings settings;
private OsmandApplication app;
@ -214,11 +214,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
return true;
}
};
adapter.item(R.string.layer_map).iconColor(R.drawable.ic_world_globe_dark)
.listen(listener).position(3).reg();
adapter.item(R.string.layer_overlay).selected(overlayLayer.getMap() != null ? 1 : 0).
adapter.item(R.string.layer_overlay).selected(overlayLayer != null && overlayLayer.getMap() != null ? 1 : 0).
iconColor(R.drawable.ic_layer_top_dark).listen(listener).position(14).reg();
adapter.item(R.string.layer_underlay).selected(underlayLayer.getMap() != null ? 1 : 0)
adapter.item(R.string.layer_underlay).selected(underlayLayer != null && underlayLayer.getMap() != null ? 1 : 0)
.iconColor(R.drawable.ic_layer_bottom_dark).listen(listener).position(15).reg();
}

View file

@ -37,22 +37,9 @@ public class SettingsRasterMapsActivity extends SettingsBaseActivity {
PreferenceCategory cat = new PreferenceCategory(this);
cat.setTitle(R.string.pref_raster_map);
grp.addPreference(cat);
CheckBoxPreference mapVectorData = createCheckBoxPreference(settings.MAP_ONLINE_DATA,
R.string.map_online_data, R.string.map_online_data_descr);
// final OnPreferenceChangeListener parent = mapVectorData.getOnPreferenceChangeListener();
// MapRenderRepositories r = app.getResourceManager().getRenderer();
// if(r.isEmpty()){
// AccessibleToast.makeText(this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
// return false;
// }
cat.addPreference(mapVectorData);
tileSourcePreference = new ListPreference(this);
tileSourcePreference.setSummary(R.string.map_tile_source_descr);
tileSourcePreference.setTitle(R.string.map_tile_source);
tileSourcePreference.setOnPreferenceChangeListener(listener);
cat.addPreference(tileSourcePreference);
// present on configure map
// addTileSourcePrefs(listener, cat);
cat.addPreference(createCheckBoxPreference(settings.USE_INTERNET_TO_DOWNLOAD_TILES,
R.string.use_internet, R.string.use_internet_to_download_tile));
@ -68,19 +55,16 @@ public class SettingsRasterMapsActivity extends SettingsBaseActivity {
ListPreference lp = createListPreference(settings.LEVEL_TO_SWITCH_VECTOR_RASTER,
entries, intValues, R.string.level_to_switch_vector_raster, R.string.level_to_switch_vector_raster_descr);
cat.addPreference(lp);
// present on configure map
// addOverlayPrefs(grp, listener);
// try without, Issue 823:
// int startZoom = 12;
// int endZoom = 19;
// entries = new String[endZoom - startZoom + 1];
// Integer[] intValues = new Integer[endZoom - startZoom + 1];
// for (int i = startZoom; i <= endZoom; i++) {
// entries[i - startZoom] = i + ""; //$NON-NLS-1$
// intValues[i - startZoom] = i ;
// }
// registerListPreference(osmandosmandSettings.MAX_LEVEL_TO_DOWNLOAD_TILE, screen, entries, intValues);
}
@SuppressWarnings("unused")
private void addOverlayPrefs(PreferenceScreen grp, OnPreferenceChangeListener listener) {
PreferenceCategory cat;
cat = new PreferenceCategory(this);
cat.setTitle(R.string.pref_overlay);
grp.addPreference(cat);
@ -102,8 +86,21 @@ public class SettingsRasterMapsActivity extends SettingsBaseActivity {
sp = createSeekBarPreference(settings.MAP_TRANSPARENCY, R.string.map_transparency, R.string.map_transparency_descr,
R.string.modify_transparency, 0, 255);
cat.addPreference(sp);
}
@SuppressWarnings("unused")
private void addTileSourcePrefs(OnPreferenceChangeListener listener, PreferenceCategory cat) {
CheckBoxPreference mapVectorData = createCheckBoxPreference(settings.MAP_ONLINE_DATA,
R.string.map_online_data, R.string.map_online_data_descr);
cat.addPreference(mapVectorData);
}
tileSourcePreference = new ListPreference(this);
tileSourcePreference.setSummary(R.string.map_tile_source_descr);
tileSourcePreference.setTitle(R.string.map_tile_source);
tileSourcePreference.setOnPreferenceChangeListener(listener);
cat.addPreference(tileSourcePreference);
}
public void updateAllSettings() {

View file

@ -258,20 +258,7 @@ public class MapRenderRepositories {
long now = System.currentTimeMillis();
// check that everything is initialized
for (String mapName : files.keySet()) {
BinaryMapIndexReader fr = files.get(mapName);
if (fr != null && fr.containsMapData(leftX, topY, rightX, bottomY, zoom)) {
if (!nativeFiles.contains(mapName)) {
long time = System.currentTimeMillis();
nativeFiles.add(mapName);
if (!library.initMapFile(mapName)) {
continue;
}
log.debug("Native resource " + mapName + " initialized " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
checkInitialized(zoom, library, leftX, rightX, bottomY, topY);
NativeSearchResult resultHandler = library.searchObjectsForRendering(leftX, rightX, topY, bottomY, zoom, renderingReq,
checkForDuplicateObjectIds, this, "");
if (checkWhetherInterrupted()) {
@ -289,6 +276,27 @@ public class MapRenderRepositories {
log.info(String.format("Native search: %s ms ", System.currentTimeMillis() - now)); //$NON-NLS-1$
return true;
}
public void checkInitialized(final int zoom, NativeOsmandLibrary library, int leftX, int rightX, int bottomY,
int topY) {
if(library == null) {
return;
}
for (String mapName : files.keySet()) {
BinaryMapIndexReader fr = files.get(mapName);
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
fr.containsRouteData(leftX, topY, rightX, bottomY, zoom))) {
if (!nativeFiles.contains(mapName)) {
long time = System.currentTimeMillis();
nativeFiles.add(mapName);
if (!library.initMapFile(mapName)) {
continue;
}
log.debug("Native resource " + mapName + " initialized " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
}
private void readRouteDataAsMapObjects(SearchRequest<BinaryMapDataObject> sr, BinaryMapIndexReader c,
final ArrayList<BinaryMapDataObject> tempResult, final TLongSet ids) {

View file

@ -656,6 +656,27 @@ public class RouteProvider {
}
// BUILD context
NativeOsmandLibrary lib = settings.SAFE_MODE.get() ? null : NativeOsmandLibrary.getLoadedLibrary();
// check loaded files
int leftX = MapUtils.get31TileNumberX(params.start.getLongitude());
int rightX = leftX;
int bottomY = MapUtils.get31TileNumberY(params.start.getLatitude());
int topY = bottomY;
if (params.intermediates != null) {
for (LatLon l : params.intermediates) {
leftX = Math.min(MapUtils.get31TileNumberX(l.getLongitude()), leftX);
rightX = Math.max(MapUtils.get31TileNumberX(l.getLongitude()), rightX);
bottomY = Math.max(MapUtils.get31TileNumberY(l.getLatitude()), bottomY);
topY = Math.min(MapUtils.get31TileNumberY(l.getLatitude()), topY);
}
}
LatLon l = params.end;
leftX = Math.min(MapUtils.get31TileNumberX(l.getLongitude()), leftX);
rightX = Math.max(MapUtils.get31TileNumberX(l.getLongitude()), rightX);
bottomY = Math.max(MapUtils.get31TileNumberY(l.getLatitude()), bottomY);
topY = Math.min(MapUtils.get31TileNumberY(l.getLatitude()), topY);
params.ctx.getResourceManager().getRenderer().checkInitialized(15, lib, leftX, rightX, bottomY, topY);
RoutingContext ctx = router.buildRoutingContext(cf,
lib, files,
RouteCalculationMode.NORMAL);
@ -666,7 +687,11 @@ public class RouteProvider {
ctx.leftSideNavigation = params.leftSide;
ctx.calculationProgress = params.calculationProgress;
if(params.previousToRecalculate != null && params.onlyStartPointChanged) {
ctx.previouslyCalculatedRoute = params.previousToRecalculate.getOriginalRoute();
int currentRoute = params.previousToRecalculate.getCurrentRoute();
List<RouteSegmentResult> originalRoute = params.previousToRecalculate.getOriginalRoute();
if(originalRoute != null && currentRoute < originalRoute.size()) {
ctx.previouslyCalculatedRoute = originalRoute.subList(currentRoute, originalRoute.size());
}
}
if(complex && router.getRecalculationEnd(ctx) != null) {
complex = false;
@ -676,9 +701,7 @@ public class RouteProvider {
RouteCalculationMode.COMPLEX);
complexCtx.calculationProgress = params.calculationProgress;
complexCtx.leftSideNavigation = params.leftSide;
if(params.previousToRecalculate != null && params.onlyStartPointChanged) {
complexCtx.previouslyCalculatedRoute = params.previousToRecalculate.getOriginalRoute();
}
complexCtx.previouslyCalculatedRoute = ctx.previouslyCalculatedRoute;
}
LatLon st = new LatLon(params.start.getLatitude(), params.start.getLongitude());

View file

@ -531,14 +531,14 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
R.string.menu_mute_on, R.string.menu_mute_off,
R.string.where_am_i, R.string.context_menu_item_share_location);
//poi
if (osmandSettings.SHOW_POI_OVER_MAP.get()) {
if (osmandSettings.SELECTED_POI_FILTER_FOR_MAP.get()!= null) {
adapter.item(R.string.sherpafy_disable_poi).iconColor(
R.drawable.ic_action_gremove_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
app.getSettings().SHOW_POI_OVER_MAP.set(false);
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
app.getSettings().SELECTED_POI_FILTER_FOR_MAP.set(null);
mapActivity.refreshMap();
return true;
}
}).reg();
@ -548,8 +548,6 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
mapActivity.getMapLayers().selectPOIFilterLayer(mapActivity.getMapView(), null);
app.getSettings().SHOW_POI_OVER_MAP.set(true);
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
return true;
}
}).reg();

Some files were not shown because too many files have changed in this diff Show more