Merge branch 'r3.7' into text_scale
This commit is contained in:
commit
051d77f80a
24 changed files with 6259 additions and 191 deletions
|
@ -843,6 +843,7 @@ public class CommonWords {
|
||||||
addCommon("van");
|
addCommon("van");
|
||||||
addCommon("road");
|
addCommon("road");
|
||||||
addCommon("street");
|
addCommon("street");
|
||||||
|
addCommon("sector");
|
||||||
addCommon("drive");
|
addCommon("drive");
|
||||||
addCommon("avenue");
|
addCommon("avenue");
|
||||||
addCommon("rue");
|
addCommon("rue");
|
||||||
|
|
|
@ -25,6 +25,26 @@ public class PoiFilter extends AbstractPoiType {
|
||||||
return map.get(kn);
|
return map.get(kn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addExtraPoiTypes(Map<String, PoiType> poiTypesToAdd) {
|
||||||
|
List<PoiType> npoiTypes = null;
|
||||||
|
Map<String, PoiType> nmap = null;
|
||||||
|
for (PoiType poiType : poiTypesToAdd.values()) {
|
||||||
|
if (!map.containsKey(poiType.getKeyName())) {
|
||||||
|
if (npoiTypes == null) {
|
||||||
|
npoiTypes = new ArrayList<PoiType>(this.poiTypes);
|
||||||
|
nmap = new LinkedHashMap<>(map);
|
||||||
|
}
|
||||||
|
npoiTypes.add(poiType);
|
||||||
|
nmap.put(poiType.getKeyName(), poiType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (npoiTypes != null) {
|
||||||
|
poiTypes = npoiTypes;
|
||||||
|
map = nmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void addPoiType(PoiType type) {
|
public void addPoiType(PoiType type) {
|
||||||
if (!map.containsKey(type.getKeyName())) {
|
if (!map.containsKey(type.getKeyName())) {
|
||||||
poiTypes.add(type);
|
poiTypes.add(type);
|
||||||
|
@ -70,4 +90,5 @@ public class PoiFilter extends AbstractPoiType {
|
||||||
return poiTypes;
|
return poiTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ public class PoiType extends AbstractPoiType {
|
||||||
private int order = 90;
|
private int order = 90;
|
||||||
|
|
||||||
|
|
||||||
public PoiType(MapPoiTypes poiTypes, PoiCategory category, PoiFilter filter, String name) {
|
public PoiType(MapPoiTypes poiTypes, PoiCategory category, PoiFilter filter, String keyName) {
|
||||||
super(name, poiTypes);
|
super(keyName, poiTypes);
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.search.core.CustomSearchPoiFilter;
|
||||||
import net.osmand.search.core.ObjectType;
|
import net.osmand.search.core.ObjectType;
|
||||||
import net.osmand.search.core.SearchCoreAPI;
|
import net.osmand.search.core.SearchCoreAPI;
|
||||||
import net.osmand.search.core.SearchCoreFactory;
|
import net.osmand.search.core.SearchCoreFactory;
|
||||||
|
import net.osmand.search.core.SearchCoreFactory.SearchAmenityByTypeAPI;
|
||||||
import net.osmand.search.core.SearchCoreFactory.SearchAmenityTypesAPI;
|
import net.osmand.search.core.SearchCoreFactory.SearchAmenityTypesAPI;
|
||||||
import net.osmand.search.core.SearchCoreFactory.SearchBuildingAndIntersectionsByStreetAPI;
|
import net.osmand.search.core.SearchCoreFactory.SearchBuildingAndIntersectionsByStreetAPI;
|
||||||
import net.osmand.search.core.SearchCoreFactory.SearchStreetByCityAPI;
|
import net.osmand.search.core.SearchCoreFactory.SearchStreetByCityAPI;
|
||||||
|
@ -325,7 +326,7 @@ public class SearchUICore {
|
||||||
apis.add(new SearchCoreFactory.SearchLocationAndUrlAPI());
|
apis.add(new SearchCoreFactory.SearchLocationAndUrlAPI());
|
||||||
SearchAmenityTypesAPI searchAmenityTypesAPI = new SearchAmenityTypesAPI(poiTypes);
|
SearchAmenityTypesAPI searchAmenityTypesAPI = new SearchAmenityTypesAPI(poiTypes);
|
||||||
apis.add(searchAmenityTypesAPI);
|
apis.add(searchAmenityTypesAPI);
|
||||||
apis.add(new SearchCoreFactory.SearchAmenityByTypeAPI(poiTypes, searchAmenityTypesAPI));
|
apis.add(new SearchAmenityByTypeAPI(poiTypes, searchAmenityTypesAPI));
|
||||||
apis.add(new SearchCoreFactory.SearchAmenityByNameAPI());
|
apis.add(new SearchCoreFactory.SearchAmenityByNameAPI());
|
||||||
SearchBuildingAndIntersectionsByStreetAPI streetsApi =
|
SearchBuildingAndIntersectionsByStreetAPI streetsApi =
|
||||||
new SearchCoreFactory.SearchBuildingAndIntersectionsByStreetAPI();
|
new SearchCoreFactory.SearchBuildingAndIntersectionsByStreetAPI();
|
||||||
|
@ -573,6 +574,24 @@ public class SearchUICore {
|
||||||
return radius;
|
return radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AbstractPoiType getUnselectedPoiType() {
|
||||||
|
for (SearchCoreAPI capi : apis) {
|
||||||
|
if (capi instanceof SearchAmenityByTypeAPI) {
|
||||||
|
return ((SearchAmenityByTypeAPI) capi).getUnselectedPoiType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomNameFilter() {
|
||||||
|
for (SearchCoreAPI capi : apis) {
|
||||||
|
if (capi instanceof SearchAmenityByTypeAPI) {
|
||||||
|
return ((SearchAmenityByTypeAPI) capi).getNameFilter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
void searchInternal(final SearchPhrase phrase, SearchResultMatcher matcher) {
|
void searchInternal(final SearchPhrase phrase, SearchResultMatcher matcher) {
|
||||||
preparePhrase(phrase);
|
preparePhrase(phrase);
|
||||||
ArrayList<SearchCoreAPI> lst = new ArrayList<>(apis);
|
ArrayList<SearchCoreAPI> lst = new ArrayList<>(apis);
|
||||||
|
@ -759,14 +778,28 @@ public class SearchUICore {
|
||||||
return exportedCities;
|
return exportedCities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exportObject(MapObject object) {
|
public void exportObject(SearchPhrase phrase, MapObject object) {
|
||||||
|
double maxDistance = phrase.getSettings().getExportSettings().getMaxDistance();
|
||||||
|
if (maxDistance > 0) {
|
||||||
|
double distance = MapUtils.getDistance(phrase.getSettings().getOriginalLocation(), object.getLocation());
|
||||||
|
if (distance > maxDistance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (exportedObjects == null) {
|
if (exportedObjects == null) {
|
||||||
exportedObjects = new ArrayList<>();
|
exportedObjects = new ArrayList<>();
|
||||||
}
|
}
|
||||||
exportedObjects.add(object);
|
exportedObjects.add(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exportCity(City city) {
|
public void exportCity(SearchPhrase phrase, City city) {
|
||||||
|
double maxDistance = phrase.getSettings().getExportSettings().getMaxDistance();
|
||||||
|
if (maxDistance > 0) {
|
||||||
|
double distance = MapUtils.getDistance(phrase.getSettings().getOriginalLocation(), city.getLocation());
|
||||||
|
if (distance > maxDistance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (exportedCities == null) {
|
if (exportedCities == null) {
|
||||||
exportedCities = new ArrayList<>();
|
exportedCities = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ public class SearchCoreFactory {
|
||||||
sr.objectType = ObjectType.REGION;
|
sr.objectType = ObjectType.REGION;
|
||||||
sr.location = bmir.getRegionCenter();
|
sr.location = bmir.getRegionCenter();
|
||||||
sr.preferredZoom = 6;
|
sr.preferredZoom = 6;
|
||||||
if (phrase.getFirstUnknownSearchWord().length() <= 1 && phrase.isNoSelectedType()) {
|
if (phrase.getFullSearchPhrase().length() <= 1 && phrase.isNoSelectedType()) {
|
||||||
resultMatcher.publish(sr);
|
resultMatcher.publish(sr);
|
||||||
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
||||||
resultMatcher.publish(sr);
|
resultMatcher.publish(sr);
|
||||||
|
@ -343,7 +343,7 @@ public class SearchCoreFactory {
|
||||||
int limit = 0;
|
int limit = 0;
|
||||||
for (City c : resArray) {
|
for (City c : resArray) {
|
||||||
if (phrase.getSettings().isExportObjects()) {
|
if (phrase.getSettings().isExportObjects()) {
|
||||||
resultMatcher.exportCity(c);
|
resultMatcher.exportCity(phrase, c);
|
||||||
}
|
}
|
||||||
SearchResult res = new SearchResult(phrase);
|
SearchResult res = new SearchResult(phrase);
|
||||||
res.object = c;
|
res.object = c;
|
||||||
|
@ -388,7 +388,7 @@ public class SearchCoreFactory {
|
||||||
@Override
|
@Override
|
||||||
public boolean publish(MapObject object) {
|
public boolean publish(MapObject object) {
|
||||||
if (phrase.getSettings().isExportObjects()) {
|
if (phrase.getSettings().isExportObjects()) {
|
||||||
resultMatcher.exportObject(object);
|
resultMatcher.exportObject(phrase, object);
|
||||||
}
|
}
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -546,7 +546,7 @@ public class SearchCoreFactory {
|
||||||
@Override
|
@Override
|
||||||
public boolean publish(Amenity object) {
|
public boolean publish(Amenity object) {
|
||||||
if (phrase.getSettings().isExportObjects()) {
|
if (phrase.getSettings().isExportObjects()) {
|
||||||
resultMatcher.exportObject(object);
|
resultMatcher.exportObject(phrase, object);
|
||||||
}
|
}
|
||||||
if (limit++ > LIMIT) {
|
if (limit++ > LIMIT) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -648,6 +648,7 @@ public class SearchCoreFactory {
|
||||||
|
|
||||||
public void clearCustomFilters() {
|
public void clearCustomFilters() {
|
||||||
this.customPoiFilters.clear();
|
this.customPoiFilters.clear();
|
||||||
|
this.activePoiFilters.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCustomFilter(CustomSearchPoiFilter poiFilter, int priority) {
|
public void addCustomFilter(CustomSearchPoiFilter poiFilter, int priority) {
|
||||||
|
@ -731,6 +732,7 @@ public class SearchCoreFactory {
|
||||||
if (translatedNames.isEmpty()) {
|
if (translatedNames.isEmpty()) {
|
||||||
translatedNames = types.getAllTranslatedNames(false);
|
translatedNames = types.getAllTranslatedNames(false);
|
||||||
topVisibleFilters = types.getTopVisibleFilters();
|
topVisibleFilters = types.getTopVisibleFilters();
|
||||||
|
topVisibleFilters.remove(types.getOsmwiki());
|
||||||
categories = types.getCategories(false);
|
categories = types.getCategories(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -839,9 +841,8 @@ public class SearchCoreFactory {
|
||||||
private static final int BBOX_RADIUS = 10000;
|
private static final int BBOX_RADIUS = 10000;
|
||||||
private SearchAmenityTypesAPI searchAmenityTypesAPI;
|
private SearchAmenityTypesAPI searchAmenityTypesAPI;
|
||||||
private MapPoiTypes types;
|
private MapPoiTypes types;
|
||||||
private Map<PoiCategory, LinkedHashSet<String>> acceptedTypes = new LinkedHashMap<PoiCategory,
|
private AbstractPoiType unselectedPoiType;
|
||||||
LinkedHashSet<String>>();
|
private String nameFilter;
|
||||||
private Map<String, PoiType> poiAdditionals = new HashMap<String, PoiType>();
|
|
||||||
|
|
||||||
public SearchAmenityByTypeAPI(MapPoiTypes types, SearchAmenityTypesAPI searchAmenityTypesAPI) {
|
public SearchAmenityByTypeAPI(MapPoiTypes types, SearchAmenityTypesAPI searchAmenityTypesAPI) {
|
||||||
super(ObjectType.POI);
|
super(ObjectType.POI);
|
||||||
|
@ -849,6 +850,14 @@ public class SearchCoreFactory {
|
||||||
this.searchAmenityTypesAPI = searchAmenityTypesAPI;
|
this.searchAmenityTypesAPI = searchAmenityTypesAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AbstractPoiType getUnselectedPoiType() {
|
||||||
|
return unselectedPoiType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNameFilter() {
|
||||||
|
return nameFilter;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSearchMoreAvailable(SearchPhrase phrase) {
|
public boolean isSearchMoreAvailable(SearchPhrase phrase) {
|
||||||
return getSearchPriority(phrase) != -1 && super.isSearchMoreAvailable(phrase);
|
return getSearchPriority(phrase) != -1 && super.isSearchMoreAvailable(phrase);
|
||||||
|
@ -864,23 +873,17 @@ public class SearchCoreFactory {
|
||||||
return phrase.getNextRadiusSearch(BBOX_RADIUS);
|
return phrase.getNextRadiusSearch(BBOX_RADIUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateTypesToAccept(AbstractPoiType pt) {
|
|
||||||
pt.putTypes(acceptedTypes);
|
|
||||||
if (pt instanceof PoiType && ((PoiType) pt).isAdditional() && ((PoiType) pt).getParentType() != null) {
|
|
||||||
poiAdditionals.put(pt.getKeyName(), (PoiType) pt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean search(final SearchPhrase phrase, final SearchResultMatcher resultMatcher) throws IOException {
|
public boolean search(final SearchPhrase phrase, final SearchResultMatcher resultMatcher) throws IOException {
|
||||||
|
unselectedPoiType = null;
|
||||||
SearchPoiTypeFilter poiTypeFilter = null;
|
SearchPoiTypeFilter poiTypeFilter = null;
|
||||||
String nameFilter = null;
|
String nameFilter = null;
|
||||||
int countExtraWords = 0;
|
int countExtraWords = 0;
|
||||||
|
Map<String, PoiType> poiAdditionals = new LinkedHashMap<String, PoiType>();
|
||||||
if (phrase.isLastWord(ObjectType.POI_TYPE)) {
|
if (phrase.isLastWord(ObjectType.POI_TYPE)) {
|
||||||
Object obj = phrase.getLastSelectedWord().getResult().object;
|
Object obj = phrase.getLastSelectedWord().getResult().object;
|
||||||
if (obj instanceof AbstractPoiType) {
|
if (obj instanceof AbstractPoiType) {
|
||||||
poiTypeFilter = getPoiTypeFilter((AbstractPoiType) obj);
|
poiTypeFilter = getPoiTypeFilter((AbstractPoiType) obj, poiAdditionals);
|
||||||
} else if (obj instanceof SearchPoiTypeFilter) {
|
} else if (obj instanceof SearchPoiTypeFilter) {
|
||||||
poiTypeFilter = (SearchPoiTypeFilter) obj;
|
poiTypeFilter = (SearchPoiTypeFilter) obj;
|
||||||
} else {
|
} else {
|
||||||
|
@ -910,17 +913,20 @@ public class SearchCoreFactory {
|
||||||
nameFilter += otherSearchWords.get(k);
|
nameFilter += otherSearchWords.get(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
poiTypeFilter = getPoiTypeFilter(poiType.getKey());
|
poiTypeFilter = getPoiTypeFilter(poiType.getKey(), poiAdditionals);
|
||||||
|
unselectedPoiType = poiType.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.nameFilter = nameFilter;
|
||||||
if (poiTypeFilter != null) {
|
if (poiTypeFilter != null) {
|
||||||
QuadRect bbox = phrase.getRadiusBBoxToSearch(BBOX_RADIUS);
|
QuadRect bbox = phrase.getRadiusBBoxToSearch(BBOX_RADIUS);
|
||||||
List<BinaryMapIndexReader> offlineIndexes = phrase.getOfflineIndexes();
|
List<BinaryMapIndexReader> offlineIndexes = phrase.getOfflineIndexes();
|
||||||
Set<String> searchedPois = new TreeSet<>();
|
Set<String> searchedPois = new TreeSet<>();
|
||||||
for (BinaryMapIndexReader r : offlineIndexes) {
|
for (BinaryMapIndexReader r : offlineIndexes) {
|
||||||
ResultMatcher<Amenity> rm = getResultMatcher(phrase, poiTypeFilter, resultMatcher, nameFilter, r, searchedPois, countExtraWords);
|
ResultMatcher<Amenity> rm = getResultMatcher(phrase, poiTypeFilter, resultMatcher, nameFilter, r,
|
||||||
|
searchedPois, poiAdditionals, countExtraWords);
|
||||||
if (poiTypeFilter instanceof CustomSearchPoiFilter) {
|
if (poiTypeFilter instanceof CustomSearchPoiFilter) {
|
||||||
rm = ((CustomSearchPoiFilter) poiTypeFilter).wrapResultMatcher(rm);
|
rm = ((CustomSearchPoiFilter) poiTypeFilter).wrapResultMatcher(rm);
|
||||||
}
|
}
|
||||||
|
@ -937,7 +943,8 @@ public class SearchCoreFactory {
|
||||||
private ResultMatcher<Amenity> getResultMatcher(final SearchPhrase phrase, final SearchPoiTypeFilter poiTypeFilter,
|
private ResultMatcher<Amenity> getResultMatcher(final SearchPhrase phrase, final SearchPoiTypeFilter poiTypeFilter,
|
||||||
final SearchResultMatcher resultMatcher, final String nameFilter,
|
final SearchResultMatcher resultMatcher, final String nameFilter,
|
||||||
final BinaryMapIndexReader selected, final Set<String> searchedPois,
|
final BinaryMapIndexReader selected, final Set<String> searchedPois,
|
||||||
final int countExtraWords) {
|
final Map<String, PoiType> poiAdditionals, final int countExtraWords) {
|
||||||
|
|
||||||
|
|
||||||
final NameStringMatcher ns = nameFilter == null ? null : new NameStringMatcher(nameFilter, StringMatcherMode.CHECK_STARTS_FROM_SPACE);
|
final NameStringMatcher ns = nameFilter == null ? null : new NameStringMatcher(nameFilter, StringMatcherMode.CHECK_STARTS_FROM_SPACE);
|
||||||
return new ResultMatcher<Amenity>() {
|
return new ResultMatcher<Amenity>() {
|
||||||
|
@ -945,7 +952,7 @@ public class SearchCoreFactory {
|
||||||
@Override
|
@Override
|
||||||
public boolean publish(Amenity object) {
|
public boolean publish(Amenity object) {
|
||||||
if (phrase.getSettings().isExportObjects()) {
|
if (phrase.getSettings().isExportObjects()) {
|
||||||
resultMatcher.exportObject(object);
|
resultMatcher.exportObject(phrase, object);
|
||||||
}
|
}
|
||||||
SearchResult res = new SearchResult(phrase);
|
SearchResult res = new SearchResult(phrase);
|
||||||
String poiID = object.getType().getKeyName() + "_" + object.getId();
|
String poiID = object.getType().getKeyName() + "_" + object.getId();
|
||||||
|
@ -1009,10 +1016,14 @@ public class SearchCoreFactory {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchPoiTypeFilter getPoiTypeFilter(AbstractPoiType pt) {
|
private SearchPoiTypeFilter getPoiTypeFilter(AbstractPoiType pt, Map<String, PoiType> poiAdditionals ) {
|
||||||
acceptedTypes.clear();
|
final Map<PoiCategory, LinkedHashSet<String>> acceptedTypes = new LinkedHashMap<PoiCategory,
|
||||||
|
LinkedHashSet<String>>();
|
||||||
|
pt.putTypes(acceptedTypes);
|
||||||
poiAdditionals.clear();
|
poiAdditionals.clear();
|
||||||
updateTypesToAccept(pt);
|
if (pt instanceof PoiType && ((PoiType) pt).isAdditional() && ((PoiType) pt).getParentType() != null) {
|
||||||
|
poiAdditionals.put(pt.getKeyName(), (PoiType) pt);
|
||||||
|
}
|
||||||
return new SearchPoiTypeFilter() {
|
return new SearchPoiTypeFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,30 +3,29 @@ package net.osmand.search.core;
|
||||||
public class SearchExportSettings {
|
public class SearchExportSettings {
|
||||||
private boolean exportEmptyCities;
|
private boolean exportEmptyCities;
|
||||||
private boolean exportBuildings;
|
private boolean exportBuildings;
|
||||||
|
private double maxDistance;
|
||||||
|
|
||||||
public SearchExportSettings() {
|
public SearchExportSettings() {
|
||||||
exportEmptyCities = true;
|
exportEmptyCities = true;
|
||||||
exportBuildings = true;
|
exportBuildings = true;
|
||||||
|
maxDistance = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SearchExportSettings(boolean exportEmptyCities, boolean exportBuildings) {
|
public SearchExportSettings(boolean exportEmptyCities, boolean exportBuildings, double maxDistance) {
|
||||||
this.exportEmptyCities = exportEmptyCities;
|
this.exportEmptyCities = exportEmptyCities;
|
||||||
this.exportBuildings = exportBuildings;
|
this.exportBuildings = exportBuildings;
|
||||||
|
this.maxDistance = maxDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExportEmptyCities() {
|
public boolean isExportEmptyCities() {
|
||||||
return exportEmptyCities;
|
return exportEmptyCities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExportEmptyCities(boolean exportEmptyCities) {
|
|
||||||
this.exportEmptyCities = exportEmptyCities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isExportBuildings() {
|
public boolean isExportBuildings() {
|
||||||
return exportBuildings;
|
return exportBuildings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExportBuildings(boolean exportBuildings) {
|
public double getMaxDistance() {
|
||||||
this.exportBuildings = exportBuildings;
|
return maxDistance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class SearchSettings {
|
||||||
private boolean emptyQueryAllowed;
|
private boolean emptyQueryAllowed;
|
||||||
private boolean sortByName;
|
private boolean sortByName;
|
||||||
private SearchExportSettings exportSettings;
|
private SearchExportSettings exportSettings;
|
||||||
//private SearchExportSettings exportSettings = new SearchExportSettings(false, false);
|
//private SearchExportSettings exportSettings = new SearchExportSettings(false, false, -1);
|
||||||
|
|
||||||
public SearchSettings(SearchSettings s) {
|
public SearchSettings(SearchSettings s) {
|
||||||
if(s != null) {
|
if(s != null) {
|
||||||
|
|
1090
OsmAnd-java/src/test/resources/search/fuel_diesel.json
Normal file
1090
OsmAnd-java/src/test/resources/search/fuel_diesel.json
Normal file
File diff suppressed because it is too large
Load diff
2143
OsmAnd-java/src/test/resources/search/hisar.json
Normal file
2143
OsmAnd-java/src/test/resources/search/hisar.json
Normal file
File diff suppressed because it is too large
Load diff
2705
OsmAnd-java/src/test/resources/search/rolandstr.json
Normal file
2705
OsmAnd-java/src/test/resources/search/rolandstr.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -25,7 +25,10 @@ import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
@ -372,24 +375,55 @@ public class OsmAndFormatter {
|
||||||
public static String getPoiStringWithoutType(Amenity amenity, String locale, boolean transliterate) {
|
public static String getPoiStringWithoutType(Amenity amenity, String locale, boolean transliterate) {
|
||||||
PoiCategory pc = amenity.getType();
|
PoiCategory pc = amenity.getType();
|
||||||
PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType());
|
PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType());
|
||||||
String nm = amenity.getSubType();
|
String typeName = amenity.getSubType();
|
||||||
if (pt != null) {
|
if (pt != null) {
|
||||||
nm = pt.getTranslation();
|
typeName = pt.getTranslation();
|
||||||
} else if(nm != null){
|
} else if(typeName != null){
|
||||||
nm = Algorithms.capitalizeFirstLetterAndLowercase(nm.replace('_', ' '));
|
typeName = Algorithms.capitalizeFirstLetterAndLowercase(typeName.replace('_', ' '));
|
||||||
}
|
}
|
||||||
String n = amenity.getName(locale, transliterate);
|
String localName = amenity.getName(locale, transliterate);
|
||||||
if (n.indexOf(nm) != -1) {
|
if (typeName != null && localName.contains(typeName)) {
|
||||||
// type is contained in name e.g.
|
// type is contained in name e.g.
|
||||||
// n = "Bakery the Corner"
|
// localName = "Bakery the Corner"
|
||||||
// type = "Bakery"
|
// type = "Bakery"
|
||||||
// no need to repeat this
|
// no need to repeat this
|
||||||
return n;
|
return localName;
|
||||||
}
|
}
|
||||||
if (n.length() == 0) {
|
if (localName.length() == 0) {
|
||||||
return nm;
|
return typeName;
|
||||||
}
|
}
|
||||||
return nm + " " + n; //$NON-NLS-1$
|
return typeName + " " + localName; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getPoiStringsWithoutType(Amenity amenity, String locale, boolean transliterate) {
|
||||||
|
PoiCategory pc = amenity.getType();
|
||||||
|
PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType());
|
||||||
|
String typeName = amenity.getSubType();
|
||||||
|
if (pt != null) {
|
||||||
|
typeName = pt.getTranslation();
|
||||||
|
} else if(typeName != null){
|
||||||
|
typeName = Algorithms.capitalizeFirstLetterAndLowercase(typeName.replace('_', ' '));
|
||||||
|
}
|
||||||
|
List<String> res = new ArrayList<>();
|
||||||
|
String localName = amenity.getName(locale, transliterate);
|
||||||
|
addPoiString(typeName, localName, res);
|
||||||
|
for (String name : amenity.getAllNames(true)) {
|
||||||
|
addPoiString(typeName, name, res);
|
||||||
|
}
|
||||||
|
for (String name : amenity.getAdditionalInfo().values()) {
|
||||||
|
addPoiString(typeName, name, res);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addPoiString(String poiTypeName, String poiName, List<String> res) {
|
||||||
|
if (poiTypeName != null && poiName.contains(poiTypeName)) {
|
||||||
|
res.add(poiName);
|
||||||
|
}
|
||||||
|
if (poiName.length() == 0) {
|
||||||
|
res.add(poiTypeName);
|
||||||
|
}
|
||||||
|
res.add(poiTypeName + " " + poiName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAmenityDescriptionContent(OsmandApplication ctx, Amenity amenity, boolean shortDescription) {
|
public static String getAmenityDescriptionContent(OsmandApplication ctx, Amenity amenity, boolean shortDescription) {
|
||||||
|
|
|
@ -248,6 +248,8 @@ public class ImportHelper {
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
//
|
//
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
if (is != null) try {
|
if (is != null) try {
|
||||||
is.close();
|
is.close();
|
||||||
|
@ -314,6 +316,8 @@ public class ImportHelper {
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
//
|
//
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
if (is != null) try {
|
if (is != null) try {
|
||||||
is.close();
|
is.close();
|
||||||
|
@ -410,7 +414,7 @@ public class ImportHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (is != null) {
|
if (is != null) {
|
||||||
|
@ -463,6 +467,8 @@ public class ImportHelper {
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
//
|
//
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
if (is != null) try {
|
if (is != null) try {
|
||||||
is.close();
|
is.close();
|
||||||
|
@ -549,6 +555,9 @@ public class ImportHelper {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
error = e.getMessage();
|
error = e.getMessage();
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
error = e.getMessage();
|
||||||
} finally {
|
} finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -918,6 +927,8 @@ public class ImportHelper {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
if (is != null) try {
|
if (is != null) try {
|
||||||
is.close();
|
is.close();
|
||||||
|
|
|
@ -35,7 +35,6 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.LocalIndexHelper;
|
import net.osmand.plus.activities.LocalIndexHelper;
|
||||||
|
@ -50,6 +49,7 @@ import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseListener;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType;
|
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType;
|
||||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -82,6 +82,8 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
return lhs.getName().compareTo(rhs.getName());
|
return lhs.getName().compareTo(rhs.getName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private OsmandApplication app;
|
||||||
private View subscriptionHeader;
|
private View subscriptionHeader;
|
||||||
private ExpandableListView listView;
|
private ExpandableListView listView;
|
||||||
private LocalIndexesAdapter adapter;
|
private LocalIndexesAdapter adapter;
|
||||||
|
@ -109,6 +111,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
app = getMyApplication();
|
||||||
if (getActivity() instanceof OsmLiveActivity) {
|
if (getActivity() instanceof OsmLiveActivity) {
|
||||||
showSettingsOnly = ((OsmLiveActivity) getActivity()).isShowSettingOnly();
|
showSettingsOnly = ((OsmLiveActivity) getActivity()).isShowSettingOnly();
|
||||||
}
|
}
|
||||||
|
@ -120,7 +123,6 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
View view = inflater.inflate(R.layout.fragment_live_updates, container, false);
|
View view = inflater.inflate(R.layout.fragment_live_updates, container, false);
|
||||||
listView = (ExpandableListView) view.findViewById(android.R.id.list);
|
listView = (ExpandableListView) view.findViewById(android.R.id.list);
|
||||||
|
|
||||||
final OsmandApplication app = getMyApplication();
|
|
||||||
boolean nightMode = !app.getSettings().isLightContent();
|
boolean nightMode = !app.getSettings().isLightContent();
|
||||||
final SwipeRefreshLayout swipeRefresh = view.findViewById(R.id.swipe_refresh);
|
final SwipeRefreshLayout swipeRefresh = view.findViewById(R.id.swipe_refresh);
|
||||||
int swipeColor = ContextCompat.getColor(app, nightMode ? R.color.osmand_orange_dark : R.color.osmand_orange);
|
int swipeColor = ContextCompat.getColor(app, nightMode ? R.color.osmand_orange_dark : R.color.osmand_orange);
|
||||||
|
@ -141,7 +143,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
listView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
listView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||||
if (!processing && InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication())) {
|
if (!processing && InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) {
|
||||||
final FragmentManager fragmentManager = getChildFragmentManager();
|
final FragmentManager fragmentManager = getChildFragmentManager();
|
||||||
LiveUpdatesSettingsDialogFragment
|
LiveUpdatesSettingsDialogFragment
|
||||||
.createInstance(adapter.getChild(groupPosition, childPosition).getFileName())
|
.createInstance(adapter.getChild(groupPosition, childPosition).getFileName())
|
||||||
|
@ -155,7 +157,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
|
|
||||||
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
||||||
|
|
||||||
if (!Version.isDeveloperVersion(getMyApplication())) {
|
if (!Version.isDeveloperVersion(app)) {
|
||||||
subscriptionHeader = inflater.inflate(R.layout.live_updates_header, listView, false);
|
subscriptionHeader = inflater.inflate(R.layout.live_updates_header, listView, false);
|
||||||
updateSubscriptionHeader();
|
updateSubscriptionHeader();
|
||||||
listView.addHeaderView(subscriptionHeader, "subscriptionHeader", false);
|
listView.addHeaderView(subscriptionHeader, "subscriptionHeader", false);
|
||||||
|
@ -172,22 +174,22 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
if (getActivity() instanceof OsmLiveActivity && subscriptionHeader != null) {
|
if (getActivity() instanceof OsmLiveActivity && subscriptionHeader != null) {
|
||||||
View subscriptionBanner = subscriptionHeader.findViewById(R.id.subscription_banner);
|
View subscriptionBanner = subscriptionHeader.findViewById(R.id.subscription_banner);
|
||||||
View subscriptionInfo = subscriptionHeader.findViewById(R.id.subscription_info);
|
View subscriptionInfo = subscriptionHeader.findViewById(R.id.subscription_info);
|
||||||
if (InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication())) {
|
if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) {
|
||||||
ImageView statusIcon = (ImageView) subscriptionHeader.findViewById(R.id.statusIcon);
|
ImageView statusIcon = (ImageView) subscriptionHeader.findViewById(R.id.statusIcon);
|
||||||
TextView statusTextView = (TextView) subscriptionHeader.findViewById(R.id.statusTextView);
|
TextView statusTextView = (TextView) subscriptionHeader.findViewById(R.id.statusTextView);
|
||||||
TextView regionNameHeaderTextView = (TextView) subscriptionHeader.findViewById(R.id.regionHeaderTextView);
|
TextView regionNameHeaderTextView = (TextView) subscriptionHeader.findViewById(R.id.regionHeaderTextView);
|
||||||
TextView regionNameTextView = (TextView) subscriptionHeader.findViewById(R.id.regionTextView);
|
TextView regionNameTextView = (TextView) subscriptionHeader.findViewById(R.id.regionTextView);
|
||||||
statusTextView.setText(getString(R.string.osm_live_active));
|
statusTextView.setText(getString(R.string.osm_live_active));
|
||||||
statusIcon.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_done));
|
statusIcon.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_done));
|
||||||
|
|
||||||
regionNameHeaderTextView.setText(R.string.osm_live_support_region);
|
regionNameHeaderTextView.setText(R.string.osm_live_support_region);
|
||||||
String countryName = getSettings().BILLING_USER_COUNTRY.get();
|
String countryName = app.getSettings().BILLING_USER_COUNTRY.get();
|
||||||
InAppPurchaseHelper purchaseHelper = getInAppPurchaseHelper();
|
InAppPurchaseHelper purchaseHelper = getInAppPurchaseHelper();
|
||||||
if (purchaseHelper != null) {
|
if (purchaseHelper != null) {
|
||||||
InAppSubscription monthlyPurchased = purchaseHelper.getPurchasedMonthlyLiveUpdates();
|
InAppSubscription monthlyPurchased = purchaseHelper.getPurchasedMonthlyLiveUpdates();
|
||||||
if (monthlyPurchased != null && monthlyPurchased.isDonationSupported()) {
|
if (monthlyPurchased != null && monthlyPurchased.isDonationSupported()) {
|
||||||
if (Algorithms.isEmpty(countryName)) {
|
if (Algorithms.isEmpty(countryName)) {
|
||||||
if (getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.get().equals(OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER)) {
|
if (app.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.get().equals(OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER)) {
|
||||||
regionNameHeaderTextView.setText(R.string.default_buttons_support);
|
regionNameHeaderTextView.setText(R.string.default_buttons_support);
|
||||||
countryName = getString(R.string.osmand_team);
|
countryName = getString(R.string.osmand_team);
|
||||||
} else {
|
} else {
|
||||||
|
@ -277,12 +279,10 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyLiveUpdatesChanged() {
|
public void notifyLiveUpdatesChanged() {
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null && adapter != null) {
|
||||||
if (adapter != null && getMyApplication() != null) {
|
|
||||||
adapter.notifyLiveUpdatesChanged();
|
adapter.notifyLiveUpdatesChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isDonationSupported() {
|
private boolean isDonationSupported() {
|
||||||
InAppPurchaseHelper purchaseHelper = getInAppPurchaseHelper();
|
InAppPurchaseHelper purchaseHelper = getInAppPurchaseHelper();
|
||||||
|
@ -313,7 +313,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
|
|
||||||
public void add(LocalIndexInfo info) {
|
public void add(LocalIndexInfo info) {
|
||||||
OsmandSettings.CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(
|
OsmandSettings.CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(
|
||||||
info.getFileName(), getSettings());
|
info.getFileName(), app.getSettings());
|
||||||
if (preference.get()) {
|
if (preference.get()) {
|
||||||
dataShouldUpdate.add(info);
|
dataShouldUpdate.add(info);
|
||||||
} else {
|
} else {
|
||||||
|
@ -325,7 +325,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
Set<LocalIndexInfo> changedSet = new HashSet<>();
|
Set<LocalIndexInfo> changedSet = new HashSet<>();
|
||||||
for (LocalIndexInfo localIndexInfo : dataShouldUpdate) {
|
for (LocalIndexInfo localIndexInfo : dataShouldUpdate) {
|
||||||
OsmandSettings.CommonPreference<Boolean> preference =
|
OsmandSettings.CommonPreference<Boolean> preference =
|
||||||
preferenceLiveUpdatesOn(localIndexInfo.getFileName(), getSettings());
|
preferenceLiveUpdatesOn(localIndexInfo.getFileName(), app.getSettings());
|
||||||
if (!preference.get()) {
|
if (!preference.get()) {
|
||||||
changedSet.add(localIndexInfo);
|
changedSet.add(localIndexInfo);
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
changedSet.clear();
|
changedSet.clear();
|
||||||
for (LocalIndexInfo localIndexInfo : dataShouldNotUpdate) {
|
for (LocalIndexInfo localIndexInfo : dataShouldNotUpdate) {
|
||||||
OsmandSettings.CommonPreference<Boolean> preference =
|
OsmandSettings.CommonPreference<Boolean> preference =
|
||||||
preferenceLiveUpdatesOn(localIndexInfo.getFileName(), getSettings());
|
preferenceLiveUpdatesOn(localIndexInfo.getFileName(), app.getSettings());
|
||||||
if (preference.get()) {
|
if (preference.get()) {
|
||||||
changedSet.add(localIndexInfo);
|
changedSet.add(localIndexInfo);
|
||||||
}
|
}
|
||||||
|
@ -410,11 +410,11 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
if (InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication())) {
|
if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) {
|
||||||
switchOnLiveUpdates(settings);
|
switchOnLiveUpdates(settings);
|
||||||
} else {
|
} else {
|
||||||
liveUpdatesSwitch.setChecked(false);
|
liveUpdatesSwitch.setChecked(false);
|
||||||
getMyApplication().showToastMessage(getString(R.string.osm_live_ask_for_purchase));
|
app.showToastMessage(getString(R.string.osm_live_ask_for_purchase));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
settings.IS_LIVE_UPDATES_ON.set(false);
|
settings.IS_LIVE_UPDATES_ON.set(false);
|
||||||
|
@ -447,16 +447,16 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
private void showUpdateDialog() {
|
private void showUpdateDialog() {
|
||||||
if(dataShouldUpdate.size() > 0) {
|
if(dataShouldUpdate.size() > 0) {
|
||||||
if (dataShouldUpdate.size() == 1) {
|
if (dataShouldUpdate.size() == 1) {
|
||||||
runLiveUpdate(getMyApplication(), dataShouldUpdate.get(0).getFileName(), false);
|
runLiveUpdate(app, dataShouldUpdate.get(0).getFileName(), false);
|
||||||
} else {
|
} else {
|
||||||
Builder bld = new AlertDialog.Builder(getActivity());
|
Builder bld = new AlertDialog.Builder(ctx);
|
||||||
bld.setMessage(R.string.update_all_maps_now);
|
bld.setMessage(R.string.update_all_maps_now);
|
||||||
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
for (LocalIndexInfo li : dataShouldUpdate) {
|
for (LocalIndexInfo li : dataShouldUpdate) {
|
||||||
runLiveUpdate(getMyApplication(), li.getFileName(), false);
|
runLiveUpdate(app, li.getFileName(), false);
|
||||||
}
|
}
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -468,17 +468,15 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableLiveUpdates(boolean enable) {
|
private void enableLiveUpdates(boolean enable) {
|
||||||
AlarmManager alarmMgr = (AlarmManager) getActivity()
|
AlarmManager alarmMgr = (AlarmManager) ctx.getSystemService(Context.ALARM_SERVICE);
|
||||||
.getSystemService(Context.ALARM_SERVICE);
|
|
||||||
for (LocalIndexInfo li : dataShouldUpdate) {
|
for (LocalIndexInfo li : dataShouldUpdate) {
|
||||||
String fileName = li.getFileName();
|
String fileName = li.getFileName();
|
||||||
PendingIntent alarmIntent = getPendingIntent(getActivity(),
|
PendingIntent alarmIntent = getPendingIntent(ctx, fileName);
|
||||||
fileName);
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
final OsmandSettings.CommonPreference<Integer> updateFrequencyPreference =
|
final OsmandSettings.CommonPreference<Integer> updateFrequencyPreference =
|
||||||
preferenceUpdateFrequency(fileName, getSettings());
|
preferenceUpdateFrequency(fileName, app.getSettings());
|
||||||
final OsmandSettings.CommonPreference<Integer> timeOfDayPreference =
|
final OsmandSettings.CommonPreference<Integer> timeOfDayPreference =
|
||||||
preferenceTimeOfDayToUpdate(fileName, getSettings());
|
preferenceTimeOfDayToUpdate(fileName, app.getSettings());
|
||||||
UpdateFrequency updateFrequency = UpdateFrequency.values()[updateFrequencyPreference.get()];
|
UpdateFrequency updateFrequency = UpdateFrequency.values()[updateFrequencyPreference.get()];
|
||||||
TimeOfDay timeOfDayToUpdate = TimeOfDay.values()[timeOfDayPreference.get()];
|
TimeOfDay timeOfDayToUpdate = TimeOfDay.values()[timeOfDayPreference.get()];
|
||||||
setAlarmForPendingIntent(alarmIntent, alarmMgr, updateFrequency, timeOfDayToUpdate);
|
setAlarmForPendingIntent(alarmIntent, alarmMgr, updateFrequency, timeOfDayToUpdate);
|
||||||
|
@ -713,8 +711,8 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGetItems() {
|
public void onGetItems() {
|
||||||
if (!InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication())) {
|
if (!InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) {
|
||||||
getSettings().IS_LIVE_UPDATES_ON.set(false);
|
app.getSettings().IS_LIVE_UPDATES_ON.set(false);
|
||||||
adapter.enableLiveUpdates(false);
|
adapter.enableLiveUpdates(false);
|
||||||
}
|
}
|
||||||
disableProgress();
|
disableProgress();
|
||||||
|
|
|
@ -128,7 +128,8 @@ public class EditPoiData {
|
||||||
if (oldValue == null || !oldValue.equals(value)) {
|
if (oldValue == null || !oldValue.equals(value)) {
|
||||||
changedTags.add(tag);
|
changedTags.add(tag);
|
||||||
}
|
}
|
||||||
tagValues.put(tag, value);
|
String tagVal = value != null ? value : "";
|
||||||
|
tagValues.put(tag, tagVal);
|
||||||
notifyDatasetChanged(tag);
|
notifyDatasetChanged(tag);
|
||||||
} finally {
|
} finally {
|
||||||
isInEdit = false;
|
isInEdit = false;
|
||||||
|
@ -207,7 +208,8 @@ public class EditPoiData {
|
||||||
public void updateTypeTag(String string, boolean userChanges) {
|
public void updateTypeTag(String string, boolean userChanges) {
|
||||||
checkNotInEdit();
|
checkNotInEdit();
|
||||||
try {
|
try {
|
||||||
tagValues.put(POI_TYPE_TAG, string);
|
String val = string != null ? string : "";
|
||||||
|
tagValues.put(POI_TYPE_TAG, val);
|
||||||
if (userChanges) {
|
if (userChanges) {
|
||||||
changedTags.add(POI_TYPE_TAG);
|
changedTags.add(POI_TYPE_TAG);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +218,8 @@ public class EditPoiData {
|
||||||
if (pt != null) {
|
if (pt != null) {
|
||||||
removeTypeTagWithPrefix(!tagValues.containsKey(REMOVE_TAG_PREFIX + pt.getEditOsmTag()));
|
removeTypeTagWithPrefix(!tagValues.containsKey(REMOVE_TAG_PREFIX + pt.getEditOsmTag()));
|
||||||
currentPoiType = pt;
|
currentPoiType = pt;
|
||||||
tagValues.put(pt.getEditOsmTag(), pt.getEditOsmValue());
|
String tagVal = pt.getEditOsmValue() != null ? pt.getEditOsmValue() : "";
|
||||||
|
tagValues.put(pt.getEditOsmTag(), tagVal);
|
||||||
if (userChanges) {
|
if (userChanges) {
|
||||||
changedTags.add(pt.getEditOsmTag());
|
changedTags.add(pt.getEditOsmTag());
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,6 @@ import net.osmand.osm.edit.OSMSettings;
|
||||||
import net.osmand.osm.edit.Way;
|
import net.osmand.osm.edit.Way;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -75,6 +74,7 @@ import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||||
import net.osmand.plus.osmedit.OsmPoint.Action;
|
import net.osmand.plus.osmedit.OsmPoint.Action;
|
||||||
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
|
||||||
import net.osmand.plus.osmedit.dialogs.PoiTypeDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.PoiTypeDialogFragment;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -466,7 +466,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
|
|
||||||
private String isTextLengthInRange() {
|
private String isTextLengthInRange() {
|
||||||
for (Entry<String, String> s : editPoiData.getTagValues().entrySet()) {
|
for (Entry<String, String> s : editPoiData.getTagValues().entrySet()) {
|
||||||
if (s.getValue().length() > AMENITY_TEXT_LENGTH) {
|
if (!Algorithms.isEmpty(s.getValue()) && s.getValue().length() > AMENITY_TEXT_LENGTH) {
|
||||||
return s.getKey();
|
return s.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
if (getActivity() instanceof MapActivity) {
|
if (getActivity() instanceof MapActivity) {
|
||||||
((MapActivity) getActivity()).getMapView().refreshMap(true);
|
((MapActivity) getActivity()).getMapView().refreshMap(true);
|
||||||
}
|
}
|
||||||
dismiss();
|
dismissAllowingStateLoss();
|
||||||
} else {
|
} else {
|
||||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||||
mOpenstreetmapUtil = plugin.getPoiModificationLocalUtil();
|
mOpenstreetmapUtil = plugin.getPoiModificationLocalUtil();
|
||||||
|
|
|
@ -11,13 +11,13 @@ import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.api.SQLiteAPI;
|
import net.osmand.plus.api.SQLiteAPI;
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteStatement;
|
import net.osmand.plus.api.SQLiteAPI.SQLiteStatement;
|
||||||
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
|
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ public class PoiFiltersHelper {
|
||||||
private PoiUIFilter searchByNamePOIFilter;
|
private PoiUIFilter searchByNamePOIFilter;
|
||||||
private PoiUIFilter customPOIFilter;
|
private PoiUIFilter customPOIFilter;
|
||||||
private PoiUIFilter showAllPOIFilter;
|
private PoiUIFilter showAllPOIFilter;
|
||||||
private PoiUIFilter localWikiPoiFilter;
|
|
||||||
private PoiUIFilter topWikiPoiFilter;
|
private PoiUIFilter topWikiPoiFilter;
|
||||||
private List<PoiUIFilter> cacheTopStandardFilters;
|
private List<PoiUIFilter> cacheTopStandardFilters;
|
||||||
private Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>();
|
private Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>();
|
||||||
|
@ -120,20 +119,6 @@ public class PoiFiltersHelper {
|
||||||
return customPOIFilter;
|
return customPOIFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PoiUIFilter getLocalWikiPOIFilter() {
|
|
||||||
if (localWikiPoiFilter == null) {
|
|
||||||
PoiType place = application.getPoiTypes().getPoiTypeByKey(WIKI_PLACE);
|
|
||||||
if (place != null && !Algorithms.isEmpty(application.getLanguage())) {
|
|
||||||
PoiUIFilter filter = new PoiUIFilter(place, application, " " +
|
|
||||||
application.getLangTranslation(application.getLanguage()));
|
|
||||||
filter.setSavedFilterByName("wiki:lang:" + application.getLanguage());
|
|
||||||
filter.setStandardFilter(true);
|
|
||||||
localWikiPoiFilter = filter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return localWikiPoiFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void prepareTopWikiFilter(@NonNull PoiUIFilter wiki) {
|
public void prepareTopWikiFilter(@NonNull PoiUIFilter wiki) {
|
||||||
boolean prepareByDefault = true;
|
boolean prepareByDefault = true;
|
||||||
Bundle wikiSettings = WikipediaPoiMenu.getWikiPoiSettings(application);
|
Bundle wikiSettings = WikipediaPoiMenu.getWikiPoiSettings(application);
|
||||||
|
@ -217,8 +202,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PoiUIFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(),
|
PoiUIFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(),
|
||||||
getTopWikiPoiFilter(), getLocalWikiPOIFilter(), getShowAllPOIFilter(),
|
getTopWikiPoiFilter(), getShowAllPOIFilter(), getNominatimPOIFilter(), getNominatimAddressFilter());
|
||||||
getNominatimPOIFilter(), getNominatimAddressFilter());
|
|
||||||
if (ff != null) {
|
if (ff != null) {
|
||||||
return ff;
|
return ff;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +211,7 @@ public class PoiFiltersHelper {
|
||||||
AbstractPoiType tp = application.getPoiTypes().getAnyPoiTypeByKey(typeId);
|
AbstractPoiType tp = application.getPoiTypes().getAnyPoiTypeByKey(typeId);
|
||||||
if (tp != null) {
|
if (tp != null) {
|
||||||
PoiUIFilter lf = new PoiUIFilter(tp, application, "");
|
PoiUIFilter lf = new PoiUIFilter(tp, application, "");
|
||||||
ArrayList<PoiUIFilter> copy = new ArrayList<>(cacheTopStandardFilters);
|
ArrayList<PoiUIFilter> copy = cacheTopStandardFilters != null ? new ArrayList<>(cacheTopStandardFilters) : new ArrayList<PoiUIFilter>();
|
||||||
copy.add(lf);
|
copy.add(lf);
|
||||||
cacheTopStandardFilters = copy;
|
cacheTopStandardFilters = copy;
|
||||||
return lf;
|
return lf;
|
||||||
|
@ -235,7 +219,7 @@ public class PoiFiltersHelper {
|
||||||
AbstractPoiType lt = application.getPoiTypes().getAnyPoiAdditionalTypeByKey(typeId);
|
AbstractPoiType lt = application.getPoiTypes().getAnyPoiAdditionalTypeByKey(typeId);
|
||||||
if (lt != null) {
|
if (lt != null) {
|
||||||
PoiUIFilter lf = new PoiUIFilter(lt, application, "");
|
PoiUIFilter lf = new PoiUIFilter(lt, application, "");
|
||||||
ArrayList<PoiUIFilter> copy = new ArrayList<>(cacheTopStandardFilters);
|
ArrayList<PoiUIFilter> copy = cacheTopStandardFilters != null ? new ArrayList<>(cacheTopStandardFilters) : new ArrayList<PoiUIFilter>();
|
||||||
copy.add(lf);
|
copy.add(lf);
|
||||||
cacheTopStandardFilters = copy;
|
cacheTopStandardFilters = copy;
|
||||||
return lf;
|
return lf;
|
||||||
|
@ -279,23 +263,21 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PoiUIFilter> getTopDefinedPoiFilters(boolean includeDeleted) {
|
public List<PoiUIFilter> getTopDefinedPoiFilters(boolean includeDeleted) {
|
||||||
if (cacheTopStandardFilters == null) {
|
List<PoiUIFilter> top = this.cacheTopStandardFilters;
|
||||||
List<PoiUIFilter> top = new ArrayList<>();
|
if (top == null) {
|
||||||
|
top = new ArrayList<>();
|
||||||
// user defined
|
// user defined
|
||||||
top.addAll(getUserDefinedPoiFilters(true));
|
top.addAll(getUserDefinedPoiFilters(true));
|
||||||
if (getLocalWikiPOIFilter() != null) {
|
|
||||||
top.add(getLocalWikiPOIFilter());
|
|
||||||
}
|
|
||||||
// default
|
// default
|
||||||
MapPoiTypes poiTypes = application.getPoiTypes();
|
MapPoiTypes poiTypes = application.getPoiTypes();
|
||||||
for (AbstractPoiType t : poiTypes.getTopVisibleFilters()) {
|
for (AbstractPoiType t : poiTypes.getTopVisibleFilters()) {
|
||||||
PoiUIFilter f = new PoiUIFilter(t, application, "");
|
PoiUIFilter f = new PoiUIFilter(t, application, "");
|
||||||
top.add(f);
|
top.add(f);
|
||||||
}
|
}
|
||||||
cacheTopStandardFilters = top;
|
this.cacheTopStandardFilters = top;
|
||||||
}
|
}
|
||||||
List<PoiUIFilter> result = new ArrayList<>();
|
List<PoiUIFilter> result = new ArrayList<>();
|
||||||
for (PoiUIFilter filter : cacheTopStandardFilters) {
|
for (PoiUIFilter filter : top) {
|
||||||
if (includeDeleted || !filter.isDeleted()) {
|
if (includeDeleted || !filter.isDeleted()) {
|
||||||
result.add(filter);
|
result.add(filter);
|
||||||
}
|
}
|
||||||
|
@ -462,7 +444,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
boolean res = helper.addFilter(filter, helper.getWritableDatabase(), false, forHistory);
|
boolean res = helper.addFilter(filter, helper.getWritableDatabase(), false, forHistory);
|
||||||
if (res) {
|
if (res) {
|
||||||
ArrayList<PoiUIFilter> copy = new ArrayList<>(cacheTopStandardFilters);
|
ArrayList<PoiUIFilter> copy = cacheTopStandardFilters != null ? new ArrayList<>(cacheTopStandardFilters) : new ArrayList<PoiUIFilter>();
|
||||||
copy.add(filter);
|
copy.add(filter);
|
||||||
Collections.sort(copy);
|
Collections.sort(copy);
|
||||||
cacheTopStandardFilters = copy;
|
cacheTopStandardFilters = copy;
|
||||||
|
@ -510,13 +492,17 @@ public class PoiFiltersHelper {
|
||||||
if (filter.isTopWikiFilter()) {
|
if (filter.isTopWikiFilter()) {
|
||||||
prepareTopWikiFilter(filter);
|
prepareTopWikiFilter(filter);
|
||||||
}
|
}
|
||||||
|
Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>(this.selectedPoiFilters);
|
||||||
selectedPoiFilters.add(filter);
|
selectedPoiFilters.add(filter);
|
||||||
saveSelectedPoiFilters();
|
saveSelectedPoiFilters(selectedPoiFilters);
|
||||||
|
this.selectedPoiFilters = selectedPoiFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSelectedPoiFilter(PoiUIFilter filter) {
|
public void removeSelectedPoiFilter(PoiUIFilter filter) {
|
||||||
|
Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>(this.selectedPoiFilters);
|
||||||
selectedPoiFilters.remove(filter);
|
selectedPoiFilters.remove(filter);
|
||||||
saveSelectedPoiFilters();
|
saveSelectedPoiFilters(selectedPoiFilters);
|
||||||
|
this.selectedPoiFilters = selectedPoiFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowingAnyPoi(PoiUIFilter ... filtersToExclude) {
|
public boolean isShowingAnyPoi(PoiUIFilter ... filtersToExclude) {
|
||||||
|
@ -524,6 +510,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearSelectedPoiFilters(PoiUIFilter ... filtersToExclude) {
|
public void clearSelectedPoiFilters(PoiUIFilter ... filtersToExclude) {
|
||||||
|
Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>(this.selectedPoiFilters);
|
||||||
if (filtersToExclude != null && filtersToExclude.length > 0) {
|
if (filtersToExclude != null && filtersToExclude.length > 0) {
|
||||||
Iterator<PoiUIFilter> it = selectedPoiFilters.iterator();
|
Iterator<PoiUIFilter> it = selectedPoiFilters.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -544,7 +531,8 @@ public class PoiFiltersHelper {
|
||||||
} else {
|
} else {
|
||||||
selectedPoiFilters.clear();
|
selectedPoiFilters.clear();
|
||||||
}
|
}
|
||||||
saveSelectedPoiFilters();
|
saveSelectedPoiFilters(selectedPoiFilters);
|
||||||
|
this.selectedPoiFilters = selectedPoiFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFiltersName(Set<PoiUIFilter> filters) {
|
public String getFiltersName(Set<PoiUIFilter> filters) {
|
||||||
|
@ -591,7 +579,7 @@ public class PoiFiltersHelper {
|
||||||
if(!application.getPoiTypes().isInit()) {
|
if(!application.getPoiTypes().isInit()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedPoiFilters = new TreeSet<>();
|
Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>();
|
||||||
for (String f : application.getSettings().getSelectedPoiFilters()) {
|
for (String f : application.getSettings().getSelectedPoiFilters()) {
|
||||||
PoiUIFilter filter = getFilterById(f);
|
PoiUIFilter filter = getFilterById(f);
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
|
@ -601,6 +589,7 @@ public class PoiFiltersHelper {
|
||||||
selectedPoiFilters.add(filter);
|
selectedPoiFilters.add(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.selectedPoiFilters = selectedPoiFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -630,7 +619,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveSelectedPoiFilters() {
|
private void saveSelectedPoiFilters(Set<PoiUIFilter> selectedPoiFilters) {
|
||||||
Set<String> filters = new HashSet<>();
|
Set<String> filters = new HashSet<>();
|
||||||
for (PoiUIFilter filter : selectedPoiFilters) {
|
for (PoiUIFilter filter : selectedPoiFilters) {
|
||||||
filters.add(filter.filterId);
|
filters.add(filter.filterId);
|
||||||
|
|
|
@ -4,7 +4,6 @@ package net.osmand.plus.poi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import net.osmand.CollatorStringMatcher;
|
import net.osmand.CollatorStringMatcher;
|
||||||
import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
||||||
|
@ -380,17 +379,23 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
|
|
||||||
private AmenityNameFilter getNameFilterInternal(StringBuilder nmFilter,
|
private AmenityNameFilter getNameFilterInternal(StringBuilder nmFilter,
|
||||||
final boolean allTime, final boolean open, final List<PoiType> poiAdditionals) {
|
final boolean allTime, final boolean open, final List<PoiType> poiAdditionals) {
|
||||||
final CollatorStringMatcher sm =
|
final CollatorStringMatcher sm = nmFilter.length() > 0 ?
|
||||||
nmFilter.length() > 0 ?
|
|
||||||
new CollatorStringMatcher(nmFilter.toString().trim(), StringMatcherMode.CHECK_CONTAINS) : null;
|
new CollatorStringMatcher(nmFilter.toString().trim(), StringMatcherMode.CHECK_CONTAINS) : null;
|
||||||
return new AmenityNameFilter() {
|
return new AmenityNameFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Amenity a) {
|
public boolean accept(Amenity a) {
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
String lower = OsmAndFormatter.getPoiStringWithoutType(a,
|
List<String> names = OsmAndFormatter.getPoiStringsWithoutType(a,
|
||||||
app.getSettings().MAP_PREFERRED_LOCALE.get(), app.getSettings().MAP_TRANSLITERATE_NAMES.get());
|
app.getSettings().MAP_PREFERRED_LOCALE.get(), app.getSettings().MAP_TRANSLITERATE_NAMES.get());
|
||||||
if (!sm.matches(lower)) {
|
boolean match = false;
|
||||||
|
for (String name : names) {
|
||||||
|
if (sm.matches(name)) {
|
||||||
|
match = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!match) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,13 @@ import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||||
|
@ -766,17 +768,28 @@ public class ResourceManager {
|
||||||
warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_big_for_memory), f.getName()));
|
warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_big_for_memory), f.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Map<PoiCategory, Map<String, PoiType>> toAddPoiTypes = new HashMap<>();
|
||||||
for (AmenityIndexRepository repo : amenityRepositories.values()) {
|
for (AmenityIndexRepository repo : amenityRepositories.values()) {
|
||||||
Map<String, List<String>> categories = ((AmenityIndexRepositoryBinary) repo).getDeltaPoiCategories();
|
Map<String, List<String>> categories = ((AmenityIndexRepositoryBinary) repo).getDeltaPoiCategories();
|
||||||
if (!categories.isEmpty()) {
|
if (!categories.isEmpty()) {
|
||||||
for (Map.Entry<String, List<String>> entry : categories.entrySet()) {
|
for (Map.Entry<String, List<String>> entry : categories.entrySet()) {
|
||||||
PoiCategory poiCategory = context.getPoiTypes().getPoiCategoryByName(entry.getKey(), true);
|
PoiCategory poiCategory = context.getPoiTypes().getPoiCategoryByName(entry.getKey(), true);
|
||||||
|
if (!toAddPoiTypes.containsKey(poiCategory)) {
|
||||||
|
toAddPoiTypes.put(poiCategory, new TreeMap<String, PoiType>());
|
||||||
|
}
|
||||||
|
Map<String, PoiType> poiTypes = toAddPoiTypes.get(poiCategory);
|
||||||
for (String s : entry.getValue()) {
|
for (String s : entry.getValue()) {
|
||||||
poiCategory.addPoiType(new PoiType(MapPoiTypes.getDefault(), poiCategory, null, s));
|
poiTypes.put(s, new PoiType(MapPoiTypes.getDefault(), poiCategory, null, s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Iterator<Entry<PoiCategory, Map<String, PoiType>>> it = toAddPoiTypes.entrySet().iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
Entry<PoiCategory, Map<String, PoiType>> next = it.next();
|
||||||
|
PoiCategory category = next.getKey();
|
||||||
|
category.addExtraPoiTypes(next.getValue());
|
||||||
|
}
|
||||||
log.debug("All map files initialized " + (System.currentTimeMillis() - val) + " ms");
|
log.debug("All map files initialized " + (System.currentTimeMillis() - val) + " ms");
|
||||||
if (files.size() > 0 && (!indCache.exists() || indCache.canWrite())) {
|
if (files.size() > 0 && (!indCache.exists() || indCache.canWrite())) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -68,14 +68,12 @@ import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.AppInitializer;
|
import net.osmand.plus.AppInitializer;
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.LockableViewPager;
|
import net.osmand.plus.LockableViewPager;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
@ -92,6 +90,8 @@ import net.osmand.plus.search.listitems.QuickSearchHeaderListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchListItem;
|
import net.osmand.plus.search.listitems.QuickSearchListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchMoreListItem;
|
import net.osmand.plus.search.listitems.QuickSearchMoreListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchMoreListItem.SearchMoreItemOnClickListener;
|
import net.osmand.plus.search.listitems.QuickSearchMoreListItem.SearchMoreItemOnClickListener;
|
||||||
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
import net.osmand.search.SearchUICore;
|
import net.osmand.search.SearchUICore;
|
||||||
|
@ -354,19 +354,18 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
} else if (searchPhrase.isNoSelectedType() || searchPhrase.isLastWord(POI_TYPE)) {
|
} else if (searchPhrase.isNoSelectedType() || searchPhrase.isLastWord(POI_TYPE)) {
|
||||||
PoiUIFilter filter;
|
PoiUIFilter filter;
|
||||||
if (searchPhrase.isNoSelectedType()) {
|
if (searchPhrase.isNoSelectedType()) {
|
||||||
|
AbstractPoiType uselectedPoiType = searchUICore.getUnselectedPoiType();
|
||||||
if (isOnlineSearch() && !Algorithms.isEmpty(searchPhrase.getFirstUnknownSearchWord())) {
|
if (isOnlineSearch() && !Algorithms.isEmpty(searchPhrase.getFirstUnknownSearchWord())) {
|
||||||
app.getPoiFilters().resetNominatimFilters();
|
app.getPoiFilters().resetNominatimFilters();
|
||||||
filter = app.getPoiFilters().getNominatimPOIFilter();
|
filter = app.getPoiFilters().getNominatimPOIFilter();
|
||||||
filter.setFilterByName(searchPhrase.getUnknownSearchPhrase());
|
filter.setFilterByName(searchPhrase.getUnknownSearchPhrase());
|
||||||
filter.clearCurrentResults();
|
filter.clearCurrentResults();
|
||||||
// TODO Alexey
|
} else if (uselectedPoiType != null) {
|
||||||
// } else if (searchPhrase.hasUnknownSearchWordPoiType()) {
|
filter = new PoiUIFilter(uselectedPoiType, app, "");
|
||||||
// AbstractPoiType pt = searchPhrase.getUnknownSearchWordPoiType();
|
String customName = searchUICore.getCustomNameFilter();
|
||||||
// filter = new PoiUIFilter(pt, app, "");
|
if (!Algorithms.isEmpty(customName)) {
|
||||||
// String customName = searchPhrase.getPoiNameFilter();
|
filter.setFilterByName(customName);
|
||||||
// if (!Algorithms.isEmpty(customName)) {
|
}
|
||||||
// filter.setFilterByName(customName);
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
filter = app.getPoiFilters().getSearchByNamePOIFilter();
|
filter = app.getPoiFilters().getSearchByNamePOIFilter();
|
||||||
if (!Algorithms.isEmpty(searchPhrase.getFirstUnknownSearchWord())) {
|
if (!Algorithms.isEmpty(searchPhrase.getFirstUnknownSearchWord())) {
|
||||||
|
@ -1249,7 +1248,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
@Override
|
@Override
|
||||||
public void onApplyPoiFiltersState(final ApplicationMode appMode, boolean stateChanged) {
|
public void onApplyPoiFiltersState(final ApplicationMode appMode, boolean stateChanged) {
|
||||||
if (stateChanged) {
|
if (stateChanged) {
|
||||||
searchHelper.refreshFilterOrders();
|
searchHelper.refreshCustomPoiFilters();
|
||||||
reloadCategoriesInternal();
|
reloadCategoriesInternal();
|
||||||
}
|
}
|
||||||
View containerView = getView();
|
View containerView = getView();
|
||||||
|
@ -1269,7 +1268,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
settings.POI_FILTERS_ORDER.setModeValue(mode, orders);
|
settings.POI_FILTERS_ORDER.setModeValue(mode, orders);
|
||||||
settings.INACTIVE_POI_FILTERS.setModeValue(mode, inactive);
|
settings.INACTIVE_POI_FILTERS.setModeValue(mode, inactive);
|
||||||
}
|
}
|
||||||
searchHelper.refreshFilterOrders();
|
searchHelper.refreshCustomPoiFilters();
|
||||||
reloadCategoriesInternal();
|
reloadCategoriesInternal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -111,15 +111,18 @@ public class QuickSearchHelper implements ResourceListener {
|
||||||
for (CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters(false)) {
|
for (CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters(false)) {
|
||||||
core.addCustomSearchPoiFilter(udf, 0);
|
core.addCustomSearchPoiFilter(udf, 0);
|
||||||
}
|
}
|
||||||
PoiUIFilter localWikiPoiFilter = poiFilters.getLocalWikiPOIFilter();
|
PoiUIFilter topWikiPoiFilter = poiFilters.getTopWikiPoiFilter();
|
||||||
if (localWikiPoiFilter != null) {
|
if (topWikiPoiFilter != null && topWikiPoiFilter.isActive()) {
|
||||||
core.addCustomSearchPoiFilter(localWikiPoiFilter, 1);
|
core.addCustomSearchPoiFilter(topWikiPoiFilter, 1);
|
||||||
|
}
|
||||||
|
PoiUIFilter showAllPOIFilter = poiFilters.getShowAllPOIFilter();
|
||||||
|
if (showAllPOIFilter != null && showAllPOIFilter.isActive()) {
|
||||||
|
core.addCustomSearchPoiFilter(showAllPOIFilter, 1);
|
||||||
}
|
}
|
||||||
core.addCustomSearchPoiFilter(poiFilters.getShowAllPOIFilter(), 1);
|
|
||||||
refreshFilterOrders();
|
refreshFilterOrders();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshFilterOrders() {
|
private void refreshFilterOrders() {
|
||||||
PoiFiltersHelper filtersHelper = app.getPoiFilters();
|
PoiFiltersHelper filtersHelper = app.getPoiFilters();
|
||||||
core.setActivePoiFiltersByOrder(filtersHelper.getPoiFilterOrders(true));
|
core.setActivePoiFiltersByOrder(filtersHelper.getPoiFilterOrders(true));
|
||||||
}
|
}
|
||||||
|
@ -201,7 +204,7 @@ public class QuickSearchHelper implements ResourceListener {
|
||||||
//sr.localeRelatedObjectName = app.getRegions().getCountryName(sr.location);
|
//sr.localeRelatedObjectName = app.getRegions().getCountryName(sr.location);
|
||||||
sr.relatedObject = selectedGpx.getGpxFile();
|
sr.relatedObject = selectedGpx.getGpxFile();
|
||||||
sr.preferredZoom = 17;
|
sr.preferredZoom = 17;
|
||||||
if (phrase.getFirstUnknownSearchWord().length() <= 1 && phrase.isNoSelectedType()) {
|
if (phrase.getFullSearchPhrase().length() <= 1 && phrase.isNoSelectedType()) {
|
||||||
resultMatcher.publish(sr);
|
resultMatcher.publish(sr);
|
||||||
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
||||||
resultMatcher.publish(sr);
|
resultMatcher.publish(sr);
|
||||||
|
@ -313,7 +316,7 @@ public class QuickSearchHelper implements ResourceListener {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (phrase.getFirstUnknownSearchWord().length() <= 1
|
if (phrase.getFullSearchPhrase().length() <= 1
|
||||||
&& (phrase.isNoSelectedType() || phrase.isLastWord(ObjectType.FAVORITE_GROUP))) {
|
&& (phrase.isNoSelectedType() || phrase.isLastWord(ObjectType.FAVORITE_GROUP))) {
|
||||||
resultMatcher.publish(sr);
|
resultMatcher.publish(sr);
|
||||||
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
||||||
|
@ -457,7 +460,7 @@ public class QuickSearchHelper implements ResourceListener {
|
||||||
}
|
}
|
||||||
if (publish) {
|
if (publish) {
|
||||||
sr.priority = SEARCH_HISTORY_OBJECT_PRIORITY + (p++);
|
sr.priority = SEARCH_HISTORY_OBJECT_PRIORITY + (p++);
|
||||||
if (phrase.getFirstUnknownSearchWord().length() <= 1 && phrase.isNoSelectedType()) {
|
if (phrase.getFullSearchPhrase().length() <= 1 && phrase.isNoSelectedType()) {
|
||||||
resultMatcher.publish(sr);
|
resultMatcher.publish(sr);
|
||||||
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
|
||||||
resultMatcher.publish(sr);
|
resultMatcher.publish(sr);
|
||||||
|
|
|
@ -57,8 +57,8 @@ public class VehicleParametersBottomSheet extends BasePreferenceBottomSheet {
|
||||||
VehicleSizeAssets vehicleSizeAssets = VehicleSizeAssets.getAssets(parameterName);
|
VehicleSizeAssets vehicleSizeAssets = VehicleSizeAssets.getAssets(parameterName);
|
||||||
if (vehicleSizeAssets != null) {
|
if (vehicleSizeAssets != null) {
|
||||||
ImageView imageView = mainView.findViewById(R.id.image_view);
|
ImageView imageView = mainView.findViewById(R.id.image_view);
|
||||||
imageView.setImageDrawable(ContextCompat.getDrawable(app,
|
imageView.setImageDrawable(app.getUIUtilities()
|
||||||
!nightMode ? vehicleSizeAssets.getDayIconId() : vehicleSizeAssets.getNightIconId()));
|
.getIcon(!nightMode ? vehicleSizeAssets.getDayIconId() : vehicleSizeAssets.getNightIconId()));
|
||||||
TextView description = mainView.findViewById(R.id.description);
|
TextView description = mainView.findViewById(R.id.description);
|
||||||
description.setText(app.getString(vehicleSizeAssets.getDescriptionRes()));
|
description.setText(app.getString(vehicleSizeAssets.getDescriptionRes()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.osmand.plus.settings.bottomsheets.VehicleSizeAssets;
|
||||||
public class SizePreference extends DialogPreference {
|
public class SizePreference extends DialogPreference {
|
||||||
|
|
||||||
private String[] entries;
|
private String[] entries;
|
||||||
private Object[] entryValues;
|
private String[] entryValues;
|
||||||
private String description;
|
private String description;
|
||||||
private VehicleSizeAssets assets;
|
private VehicleSizeAssets assets;
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ public class SizePreference extends DialogPreference {
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getEntryValues() {
|
public String[] getEntryValues() {
|
||||||
return entryValues;
|
return entryValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntryValues(Object[] entryValues) {
|
public void setEntryValues(String[] entryValues) {
|
||||||
this.entryValues = entryValues;
|
this.entryValues = entryValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,11 @@ public class SizePreference extends DialogPreference {
|
||||||
String[] entries = getEntries();
|
String[] entries = getEntries();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
if (entries[i].equals(item)) {
|
if (entries[i].equals(item)) {
|
||||||
return Float.parseFloat(getEntryValues()[i].toString());
|
try {
|
||||||
|
return Float.parseFloat(entryValues[i]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
@ -77,12 +81,18 @@ public class SizePreference extends DialogPreference {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getSummary() {
|
public CharSequence getSummary() {
|
||||||
|
String summary = "-";
|
||||||
String persistedString = getValue();
|
String persistedString = getValue();
|
||||||
if (!persistedString.equals(defaultValue)) {
|
if (!persistedString.equals(defaultValue)) {
|
||||||
|
try {
|
||||||
persistedString = String.valueOf(Float.parseFloat(persistedString) + 0.01f);
|
persistedString = String.valueOf(Float.parseFloat(persistedString) + 0.01f);
|
||||||
return String.format(getContext().getString(R.string.ltr_or_rtl_combine_via_space), persistedString, getContext().getString(assets.getMetricShortRes()));
|
summary = String.format(getContext().getString(R.string.ltr_or_rtl_combine_via_space),
|
||||||
|
persistedString, getContext().getString(assets.getMetricShortRes()));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
summary = "-";
|
||||||
}
|
}
|
||||||
return "-";
|
}
|
||||||
|
return summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
|
|
|
@ -236,9 +236,9 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
if (contourLinesProp != null) {
|
if (contourLinesProp != null) {
|
||||||
final OsmandSettings.CommonPreference<String> pref = app.getSettings().getCustomRenderProperty(contourLinesProp.getAttrName());
|
final OsmandSettings.CommonPreference<String> pref = app.getSettings().getCustomRenderProperty(contourLinesProp.getAttrName());
|
||||||
if (!Algorithms.isEmpty(pref.get())) {
|
if (!Algorithms.isEmpty(pref.get())) {
|
||||||
contourLinesEnabled = !pref.get().equals(CONTOUR_LINES_DISABLED_VALUE);
|
contourLinesEnabled = !CONTOUR_LINES_DISABLED_VALUE.equals(pref.get());
|
||||||
} else {
|
} else {
|
||||||
contourLinesEnabled = !contourLinesProp.getDefaultValueDescription().equals(CONTOUR_LINES_DISABLED_VALUE);
|
contourLinesEnabled = !CONTOUR_LINES_DISABLED_VALUE.equals(contourLinesProp.getDefaultValueDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return contourLinesEnabled;
|
return contourLinesEnabled;
|
||||||
|
|
|
@ -1,28 +1,5 @@
|
||||||
package net.osmand.plus.srtmplugin;
|
package net.osmand.plus.srtmplugin;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.osmand.IndexConstants;
|
|
||||||
import net.osmand.PlatformUtil;
|
|
||||||
import net.osmand.data.QuadRect;
|
|
||||||
import net.osmand.data.QuadTree;
|
|
||||||
import net.osmand.data.RotatedTileBox;
|
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.TerrainMode;
|
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
|
||||||
import net.osmand.plus.views.MapTileLayer;
|
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
@ -31,6 +8,29 @@ import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
|
import net.osmand.IndexConstants;
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.data.QuadRect;
|
||||||
|
import net.osmand.data.QuadTree;
|
||||||
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings.TerrainMode;
|
||||||
|
import net.osmand.plus.views.MapTileLayer;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static net.osmand.plus.settings.backend.OsmandSettings.TerrainMode.HILLSHADE;
|
import static net.osmand.plus.settings.backend.OsmandSettings.TerrainMode.HILLSHADE;
|
||||||
|
|
||||||
public class TerrainLayer extends MapTileLayer {
|
public class TerrainLayer extends MapTileLayer {
|
||||||
|
@ -88,8 +88,8 @@ public class TerrainLayer extends MapTileLayer {
|
||||||
| SQLiteDatabase.CREATE_IF_NECESSARY );
|
| SQLiteDatabase.CREATE_IF_NECESSARY );
|
||||||
if (sqliteDb.getVersion() == 0) {
|
if (sqliteDb.getVersion() == 0) {
|
||||||
sqliteDb.setVersion(1);
|
sqliteDb.setVersion(1);
|
||||||
sqliteDb.execSQL("CREATE TABLE TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)");
|
|
||||||
}
|
}
|
||||||
|
sqliteDb.execSQL("CREATE TABLE IF NOT EXISTS TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)");
|
||||||
|
|
||||||
Map<String, Long> fileModified = new HashMap<String, Long>();
|
Map<String, Long> fileModified = new HashMap<String, Long>();
|
||||||
Map<String, SQLiteTileSource> rs = readFiles(app, tilesDir, fileModified);
|
Map<String, SQLiteTileSource> rs = readFiles(app, tilesDir, fileModified);
|
||||||
|
|
Loading…
Reference in a new issue