Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d6da184b8c
27 changed files with 195 additions and 155 deletions
|
@ -48,8 +48,6 @@ public class MapPoiTypes {
|
||||||
if (name.equals("category")) { //$NON-NLS-1$
|
if (name.equals("category")) { //$NON-NLS-1$
|
||||||
parentCategory = parser.getAttributeValue("","name");
|
parentCategory = parser.getAttributeValue("","name");
|
||||||
poiParentCategory = parser.getAttributeValue("","poi_category");
|
poiParentCategory = parser.getAttributeValue("","poi_category");
|
||||||
poiParentPrefix = parser.getAttributeValue("","poi_prefix");
|
|
||||||
order = parser.getAttributeValue("","order");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,4 +67,8 @@ public class MapPoiTypes {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
getDefault() ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
21
OsmAnd-java/src/net/osmand/osm/PoiCategory.java
Normal file
21
OsmAnd-java/src/net/osmand/osm/PoiCategory.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package net.osmand.osm;
|
||||||
|
|
||||||
|
public class PoiCategory {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String translationName;
|
||||||
|
private MapPoiTypes poiTypes;
|
||||||
|
|
||||||
|
public PoiCategory(MapPoiTypes poiTypes){
|
||||||
|
this.poiTypes = poiTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTranslationName() {
|
||||||
|
return translationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
23
OsmAnd-java/src/net/osmand/osm/PoiType.java
Normal file
23
OsmAnd-java/src/net/osmand/osm/PoiType.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package net.osmand.osm;
|
||||||
|
|
||||||
|
public class PoiType {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String translationName;
|
||||||
|
private MapPoiTypes poiTypes;
|
||||||
|
private PoiCategory category;
|
||||||
|
|
||||||
|
public PoiType(MapPoiTypes poiTypes, PoiCategory category){
|
||||||
|
this.poiTypes = poiTypes;
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTranslationName() {
|
||||||
|
return translationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
android:versionCode="201"
|
android:versionCode="201"
|
||||||
package="net.osmand.plus">
|
package="net.osmand.plus">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
|
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="21" />
|
||||||
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
|
|
@ -30,6 +30,7 @@ import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.monitoring.LiveMonitoringHelper;
|
import net.osmand.plus.monitoring.LiveMonitoringHelper;
|
||||||
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
|
|
|
@ -20,12 +20,12 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.osm.MapRenderingTypes;
|
import net.osmand.osm.MapRenderingTypes;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.PoiFiltersHelper;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SpecialPhrases;
|
import net.osmand.plus.SpecialPhrases;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.activities.search.SearchPOIActivity;
|
import net.osmand.plus.activities.search.SearchPOIActivity;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -39,7 +39,7 @@ import android.widget.LinearLayout.LayoutParams;
|
||||||
*/
|
*/
|
||||||
public class EditPOIFilterActivity extends OsmandListActivity {
|
public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
public static final String AMENITY_FILTER = "net.osmand.amenity_filter"; //$NON-NLS-1$
|
public static final String AMENITY_FILTER = "net.osmand.amenity_filter"; //$NON-NLS-1$
|
||||||
private PoiFilter filter;
|
private PoiLegacyFilter filter;
|
||||||
private PoiFiltersHelper helper;
|
private PoiFiltersHelper helper;
|
||||||
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT; //$NON-NLS-1$
|
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT; //$NON-NLS-1$
|
||||||
public static final String SEARCH_LON = SearchActivity.SEARCH_LON; //$NON-NLS-1$
|
public static final String SEARCH_LON = SearchActivity.SEARCH_LON; //$NON-NLS-1$
|
||||||
|
@ -153,7 +153,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
PoiFilter nFilter = new PoiFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), (OsmandApplication) getApplication());
|
PoiLegacyFilter nFilter = new PoiLegacyFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), (OsmandApplication) getApplication());
|
||||||
if (helper.createPoiFilter(nFilter)) {
|
if (helper.createPoiFilter(nFilter)) {
|
||||||
AccessibleToast.makeText(
|
AccessibleToast.makeText(
|
||||||
EditPOIFilterActivity.this,
|
EditPOIFilterActivity.this,
|
||||||
|
|
|
@ -31,11 +31,11 @@ public class HelpActivity extends ActionBarActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
getMyApplication().applyTheme(this);
|
getMyApplication().applyTheme(this);
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
|
getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
|
||||||
}
|
}
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
wv = new WebView(this);
|
wv = new WebView(this);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
String title = getString(R.string.help);
|
String title = getString(R.string.help);
|
||||||
|
|
|
@ -27,7 +27,6 @@ import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
@ -37,6 +36,7 @@ import net.osmand.plus.base.FailSafeFuntions;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.helpers.GpxImportHelper;
|
import net.osmand.plus.helpers.GpxImportHelper;
|
||||||
import net.osmand.plus.helpers.WakeLockHelper;
|
import net.osmand.plus.helpers.WakeLockHelper;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -336,9 +336,9 @@ public class MapActivity extends AccessibleActivity {
|
||||||
updateApplicationModeSettings();
|
updateApplicationModeSettings();
|
||||||
|
|
||||||
String filterId = settings.getPoiFilterForMap();
|
String filterId = settings.getPoiFilterForMap();
|
||||||
PoiFilter poiFilter = app.getPoiFilters().getFilterById(filterId);
|
PoiLegacyFilter poiFilter = app.getPoiFilters().getFilterById(filterId);
|
||||||
if (poiFilter == null) {
|
if (poiFilter == null) {
|
||||||
poiFilter = new PoiFilter(null, app);
|
poiFilter = new PoiLegacyFilter(null, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
mapLayers.getPoiMapLayer().setFilter(poiFilter);
|
mapLayers.getPoiMapLayer().setFilter(poiFilter);
|
||||||
|
|
|
@ -22,11 +22,11 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.PoiFiltersHelper;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.render.MapVectorLayer;
|
import net.osmand.plus.render.MapVectorLayer;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
|
@ -259,8 +259,8 @@ public class MapActivityLayers {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiFilter[] selected){
|
public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiLegacyFilter[] selected){
|
||||||
final List<PoiFilter> userDefined = new ArrayList<PoiFilter>();
|
final List<PoiLegacyFilter> userDefined = new ArrayList<PoiLegacyFilter>();
|
||||||
OsmandApplication app = (OsmandApplication)getApplication();
|
OsmandApplication app = (OsmandApplication)getApplication();
|
||||||
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
||||||
|
@ -273,7 +273,7 @@ public class MapActivityLayers {
|
||||||
// 2nd custom
|
// 2nd custom
|
||||||
adapter.item(getString(R.string.poi_filter_custom_filter)).icon(RenderingIcons.getBigIconResourceId("user_defined")).reg();
|
adapter.item(getString(R.string.poi_filter_custom_filter)).icon(RenderingIcons.getBigIconResourceId("user_defined")).reg();
|
||||||
|
|
||||||
for (PoiFilter f : poiFilters.getUserDefinedPoiFilters()) {
|
for (PoiLegacyFilter f : poiFilters.getUserDefinedPoiFilters()) {
|
||||||
Item it = adapter.item(f.getName());
|
Item it = adapter.item(f.getName());
|
||||||
if (RenderingIcons.containsBigIcon(f.getSimplifiedId())) {
|
if (RenderingIcons.containsBigIcon(f.getSimplifiedId())) {
|
||||||
it.icon(RenderingIcons.getBigIconResourceId(f.getSimplifiedId()));
|
it.icon(RenderingIcons.getBigIconResourceId(f.getSimplifiedId()));
|
||||||
|
@ -298,7 +298,7 @@ public class MapActivityLayers {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if(which == 1){
|
if(which == 1){
|
||||||
String filterId = PoiFilter.CUSTOM_FILTER_ID;
|
String filterId = PoiLegacyFilter.CUSTOM_FILTER_ID;
|
||||||
getApplication().getSettings().setPoiFilterForMap(filterId);
|
getApplication().getSettings().setPoiFilterForMap(filterId);
|
||||||
Intent newIntent = new Intent(activity, EditPOIFilterActivity.class);
|
Intent newIntent = new Intent(activity, EditPOIFilterActivity.class);
|
||||||
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, filterId);
|
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, filterId);
|
||||||
|
@ -315,7 +315,7 @@ public class MapActivityLayers {
|
||||||
filterId = PoiFiltersHelper.getOsmDefinedFilterId(categories[which - userDefined.size() - 2]);
|
filterId = PoiFiltersHelper.getOsmDefinedFilterId(categories[which - userDefined.size() - 2]);
|
||||||
}
|
}
|
||||||
getApplication().getSettings().setPoiFilterForMap(filterId);
|
getApplication().getSettings().setPoiFilterForMap(filterId);
|
||||||
PoiFilter f = poiFilters.getFilterById(filterId);
|
PoiLegacyFilter f = poiFilters.getFilterById(filterId);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
f.clearNameFilter();
|
f.clearNameFilter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,21 +30,21 @@ import net.osmand.osm.MapRenderingTypes;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuAdapter.Item;
|
import net.osmand.plus.ContextMenuAdapter.Item;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.NameFinderPoiFilter;
|
|
||||||
import net.osmand.plus.OsmAndConstants;
|
import net.osmand.plus.OsmAndConstants;
|
||||||
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.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SearchByNameFilter;
|
|
||||||
import net.osmand.plus.activities.EditPOIFilterActivity;
|
import net.osmand.plus.activities.EditPOIFilterActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivityActions;
|
import net.osmand.plus.activities.MapActivityActions;
|
||||||
import net.osmand.plus.activities.OsmandListActivity;
|
import net.osmand.plus.activities.OsmandListActivity;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
|
import net.osmand.plus.poi.NameFinderPoiFilter;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
|
import net.osmand.plus.poi.SearchByNameFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.views.DirectionDrawable;
|
import net.osmand.plus.views.DirectionDrawable;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -92,7 +92,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
private static final int ORIENTATION_270 = 1;
|
private static final int ORIENTATION_270 = 1;
|
||||||
private static final int ORIENTATION_180 = 2;
|
private static final int ORIENTATION_180 = 2;
|
||||||
|
|
||||||
private PoiFilter filter;
|
private PoiLegacyFilter filter;
|
||||||
private AmenityAdapter amenityAdapter;
|
private AmenityAdapter amenityAdapter;
|
||||||
private EditText searchFilter;
|
private EditText searchFilter;
|
||||||
private View searchFilterLayout;
|
private View searchFilterLayout;
|
||||||
|
@ -140,7 +140,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
if(isSearchByNameFilter()){
|
if(isSearchByNameFilter()){
|
||||||
Intent newIntent = new Intent(SearchPOIActivity.this, EditPOIFilterActivity.class);
|
Intent newIntent = new Intent(SearchPOIActivity.this, EditPOIFilterActivity.class);
|
||||||
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, PoiFilter.CUSTOM_FILTER_ID);
|
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, PoiLegacyFilter.CUSTOM_FILTER_ID);
|
||||||
if(location != null) {
|
if(location != null) {
|
||||||
newIntent.putExtra(EditPOIFilterActivity.SEARCH_LAT, location.getLatitude());
|
newIntent.putExtra(EditPOIFilterActivity.SEARCH_LAT, location.getLatitude());
|
||||||
newIntent.putExtra(EditPOIFilterActivity.SEARCH_LON, location.getLongitude());
|
newIntent.putExtra(EditPOIFilterActivity.SEARCH_LON, location.getLongitude());
|
||||||
|
@ -300,7 +300,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
|
|
||||||
|
|
||||||
String filterId = bundle.getString(AMENITY_FILTER);
|
String filterId = bundle.getString(AMENITY_FILTER);
|
||||||
PoiFilter filter = app.getPoiFilters().getFilterById(filterId);
|
PoiLegacyFilter filter = app.getPoiFilters().getFilterById(filterId);
|
||||||
if (filter != this.filter) {
|
if (filter != this.filter) {
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
|
@ -358,7 +358,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
if(loc != null){
|
if(loc != null){
|
||||||
Map<AmenityType, List<String>> map = app.getResourceManager().searchAmenityCategoriesByName(query, loc.getLatitude(), loc.getLongitude());
|
Map<AmenityType, List<String>> map = app.getResourceManager().searchAmenityCategoriesByName(query, loc.getLatitude(), loc.getLongitude());
|
||||||
if(!map.isEmpty()){
|
if(!map.isEmpty()){
|
||||||
PoiFilter filter = ((OsmandApplication)getApplication()).getPoiFilters().getFilterById(PoiFilter.CUSTOM_FILTER_ID);
|
PoiLegacyFilter filter = ((OsmandApplication)getApplication()).getPoiFilters().getFilterById(PoiLegacyFilter.CUSTOM_FILTER_ID);
|
||||||
if(filter != null){
|
if(filter != null){
|
||||||
showFilterItem.setVisible(true);
|
showFilterItem.setVisible(true);
|
||||||
filter.setMapToAccept(map);
|
filter.setMapToAccept(map);
|
||||||
|
@ -451,7 +451,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSearchByNameFilter(){
|
public boolean isSearchByNameFilter(){
|
||||||
return filter != null && PoiFilter.BY_NAME_FILTER_ID.equals(filter.getFilterId());
|
return filter != null && PoiLegacyFilter.BY_NAME_FILTER_ID.equals(filter.getFilterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,14 @@ import android.support.v7.app.ActionBarActivity;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.NameFinderPoiFilter;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.PoiFiltersHelper;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SearchByNameFilter;
|
|
||||||
import net.osmand.plus.activities.EditPOIFilterActivity;
|
import net.osmand.plus.activities.EditPOIFilterActivity;
|
||||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||||
|
import net.osmand.plus.poi.NameFinderPoiFilter;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
|
import net.osmand.plus.poi.SearchByNameFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -51,8 +51,8 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
||||||
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
||||||
PoiFilter poi = ((AmenityAdapter) getListAdapter()).getItem(pos);
|
PoiLegacyFilter poi = ((AmenityAdapter) getListAdapter()).getItem(pos);
|
||||||
if(!poi.isStandardFilter() || poi.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID)) {
|
if(!poi.isStandardFilter() || poi.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID)) {
|
||||||
showEditActivity(poi);
|
showEditActivity(poi);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
||||||
|
|
||||||
public void refreshPoiListAdapter() {
|
public void refreshPoiListAdapter() {
|
||||||
PoiFiltersHelper poiFilters = getApp().getPoiFilters();
|
PoiFiltersHelper poiFilters = getApp().getPoiFilters();
|
||||||
List<PoiFilter> filters = new ArrayList<PoiFilter>() ;
|
List<PoiLegacyFilter> filters = new ArrayList<PoiLegacyFilter>() ;
|
||||||
filters.addAll(poiFilters.getTopStandardFilters());
|
filters.addAll(poiFilters.getTopStandardFilters());
|
||||||
filters.addAll(poiFilters.getUserDefinedPoiFilters());
|
filters.addAll(poiFilters.getUserDefinedPoiFilters());
|
||||||
filters.addAll(poiFilters.getOsmDefinedPoiFilters());
|
filters.addAll(poiFilters.getOsmDefinedPoiFilters());
|
||||||
|
@ -95,7 +95,7 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showEditActivity(PoiFilter poi) {
|
private void showEditActivity(PoiLegacyFilter poi) {
|
||||||
Intent newIntent = new Intent(getActivity(), EditPOIFilterActivity.class);
|
Intent newIntent = new Intent(getActivity(), EditPOIFilterActivity.class);
|
||||||
// folder selected
|
// folder selected
|
||||||
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, poi.getFilterId());
|
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, poi.getFilterId());
|
||||||
|
@ -112,8 +112,8 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onListItemClick(ListView parent, View v, int position, long id) {
|
public void onListItemClick(ListView parent, View v, int position, long id) {
|
||||||
final PoiFilter filter = ((AmenityAdapter) getListAdapter()).getItem(position);
|
final PoiLegacyFilter filter = ((AmenityAdapter) getListAdapter()).getItem(position);
|
||||||
if (filter.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID)) {
|
if (filter.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID)) {
|
||||||
filter.clearFilter();
|
filter.clearFilter();
|
||||||
showEditActivity(filter);
|
showEditActivity(filter);
|
||||||
return;
|
return;
|
||||||
|
@ -133,8 +133,8 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AmenityAdapter extends ArrayAdapter<PoiFilter> {
|
class AmenityAdapter extends ArrayAdapter<PoiLegacyFilter> {
|
||||||
AmenityAdapter(List<PoiFilter> list) {
|
AmenityAdapter(List<PoiLegacyFilter> list) {
|
||||||
super(getActivity(), R.layout.searchpoifolder_list, list);
|
super(getActivity(), R.layout.searchpoifolder_list, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,11 +147,11 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
||||||
}
|
}
|
||||||
TextView label = (TextView) row.findViewById(R.id.folder_label);
|
TextView label = (TextView) row.findViewById(R.id.folder_label);
|
||||||
ImageView icon = (ImageView) row.findViewById(R.id.folder_icon);
|
ImageView icon = (ImageView) row.findViewById(R.id.folder_icon);
|
||||||
final PoiFilter model = getItem(position);
|
final PoiLegacyFilter model = getItem(position);
|
||||||
label.setText(model.getName());
|
label.setText(model.getName());
|
||||||
if(model.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID)) {
|
if(model.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID)) {
|
||||||
icon.setImageResource(android.R.drawable.ic_input_get);
|
icon.setImageResource(android.R.drawable.ic_input_get);
|
||||||
} else if (model.getFilterId().equals(PoiFilter.BY_NAME_FILTER_ID)) {
|
} else if (model.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID)) {
|
||||||
icon.setImageResource(android.R.drawable.ic_search_category_default);
|
icon.setImageResource(android.R.drawable.ic_search_category_default);
|
||||||
} else {
|
} else {
|
||||||
if(RenderingIcons.containsBigIcon(model.getSimplifiedId())) {
|
if(RenderingIcons.containsBigIcon(model.getSimplifiedId())) {
|
||||||
|
|
|
@ -15,11 +15,11 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
import net.osmand.plus.activities.SettingsActivity;
|
||||||
import net.osmand.plus.activities.TransportRouteHelper;
|
import net.osmand.plus.activities.TransportRouteHelper;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.render.RenderingRuleProperty;
|
import net.osmand.render.RenderingRuleProperty;
|
||||||
import net.osmand.render.RenderingRuleStorageProperties;
|
import net.osmand.render.RenderingRuleStorageProperties;
|
||||||
|
@ -149,7 +149,7 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void selectPOILayer(final OsmandSettings settings) {
|
protected void selectPOILayer(final OsmandSettings settings) {
|
||||||
final PoiFilter[] selected = new PoiFilter[1];
|
final PoiLegacyFilter[] selected = new PoiLegacyFilter[1];
|
||||||
AlertDialog dlg = ma.getMapLayers().selectPOIFilterLayer(ma.getMapView(), selected);
|
AlertDialog dlg = ma.getMapLayers().selectPOIFilterLayer(ma.getMapView(), selected);
|
||||||
dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
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.PoiFilter;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.IntermediatePointsDialog;
|
import net.osmand.plus.activities.IntermediatePointsDialog;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.MapControlsLayer;
|
import net.osmand.plus.views.MapControlsLayer;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
@ -485,7 +485,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
running[0] = position;
|
running[0] = position;
|
||||||
thisAdapter.notifyDataSetInvalidated();
|
thisAdapter.notifyDataSetInvalidated();
|
||||||
MapActivity map = (MapActivity) ctx;
|
MapActivity map = (MapActivity) ctx;
|
||||||
final PoiFilter[] selected = new PoiFilter[1];
|
final PoiLegacyFilter[] selected = new PoiLegacyFilter[1];
|
||||||
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
||||||
dlg.setOnDismissListener(new OnDismissListener() {
|
dlg.setOnDismissListener(new OnDismissListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -504,9 +504,9 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
private void selectPoi(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
|
private void selectPoi(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
|
||||||
final boolean enable, Activity ctx) {
|
final boolean enable, Activity ctx) {
|
||||||
if (ctx instanceof MapActivity &&
|
if (ctx instanceof MapActivity &&
|
||||||
!PoiFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
|
!PoiLegacyFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
|
||||||
MapActivity map = (MapActivity) ctx;
|
MapActivity map = (MapActivity) ctx;
|
||||||
final PoiFilter[] selected = new PoiFilter[1];
|
final PoiLegacyFilter[] selected = new PoiLegacyFilter[1];
|
||||||
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
||||||
dlg.setOnDismissListener(new OnDismissListener() {
|
dlg.setOnDismissListener(new OnDismissListener() {
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.IntermediatePointsDialog;
|
import net.osmand.plus.activities.IntermediatePointsDialog;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.routing.AlarmInfo;
|
import net.osmand.plus.routing.AlarmInfo;
|
||||||
import net.osmand.plus.routing.AlarmInfo.AlarmInfoType;
|
import net.osmand.plus.routing.AlarmInfo.AlarmInfoType;
|
||||||
|
@ -523,7 +523,7 @@ public class WaypointHelper {
|
||||||
|
|
||||||
|
|
||||||
protected void calculatePoi(RouteCalculationResult route, List<LocationPointWrapper> locationPoints) {
|
protected void calculatePoi(RouteCalculationResult route, List<LocationPointWrapper> locationPoints) {
|
||||||
PoiFilter pf = getPoiFilter();
|
PoiLegacyFilter pf = getPoiFilter();
|
||||||
if (pf != null) {
|
if (pf != null) {
|
||||||
final List<Location> locs = route.getImmutableAllLocations();
|
final List<Location> locs = route.getImmutableAllLocations();
|
||||||
List<Amenity> amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, poiSearchDeviationRadius,
|
List<Amenity> amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, poiSearchDeviationRadius,
|
||||||
|
@ -602,7 +602,7 @@ public class WaypointHelper {
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
public PoiFilter getPoiFilter() {
|
public PoiLegacyFilter getPoiFilter() {
|
||||||
return app.getPoiFilters().getFilterById(app.getSettings().getPoiFilterForMap());
|
return app.getPoiFilters().getFilterById(app.getSettings().getPoiFilterForMap());
|
||||||
}
|
}
|
||||||
public boolean showPOI() {
|
public boolean showPOI() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus;
|
package net.osmand.plus.poi;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -11,6 +11,9 @@ import net.osmand.PlatformUtil;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.R.string;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
import net.sf.junidecode.Junidecode;
|
import net.sf.junidecode.Junidecode;
|
||||||
|
|
||||||
|
@ -19,7 +22,7 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
|
||||||
public class NameFinderPoiFilter extends PoiFilter {
|
public class NameFinderPoiFilter extends PoiLegacyFilter {
|
||||||
|
|
||||||
public static final String FILTER_ID = "name_finder"; //$NON-NLS-1$
|
public static final String FILTER_ID = "name_finder"; //$NON-NLS-1$
|
||||||
private static final Log log = PlatformUtil.getLog(NameFinderPoiFilter.class);
|
private static final Log log = PlatformUtil.getLog(NameFinderPoiFilter.class);
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus;
|
package net.osmand.plus.poi;
|
||||||
|
|
||||||
|
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
@ -11,6 +11,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.R.string;
|
||||||
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;
|
||||||
|
@ -19,9 +22,9 @@ public class PoiFiltersHelper {
|
||||||
private final OsmandApplication application;
|
private final OsmandApplication application;
|
||||||
|
|
||||||
private NameFinderPoiFilter nameFinderPOIFilter;
|
private NameFinderPoiFilter nameFinderPOIFilter;
|
||||||
private List<PoiFilter> cacheTopStandardFilters;
|
private List<PoiLegacyFilter> cacheTopStandardFilters;
|
||||||
private List<PoiFilter> cacheUserDefinedFilters;
|
private List<PoiLegacyFilter> cacheUserDefinedFilters;
|
||||||
private List<PoiFilter> cacheOsmDefinedFilters;
|
private List<PoiLegacyFilter> cacheOsmDefinedFilters;
|
||||||
|
|
||||||
private static final String UDF_CAR_AID = "car_aid";
|
private static final String UDF_CAR_AID = "car_aid";
|
||||||
private static final String UDF_FOR_TOURISTS = "for_tourists";
|
private static final String UDF_FOR_TOURISTS = "for_tourists";
|
||||||
|
@ -48,9 +51,9 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PoiFilter findPoiFilter(String filterId, List<PoiFilter>... collections) {
|
private PoiLegacyFilter findPoiFilter(String filterId, List<PoiLegacyFilter>... collections) {
|
||||||
for(List<PoiFilter> c : collections) {
|
for(List<PoiLegacyFilter> c : collections) {
|
||||||
for(PoiFilter f : c) {
|
for(PoiLegacyFilter f : c) {
|
||||||
if(f.getFilterId().equals(filterId)){
|
if(f.getFilterId().equals(filterId)){
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +63,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public PoiFilter getFilterById(String filterId){
|
public PoiLegacyFilter getFilterById(String filterId){
|
||||||
if(filterId == null){
|
if(filterId == null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -80,25 +83,25 @@ public class PoiFiltersHelper {
|
||||||
types.put(tp, list);
|
types.put(tp, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PoiFilter> getUserDefinedDefaultFilters() {
|
private List<PoiLegacyFilter> getUserDefinedDefaultFilters() {
|
||||||
List<PoiFilter> filters = new ArrayList<PoiFilter>();
|
List<PoiLegacyFilter> filters = new ArrayList<PoiLegacyFilter>();
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_accomodation), PoiFilter.USER_PREFIX + UDF_ACCOMMODATION,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_accomodation), PoiLegacyFilter.USER_PREFIX + UDF_ACCOMMODATION,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_ACCOMMODATION), application));
|
configureDefaultUserDefinedFilter(null, UDF_ACCOMMODATION), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_car_aid), PoiFilter.USER_PREFIX + UDF_CAR_AID,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_car_aid), PoiLegacyFilter.USER_PREFIX + UDF_CAR_AID,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_CAR_AID), application));
|
configureDefaultUserDefinedFilter(null, UDF_CAR_AID), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_food_shop), PoiFilter.USER_PREFIX + UDF_FOOD_SHOP,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_food_shop), PoiLegacyFilter.USER_PREFIX + UDF_FOOD_SHOP,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_FOOD_SHOP), application));
|
configureDefaultUserDefinedFilter(null, UDF_FOOD_SHOP), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_for_tourists), PoiFilter.USER_PREFIX + UDF_FOR_TOURISTS,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_for_tourists), PoiLegacyFilter.USER_PREFIX + UDF_FOR_TOURISTS,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_FOR_TOURISTS), application));
|
configureDefaultUserDefinedFilter(null, UDF_FOR_TOURISTS), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_fuel), PoiFilter.USER_PREFIX + UDF_FUEL,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_fuel), PoiLegacyFilter.USER_PREFIX + UDF_FUEL,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_FUEL), application));
|
configureDefaultUserDefinedFilter(null, UDF_FUEL), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_parking), PoiFilter.USER_PREFIX + UDF_PARKING,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_parking), PoiLegacyFilter.USER_PREFIX + UDF_PARKING,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_PARKING), application));
|
configureDefaultUserDefinedFilter(null, UDF_PARKING), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_public_transport),
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_public_transport),
|
||||||
PoiFilter.USER_PREFIX + UDF_PUBLIC_TRANSPORT, configureDefaultUserDefinedFilter(null, UDF_PUBLIC_TRANSPORT), application));
|
PoiLegacyFilter.USER_PREFIX + UDF_PUBLIC_TRANSPORT, configureDefaultUserDefinedFilter(null, UDF_PUBLIC_TRANSPORT), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_restaurants), PoiFilter.USER_PREFIX + UDF_RESTAURANTS,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_restaurants), PoiLegacyFilter.USER_PREFIX + UDF_RESTAURANTS,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_RESTAURANTS), application));
|
configureDefaultUserDefinedFilter(null, UDF_RESTAURANTS), application));
|
||||||
filters.add(new PoiFilter(application.getString(R.string.poi_filter_sightseeing), PoiFilter.USER_PREFIX + UDF_SIGHTSEEING,
|
filters.add(new PoiLegacyFilter(application.getString(R.string.poi_filter_sightseeing), PoiLegacyFilter.USER_PREFIX + UDF_SIGHTSEEING,
|
||||||
configureDefaultUserDefinedFilter(null, UDF_SIGHTSEEING), application));
|
configureDefaultUserDefinedFilter(null, UDF_SIGHTSEEING), application));
|
||||||
// UDF_EMERGENCY = "emergency";
|
// UDF_EMERGENCY = "emergency";
|
||||||
// UDF_ENTERTAINMENT = "entertainment";
|
// UDF_ENTERTAINMENT = "entertainment";
|
||||||
|
@ -166,35 +169,35 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<PoiFilter> getUserDefinedPoiFilters(){
|
public List<PoiLegacyFilter> getUserDefinedPoiFilters(){
|
||||||
if(cacheUserDefinedFilters == null){
|
if(cacheUserDefinedFilters == null){
|
||||||
cacheUserDefinedFilters = new ArrayList<PoiFilter>();
|
cacheUserDefinedFilters = new ArrayList<PoiLegacyFilter>();
|
||||||
PoiFilterDbHelper helper = openDbHelper();
|
PoiFilterDbHelper helper = openDbHelper();
|
||||||
List<PoiFilter> userDefined = helper.getFilters(helper.getReadableDatabase());
|
List<PoiLegacyFilter> userDefined = helper.getFilters(helper.getReadableDatabase());
|
||||||
sortListOfFiltersByName(userDefined);
|
sortListOfFiltersByName(userDefined);
|
||||||
cacheUserDefinedFilters.addAll(userDefined);
|
cacheUserDefinedFilters.addAll(userDefined);
|
||||||
helper.close();
|
helper.close();
|
||||||
}
|
}
|
||||||
return Collections.unmodifiableList(cacheUserDefinedFilters);
|
return Collections.unmodifiableList(cacheUserDefinedFilters);
|
||||||
}
|
}
|
||||||
private void sortListOfFiltersByName(List<PoiFilter> userDefined) {
|
private void sortListOfFiltersByName(List<PoiLegacyFilter> userDefined) {
|
||||||
final Collator instance = Collator.getInstance();
|
final Collator instance = Collator.getInstance();
|
||||||
Collections.sort(userDefined, new Comparator<PoiFilter>() {
|
Collections.sort(userDefined, new Comparator<PoiLegacyFilter>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(PoiFilter object1, PoiFilter object2) {
|
public int compare(PoiLegacyFilter object1, PoiLegacyFilter object2) {
|
||||||
return instance.compare(object1.getName(), object2.getName());
|
return instance.compare(object1.getName(), object2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PoiFilter> getTopStandardFilters() {
|
public List<PoiLegacyFilter> getTopStandardFilters() {
|
||||||
if (cacheTopStandardFilters == null) {
|
if (cacheTopStandardFilters == null) {
|
||||||
cacheTopStandardFilters = new ArrayList<PoiFilter>();
|
cacheTopStandardFilters = new ArrayList<PoiLegacyFilter>();
|
||||||
PoiFilter filter = new PoiFilter(application.getString(R.string.poi_filter_custom_filter),
|
PoiLegacyFilter filter = new PoiLegacyFilter(application.getString(R.string.poi_filter_custom_filter),
|
||||||
PoiFilter.CUSTOM_FILTER_ID, new LinkedHashMap<AmenityType, LinkedHashSet<String>>(), application); //$NON-NLS-1$
|
PoiLegacyFilter.CUSTOM_FILTER_ID, new LinkedHashMap<AmenityType, LinkedHashSet<String>>(), application); //$NON-NLS-1$
|
||||||
filter.setStandardFilter(true);
|
filter.setStandardFilter(true);
|
||||||
cacheTopStandardFilters.add(filter);
|
cacheTopStandardFilters.add(filter);
|
||||||
cacheTopStandardFilters.add(new PoiFilter(null, application));
|
cacheTopStandardFilters.add(new PoiLegacyFilter(null, application));
|
||||||
filter = new SearchByNameFilter(application);
|
filter = new SearchByNameFilter(application);
|
||||||
filter.setStandardFilter(true);
|
filter.setStandardFilter(true);
|
||||||
cacheTopStandardFilters.add(filter);
|
cacheTopStandardFilters.add(filter);
|
||||||
|
@ -203,7 +206,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOsmDefinedFilterId(AmenityType t){
|
public static String getOsmDefinedFilterId(AmenityType t){
|
||||||
return PoiFilter.STD_PREFIX + t;
|
return PoiLegacyFilter.STD_PREFIX + t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFilters(boolean onlyAddFilters){
|
public void updateFilters(boolean onlyAddFilters){
|
||||||
|
@ -213,16 +216,16 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<PoiFilter> getOsmDefinedPoiFilters(){
|
public List<PoiLegacyFilter> getOsmDefinedPoiFilters(){
|
||||||
if(cacheOsmDefinedFilters == null){
|
if(cacheOsmDefinedFilters == null){
|
||||||
cacheOsmDefinedFilters = new ArrayList<PoiFilter>();
|
cacheOsmDefinedFilters = new ArrayList<PoiLegacyFilter>();
|
||||||
for(AmenityType t : AmenityType.getCategories()){
|
for(AmenityType t : AmenityType.getCategories()){
|
||||||
cacheOsmDefinedFilters.add(new PoiFilter(t, application));
|
cacheOsmDefinedFilters.add(new PoiLegacyFilter(t, application));
|
||||||
}
|
}
|
||||||
final Collator instance = Collator.getInstance();
|
final Collator instance = Collator.getInstance();
|
||||||
Collections.sort(cacheOsmDefinedFilters, new Comparator<PoiFilter>() {
|
Collections.sort(cacheOsmDefinedFilters, new Comparator<PoiLegacyFilter>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(PoiFilter object1, PoiFilter object2) {
|
public int compare(PoiLegacyFilter object1, PoiLegacyFilter object2) {
|
||||||
return instance.compare(object1.getName(), object2.getName());
|
return instance.compare(object1.getName(), object2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -234,10 +237,10 @@ public class PoiFiltersHelper {
|
||||||
return new PoiFilterDbHelper(application);
|
return new PoiFilterDbHelper(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removePoiFilter(PoiFilter filter){
|
public boolean removePoiFilter(PoiLegacyFilter filter){
|
||||||
if(filter.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID) ||
|
if(filter.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID) ||
|
||||||
filter.getFilterId().equals(PoiFilter.BY_NAME_FILTER_ID) ||
|
filter.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID) ||
|
||||||
filter.getFilterId().startsWith(PoiFilter.STD_PREFIX)){
|
filter.getFilterId().startsWith(PoiLegacyFilter.STD_PREFIX)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PoiFilterDbHelper helper = openDbHelper();
|
PoiFilterDbHelper helper = openDbHelper();
|
||||||
|
@ -252,7 +255,7 @@ public class PoiFiltersHelper {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean createPoiFilter(PoiFilter filter){
|
public boolean createPoiFilter(PoiLegacyFilter filter){
|
||||||
PoiFilterDbHelper helper = openDbHelper();
|
PoiFilterDbHelper helper = openDbHelper();
|
||||||
if(helper == null){
|
if(helper == null){
|
||||||
return false;
|
return false;
|
||||||
|
@ -268,9 +271,9 @@ public class PoiFiltersHelper {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean editPoiFilter(PoiFilter filter) {
|
public boolean editPoiFilter(PoiLegacyFilter filter) {
|
||||||
if (filter.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID) ||
|
if (filter.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID) ||
|
||||||
filter.getFilterId().equals(PoiFilter.BY_NAME_FILTER_ID) || filter.getFilterId().startsWith(PoiFilter.STD_PREFIX)) {
|
filter.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID) || filter.getFilterId().startsWith(PoiLegacyFilter.STD_PREFIX)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PoiFilterDbHelper helper = openDbHelper();
|
PoiFilterDbHelper helper = openDbHelper();
|
||||||
|
@ -348,11 +351,11 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upgradeFilters(SQLiteConnection conn, boolean onlyAdd) {
|
public void upgradeFilters(SQLiteConnection conn, boolean onlyAdd) {
|
||||||
List<PoiFilter> filters = PoiFilterDbHelper.this.getFilters(conn);
|
List<PoiLegacyFilter> filters = PoiFilterDbHelper.this.getFilters(conn);
|
||||||
List<PoiFilter> def = getUserDefinedDefaultFilters();
|
List<PoiLegacyFilter> def = getUserDefinedDefaultFilters();
|
||||||
for(PoiFilter f : filters){
|
for(PoiLegacyFilter f : filters){
|
||||||
PoiFilter std = null;
|
PoiLegacyFilter std = null;
|
||||||
for(PoiFilter d : def){
|
for(PoiLegacyFilter d : def){
|
||||||
if(f.getFilterId().equals(d.getFilterId())){
|
if(f.getFilterId().equals(d.getFilterId())){
|
||||||
std = d;
|
std = d;
|
||||||
break;
|
break;
|
||||||
|
@ -372,7 +375,7 @@ public class PoiFiltersHelper {
|
||||||
def.remove(std);
|
def.remove(std);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(PoiFilter d : def){
|
for(PoiLegacyFilter d : def){
|
||||||
addFilter(d, conn, false);
|
addFilter(d, conn, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,7 +389,7 @@ public class PoiFiltersHelper {
|
||||||
conn.setVersion(newVersion);
|
conn.setVersion(newVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean addFilter(PoiFilter p, SQLiteConnection db, boolean addOnlyCategories){
|
protected boolean addFilter(PoiLegacyFilter p, SQLiteConnection db, boolean addOnlyCategories){
|
||||||
if(db != null){
|
if(db != null){
|
||||||
if(!addOnlyCategories){
|
if(!addOnlyCategories){
|
||||||
db.execSQL("INSERT INTO " + FILTER_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getFilterId(), p.getFilterByName()}); //$NON-NLS-1$ //$NON-NLS-2$
|
db.execSQL("INSERT INTO " + FILTER_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getFilterId(), p.getFilterByName()}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -414,8 +417,8 @@ public class PoiFiltersHelper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<PoiFilter> getFilters(SQLiteConnection conn){
|
protected List<PoiLegacyFilter> getFilters(SQLiteConnection conn){
|
||||||
ArrayList<PoiFilter> list = new ArrayList<PoiFilter>();
|
ArrayList<PoiLegacyFilter> list = new ArrayList<PoiLegacyFilter>();
|
||||||
if(conn != null){
|
if(conn != null){
|
||||||
SQLiteCursor query = conn.rawQuery("SELECT " + CATEGORIES_FILTER_ID +", " + CATEGORIES_COL_CATEGORY +"," + CATEGORIES_COL_SUBCATEGORY +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
SQLiteCursor query = conn.rawQuery("SELECT " + CATEGORIES_FILTER_ID +", " + CATEGORIES_COL_CATEGORY +"," + CATEGORIES_COL_SUBCATEGORY +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
CATEGORIES_NAME, null);
|
CATEGORIES_NAME, null);
|
||||||
|
@ -447,7 +450,7 @@ public class PoiFiltersHelper {
|
||||||
do {
|
do {
|
||||||
String filterId = query.getString(0);
|
String filterId = query.getString(0);
|
||||||
if(map.containsKey(filterId)){
|
if(map.containsKey(filterId)){
|
||||||
PoiFilter filter = new PoiFilter(query.getString(1), filterId, map.get(filterId), application);
|
PoiLegacyFilter filter = new PoiLegacyFilter(query.getString(1), filterId, map.get(filterId), application);
|
||||||
filter.setFilterByName(query.getString(2));
|
filter.setFilterByName(query.getString(2));
|
||||||
list.add(filter);
|
list.add(filter);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +461,7 @@ public class PoiFiltersHelper {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean editFilter(SQLiteConnection conn, PoiFilter filter) {
|
protected boolean editFilter(SQLiteConnection conn, PoiLegacyFilter filter) {
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
conn.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " + CATEGORIES_FILTER_ID + " = ?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
conn.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " + CATEGORIES_FILTER_ID + " = ?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
new Object[] { filter.getFilterId() });
|
new Object[] { filter.getFilterId() });
|
||||||
|
@ -469,12 +472,12 @@ public class PoiFiltersHelper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(SQLiteConnection db, PoiFilter filter) {
|
private void updateName(SQLiteConnection db, PoiLegacyFilter filter) {
|
||||||
db.execSQL("UPDATE " + FILTER_NAME + " SET " + FILTER_COL_FILTERBYNAME + " = ?, " + FILTER_COL_NAME + " = ? " + " WHERE " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
db.execSQL("UPDATE " + FILTER_NAME + " SET " + FILTER_COL_FILTERBYNAME + " = ?, " + FILTER_COL_NAME + " = ? " + " WHERE " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||||
+ FILTER_COL_ID + "= ?", new Object[] { filter.getFilterByName(), filter.getName(), filter.getFilterId() }); //$NON-NLS-1$
|
+ FILTER_COL_ID + "= ?", new Object[] { filter.getFilterByName(), filter.getName(), filter.getFilterId() }); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean deleteFilter(SQLiteConnection db, PoiFilter p){
|
protected boolean deleteFilter(SQLiteConnection db, PoiLegacyFilter p){
|
||||||
if(db != null){
|
if(db != null){
|
||||||
db.execSQL("DELETE FROM " + FILTER_NAME + " WHERE " +FILTER_COL_ID + " = ?",new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
db.execSQL("DELETE FROM " + FILTER_NAME + " WHERE " +FILTER_COL_ID + " = ?",new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " +CATEGORIES_FILTER_ID + " = ?", new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " +CATEGORIES_FILTER_ID + " = ?", new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus;
|
package net.osmand.plus.poi;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -13,10 +13,13 @@ import net.osmand.IndexConstants;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class PoiFilter {
|
public class PoiLegacyFilter {
|
||||||
|
|
||||||
public final static String STD_PREFIX = "std_"; //$NON-NLS-1$
|
public final static String STD_PREFIX = "std_"; //$NON-NLS-1$
|
||||||
public final static String USER_PREFIX = "user_"; //$NON-NLS-1$
|
public final static String USER_PREFIX = "user_"; //$NON-NLS-1$
|
||||||
|
@ -39,7 +42,7 @@ public class PoiFilter {
|
||||||
|
|
||||||
|
|
||||||
// constructor for standard filters
|
// constructor for standard filters
|
||||||
public PoiFilter(AmenityType type, OsmandApplication application){
|
public PoiLegacyFilter(AmenityType type, OsmandApplication application){
|
||||||
this.app = application;
|
this.app = application;
|
||||||
isStandardFilter = true;
|
isStandardFilter = true;
|
||||||
filterId = STD_PREFIX + type;
|
filterId = STD_PREFIX + type;
|
||||||
|
@ -53,7 +56,7 @@ public class PoiFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// constructor for user defined filters
|
// constructor for user defined filters
|
||||||
public PoiFilter(String name, String filterId, Map<AmenityType, LinkedHashSet<String>> acceptedTypes, OsmandApplication app){
|
public PoiLegacyFilter(String name, String filterId, Map<AmenityType, LinkedHashSet<String>> acceptedTypes, OsmandApplication app){
|
||||||
this.app = app;
|
this.app = app;
|
||||||
isStandardFilter = false;
|
isStandardFilter = false;
|
||||||
if(filterId == null){
|
if(filterId == null){
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus;
|
package net.osmand.plus.poi;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
@ -8,11 +8,14 @@ import java.util.List;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.R.string;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
public class SearchByNameFilter extends PoiFilter {
|
public class SearchByNameFilter extends PoiLegacyFilter {
|
||||||
|
|
||||||
public static final String FILTER_ID = PoiFilter.BY_NAME_FILTER_ID; //$NON-NLS-1$
|
public static final String FILTER_ID = PoiLegacyFilter.BY_NAME_FILTER_ID; //$NON-NLS-1$
|
||||||
|
|
||||||
List<Amenity> searchedAmenities = new ArrayList<Amenity>();
|
List<Amenity> searchedAmenities = new ArrayList<Amenity>();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.plus.PoiFilter;
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
|
|
||||||
public interface AmenityIndexRepository {
|
public interface AmenityIndexRepository {
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ public interface AmenityIndexRepository {
|
||||||
/**
|
/**
|
||||||
* Search amenities in the specified box doesn't cache results
|
* Search amenities in the specified box doesn't cache results
|
||||||
*/
|
*/
|
||||||
public List<Amenity> searchAmenities(int stop, int sleft, int sbottom, int sright, int zoom, PoiFilter filter, List<Amenity> amenities,
|
public List<Amenity> searchAmenities(int stop, int sleft, int sbottom, int sright, int zoom, PoiLegacyFilter filter, List<Amenity> amenities,
|
||||||
ResultMatcher<Amenity> matcher);
|
ResultMatcher<Amenity> matcher);
|
||||||
|
|
||||||
public List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, PoiFilter filter, ResultMatcher<Amenity> matcher);
|
public List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, PoiLegacyFilter filter, ResultMatcher<Amenity> matcher);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.osmand.binary.BinaryMapIndexReader.SearchPoiTypeFilter;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.plus.PoiFilter;
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -83,7 +83,7 @@ public class AmenityIndexRepositoryBinary implements AmenityIndexRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized List<Amenity> searchAmenities(int stop, int sleft, int sbottom, int sright, int zoom,
|
public synchronized List<Amenity> searchAmenities(int stop, int sleft, int sbottom, int sright, int zoom,
|
||||||
final PoiFilter filter, final List<Amenity> amenities, ResultMatcher<Amenity> matcher) {
|
final PoiLegacyFilter filter, final List<Amenity> amenities, ResultMatcher<Amenity> matcher) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
SearchPoiTypeFilter poiTypeFilter = new SearchPoiTypeFilter(){
|
SearchPoiTypeFilter poiTypeFilter = new SearchPoiTypeFilter(){
|
||||||
@Override
|
@Override
|
||||||
|
@ -108,7 +108,7 @@ public class AmenityIndexRepositoryBinary implements AmenityIndexRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, final PoiFilter filter, ResultMatcher<Amenity> matcher) {
|
public synchronized List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, final PoiLegacyFilter filter, ResultMatcher<Amenity> matcher) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
SearchPoiTypeFilter poiTypeFilter = new SearchPoiTypeFilter(){
|
SearchPoiTypeFilter poiTypeFilter = new SearchPoiTypeFilter(){
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -36,15 +36,15 @@ import net.osmand.map.MapTileDownloader;
|
||||||
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.map.OsmandRegions;
|
import net.osmand.map.OsmandRegions;
|
||||||
import net.osmand.plus.BusyIndicator;
|
import net.osmand.plus.BusyIndicator;
|
||||||
import net.osmand.plus.NameFinderPoiFilter;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.SearchByNameFilter;
|
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
import net.osmand.plus.poi.NameFinderPoiFilter;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
|
import net.osmand.plus.poi.SearchByNameFilter;
|
||||||
import net.osmand.plus.render.MapRenderRepositories;
|
import net.osmand.plus.render.MapRenderRepositories;
|
||||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||||
import net.osmand.plus.resources.AsyncLoadingThread.MapLoadRequest;
|
import net.osmand.plus.resources.AsyncLoadingThread.MapLoadRequest;
|
||||||
|
@ -718,7 +718,7 @@ public class ResourceManager {
|
||||||
return publish;
|
return publish;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Amenity> searchAmenities(PoiFilter filter,
|
public List<Amenity> searchAmenities(PoiLegacyFilter filter,
|
||||||
double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
||||||
final List<Amenity> amenities = new ArrayList<Amenity>();
|
final List<Amenity> amenities = new ArrayList<Amenity>();
|
||||||
searchAmenitiesInProgress = true;
|
searchAmenitiesInProgress = true;
|
||||||
|
@ -824,7 +824,7 @@ public class ResourceManager {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, PoiFilter filter, ResultMatcher<Amenity> matcher) {
|
public List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, PoiLegacyFilter filter, ResultMatcher<Amenity> matcher) {
|
||||||
searchAmenitiesInProgress = true;
|
searchAmenitiesInProgress = true;
|
||||||
final List<Amenity> amenities = new ArrayList<Amenity>();
|
final List<Amenity> amenities = new ArrayList<Amenity>();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -16,9 +16,9 @@ import net.osmand.osm.MapRenderingTypes;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.PoiFilter;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult;
|
import net.osmand.plus.routing.RouteCalculationResult;
|
||||||
|
@ -52,7 +52,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
|
|
||||||
private ResourceManager resourceManager;
|
private ResourceManager resourceManager;
|
||||||
private RoutingHelper routingHelper;
|
private RoutingHelper routingHelper;
|
||||||
private PoiFilter filter;
|
private PoiLegacyFilter filter;
|
||||||
private MapTextLayer mapTextLayer;
|
private MapTextLayer mapTextLayer;
|
||||||
|
|
||||||
/// cache for displayed POI
|
/// cache for displayed POI
|
||||||
|
@ -103,11 +103,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public PoiFilter getFilter() {
|
public PoiLegacyFilter getFilter() {
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFilter(PoiFilter filter) {
|
public void setFilter(PoiLegacyFilter filter) {
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
data.clearCache();
|
data.clearCache();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="gen"/>
|
<classpathentry kind="src" path="gen"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||||
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||||
<classpathentry kind="output" path="bin/classes"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
2
appcompat/.gitignore
vendored
Normal file
2
appcompat/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bin
|
||||||
|
gen
|
|
@ -1,8 +0,0 @@
|
||||||
/*___Generated_by_IDEA___*/
|
|
||||||
|
|
||||||
package android.support.v7.appcompat;
|
|
||||||
|
|
||||||
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
|
|
||||||
public final class BuildConfig {
|
|
||||||
public final static boolean DEBUG = Boolean.parseBoolean(null);
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
/*___Generated_by_IDEA___*/
|
|
||||||
|
|
||||||
package android.support.v7.appcompat;
|
|
||||||
|
|
||||||
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
|
|
||||||
public final class Manifest {
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
/*___Generated_by_IDEA___*/
|
|
||||||
|
|
||||||
package android.support.v7.appcompat;
|
|
||||||
|
|
||||||
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
|
|
||||||
public final class R {
|
|
||||||
}
|
|
Loading…
Reference in a new issue