Update poi types
This commit is contained in:
parent
ca31455f0e
commit
c6ad42ee79
11 changed files with 121 additions and 111 deletions
|
@ -1,21 +1,18 @@
|
|||
package net.osmand.osm;
|
||||
|
||||
public class AbstractPoiType {
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AbstractPoiType {
|
||||
|
||||
protected final String keyName;
|
||||
protected final MapPoiTypes registry;
|
||||
|
||||
|
||||
|
||||
public AbstractPoiType(String keyName, MapPoiTypes registry) {
|
||||
this.keyName = keyName;
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return keyName;
|
||||
}
|
||||
|
||||
public String getKeyName() {
|
||||
return keyName;
|
||||
}
|
||||
|
@ -23,6 +20,8 @@ public class AbstractPoiType {
|
|||
public String getTranslation() {
|
||||
return registry.getTranslation(this);
|
||||
}
|
||||
|
||||
public abstract Map<PoiCategory, LinkedHashSet<String>> putTypes(Map<PoiCategory, LinkedHashSet<String>> acceptedTypes);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class MapPoiTypes {
|
|||
name = "tourism";
|
||||
}
|
||||
for(PoiCategory p : categories ) {
|
||||
if(p.getName().equals(name) || p.getKey().equalsIgnoreCase(name)) {
|
||||
if(p.getKeyName().equalsIgnoreCase(name)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ public class MapPoiTypes {
|
|||
private static void print(MapPoiTypes df) {
|
||||
List<PoiCategory> pc = df.getCategories();
|
||||
for(PoiCategory p : pc) {
|
||||
System.out.println("Category " + p.getName());
|
||||
System.out.println("Category " + p.getKeyName());
|
||||
for(PoiFilter f : p.getPoiFilters()) {
|
||||
System.out.println(" Filter " + f.getName());
|
||||
System.out.println(" Filter " + f.getKeyName());
|
||||
print(" ", f);
|
||||
}
|
||||
print(" ", p);
|
||||
|
@ -279,8 +279,8 @@ public class MapPoiTypes {
|
|||
|
||||
private static void print(String indent, PoiFilter f) {
|
||||
for(PoiType pt : f.getPoiTypes()) {
|
||||
System.out.println(indent + " Type " + pt.getName() +
|
||||
(pt.isReference() ? (" -> " + pt.getReferenceType().getCategory().getKey() ): ""));
|
||||
System.out.println(indent + " Type " + pt.getKeyName() +
|
||||
(pt.isReference() ? (" -> " + pt.getReferenceType().getCategory().getKeyName() ): ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ public class MapPoiTypes {
|
|||
return translation;
|
||||
}
|
||||
}
|
||||
return Algorithms.capitalizeFirstLetterAndLowercase(abstractPoiType.getName().replace('_', ' '));
|
||||
return Algorithms.capitalizeFirstLetterAndLowercase(abstractPoiType.getKeyName().replace('_', ' '));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,9 +48,6 @@ public class PoiCategory extends PoiFilter {
|
|||
return keyName.equals(MapPoiTypes.OSM_WIKI_CATEGORY);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return keyName;
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
return regId;
|
||||
|
|
|
@ -27,15 +27,15 @@ public class PoiFilter extends AbstractPoiType {
|
|||
}
|
||||
|
||||
public void addPoiType(PoiType type) {
|
||||
if(!map.containsKey(type.getName())) {
|
||||
if(!map.containsKey(type.getKeyName())) {
|
||||
poiTypes.add(type);
|
||||
map.put(type.getName(), type);
|
||||
map.put(type.getKeyName(), type);
|
||||
} else {
|
||||
PoiType prev = map.get(type.getName());
|
||||
PoiType prev = map.get(type.getKeyName());
|
||||
if(prev.isReference()) {
|
||||
poiTypes.remove(prev);
|
||||
poiTypes.add(type);
|
||||
map.put(type.getName(), type);
|
||||
map.put(type.getKeyName(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,10 +71,6 @@ public class PoiFilter extends AbstractPoiType {
|
|||
return poiTypes;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return keyName;
|
||||
}
|
||||
|
||||
public void setTopVisible(boolean topVisible) {
|
||||
this.topVisible = topVisible;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.osmand.osm;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class PoiType extends AbstractPoiType {
|
||||
|
||||
private PoiCategory category;
|
||||
|
@ -73,6 +76,18 @@ public class PoiType extends AbstractPoiType {
|
|||
public PoiCategory getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
|
||||
public Map<PoiCategory, LinkedHashSet<String>> putTypes(Map<PoiCategory, LinkedHashSet<String>> acceptedTypes) {
|
||||
PoiType rt = getReferenceType();
|
||||
PoiType poiType = rt != null ? rt : this;
|
||||
if (!acceptedTypes.containsKey(poiType.category)) {
|
||||
acceptedTypes.put(poiType.category, new LinkedHashSet<String>());
|
||||
}
|
||||
LinkedHashSet<String> set = acceptedTypes.get(poiType.category);
|
||||
if(set != null) {
|
||||
set.add(poiType.getKeyName());
|
||||
}
|
||||
return acceptedTypes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
|
@ -59,7 +60,7 @@
|
|||
android:layout_weight="1" />
|
||||
|
||||
<net.osmand.plus.activities.search.toolbar.SplitToolbar
|
||||
android:id="@+id/bottomControls"
|
||||
android:id="@+id/poiSplitbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bottomToolBarColor"
|
||||
|
|
|
@ -255,26 +255,14 @@ public class MapActivityLayers {
|
|||
|
||||
|
||||
public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiLegacyFilter[] selected){
|
||||
final List<PoiLegacyFilter> userDefined = new ArrayList<PoiLegacyFilter>();
|
||||
OsmandApplication app = (OsmandApplication)getApplication();
|
||||
OsmandApplication app = (OsmandApplication) getApplication();
|
||||
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
||||
final List<PoiLegacyFilter> list = new ArrayList<PoiLegacyFilter>();
|
||||
for (PoiLegacyFilter f : poiFilters.getTopDefinedPoiFilters()) {
|
||||
if(PoiLegacyFilter.BY_NAME_FILTER_ID.equals(f.getFilterId()) ||
|
||||
PoiLegacyFilter.NAME_FINDER_FILTER_ID.equals(f.getFilterId())) {
|
||||
continue;
|
||||
}
|
||||
list.add(f);
|
||||
Item it = adapter.item(f.getName());
|
||||
if (RenderingIcons.containsBigIcon(f.getSimplifiedId())) {
|
||||
it.icon(RenderingIcons.getBigIconResourceId(f.getSimplifiedId()));
|
||||
} else {
|
||||
it.icon(RenderingIcons.getBigIconResourceId("user_defined"));
|
||||
}
|
||||
it.reg();
|
||||
userDefined.add(f);
|
||||
addFilterToList(adapter, list, f);
|
||||
}
|
||||
addFilterToList(adapter, list, poiFilters.getCustomPOIFilter());
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
ListAdapter listAdapter = adapter.createListAdapter(activity, app.getSettings().isLightContent());
|
||||
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){
|
||||
|
@ -309,6 +297,17 @@ public class MapActivityLayers {
|
|||
return builder.show();
|
||||
}
|
||||
|
||||
private void addFilterToList(final ContextMenuAdapter adapter, final List<PoiLegacyFilter> list, PoiLegacyFilter f) {
|
||||
list.add(f);
|
||||
Item it = adapter.item(f.getName());
|
||||
if (RenderingIcons.containsBigIcon(f.getSimplifiedId())) {
|
||||
it.icon(RenderingIcons.getBigIconResourceId(f.getSimplifiedId()));
|
||||
} else {
|
||||
it.icon(RenderingIcons.getBigIconResourceId("user_defined"));
|
||||
}
|
||||
it.reg();
|
||||
}
|
||||
|
||||
public void selectMapLayer(final OsmandMapTileView mapView){
|
||||
if(OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) {
|
||||
AccessibleToast.makeText(activity, R.string.map_online_plugin_is_not_installed, Toast.LENGTH_LONG).show();
|
||||
|
|
|
@ -52,7 +52,6 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.AsyncTask.Status;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
@ -61,21 +60,17 @@ import android.text.SpannableString;
|
|||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Filter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -104,7 +99,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
private net.osmand.Location location = null;
|
||||
private Float heading = null;
|
||||
|
||||
private Handler uiHandler;
|
||||
private OsmandSettings settings;
|
||||
|
||||
private float width = 24;
|
||||
|
@ -116,7 +110,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
private MenuItem showFilterItem;
|
||||
private MenuItem showOnMapItem;
|
||||
private MenuItem searchPOILevel;
|
||||
private Button searchFooterButton;
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
@ -188,7 +181,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
}
|
||||
|
||||
public Toolbar getClearToolbar(boolean visible) {
|
||||
final Toolbar tb = (Toolbar) findViewById(R.id.bottomControls);
|
||||
final Toolbar tb = (Toolbar) findViewById(R.id.poiSplitbar);
|
||||
tb.setTitle(null);
|
||||
tb.getMenu().clear();
|
||||
tb.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
|
@ -229,7 +222,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
app = (OsmandApplication) getApplication();
|
||||
|
||||
uiHandler = new Handler();
|
||||
searchFilter = (EditText) findViewById(R.id.edit);
|
||||
searchFilterLayout = findViewById(R.id.SearchFilterLayout);
|
||||
|
||||
|
@ -245,9 +237,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
searchPOILevel.setEnabled(true);
|
||||
searchPOILevel.setTitle(R.string.search_button);
|
||||
}
|
||||
searchFooterButton.setEnabled(true);
|
||||
searchFooterButton.setText(R.string.search_button);
|
||||
// Cancel current search request here?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +256,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
}
|
||||
}
|
||||
});
|
||||
addFooterView();
|
||||
amenityAdapter = new AmenityAdapter(new ArrayList<Amenity>());
|
||||
setListAdapter(amenityAdapter);
|
||||
|
||||
|
@ -280,25 +268,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
}
|
||||
}
|
||||
|
||||
private void addFooterView() {
|
||||
final FrameLayout ll = new FrameLayout(this);
|
||||
android.widget.FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
lp.gravity = Gravity.CENTER_HORIZONTAL;
|
||||
searchFooterButton = new Button(this);
|
||||
searchFooterButton.setText(R.string.search_POI_level_btn);
|
||||
searchFooterButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchMore();
|
||||
}
|
||||
});
|
||||
searchFooterButton.setLayoutParams(lp);
|
||||
ll.addView(searchFooterButton);
|
||||
|
||||
getListView().addFooterView(ll);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
@ -436,14 +405,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
searchPOILevel.setEnabled(enabled);
|
||||
searchPOILevel.setTitle(title);
|
||||
}
|
||||
// if(ResourcesCompat.getResources_getBoolean(this, R.bool.abs__split_action_bar_is_narrow)) {
|
||||
if (true) {
|
||||
searchFooterButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
searchFooterButton.setVisibility(View.VISIBLE);
|
||||
searchFooterButton.setEnabled(enabled);
|
||||
searchFooterButton.setText(title);
|
||||
}
|
||||
}
|
||||
|
||||
private net.osmand.Location getSearchedLocation() {
|
||||
|
@ -637,7 +598,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
if (searchPOILevel != null) {
|
||||
searchPOILevel.setEnabled(false);
|
||||
}
|
||||
searchFooterButton.setEnabled(false);
|
||||
existingObjects = new TLongHashSet();
|
||||
updateExisting = new TLongHashSet();
|
||||
if (request.type == SearchAmenityRequest.NEW_SEARCH_INIT) {
|
||||
|
|
|
@ -50,13 +50,16 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
|||
|
||||
private EditText searchEditText;
|
||||
private SearchPoiByNameTask currentTask = null;
|
||||
private PoiFiltersAdapter poiFitlersAdapter;
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.searchpoi, container, false);
|
||||
|
||||
v.findViewById(R.id.SearchFilterLayout).setVisibility(View.VISIBLE);
|
||||
setupSearchEditText((EditText) v.findViewById(R.id.edit));
|
||||
setupOptions(v.findViewById(R.id.options));
|
||||
v.findViewById(R.id.bottomControls).setVisibility(View.GONE);
|
||||
v.findViewById(R.id.poiSplitbar).setVisibility(View.GONE);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -89,15 +92,16 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
|||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
refreshPoiListAdapter();
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
public void refreshPoiListAdapter() {
|
||||
PoiFiltersHelper poiFilters = getApp().getPoiFilters();
|
||||
List<PoiLegacyFilter> filters = new ArrayList<PoiLegacyFilter>() ;
|
||||
filters.addAll(poiFilters.getTopDefinedPoiFilters());
|
||||
setListAdapter(new AmenityAdapter(filters));
|
||||
poiFitlersAdapter = new PoiFiltersAdapter(filters);
|
||||
setListAdapter(poiFitlersAdapter);
|
||||
}
|
||||
|
||||
public OsmandApplication getApp(){
|
||||
|
@ -139,12 +143,7 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
|||
|
||||
@Override
|
||||
public void onListItemClick(ListView listView, View v, int position, long id) {
|
||||
final PoiLegacyFilter filter = ((AmenityAdapter) getListAdapter()).getItem(position);
|
||||
if (filter.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID)) {
|
||||
filter.clearFilter();
|
||||
showEditActivity(filter);
|
||||
return;
|
||||
}
|
||||
final PoiLegacyFilter filter = ((PoiFiltersAdapter) getListAdapter()).getItem(position);
|
||||
if(!(filter instanceof NameFinderPoiFilter)){
|
||||
ResourceManager rm = getApp().getResourceManager();
|
||||
if(!rm.containsAmenityRepositoryToSearch(filter instanceof SearchByNameFilter)){
|
||||
|
@ -177,10 +176,10 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
|||
}
|
||||
|
||||
|
||||
class AmenityAdapter extends ArrayAdapter<PoiLegacyFilter> {
|
||||
class PoiFiltersAdapter extends ArrayAdapter<PoiLegacyFilter> {
|
||||
|
||||
|
||||
AmenityAdapter(List<PoiLegacyFilter> list) {
|
||||
PoiFiltersAdapter(List<PoiLegacyFilter> list) {
|
||||
super(getActivity(), R.layout.searchpoifolder_list, list);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Map;
|
|||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiFilter;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||
|
@ -23,6 +24,9 @@ public class PoiFiltersHelper {
|
|||
private final OsmandApplication application;
|
||||
|
||||
private NameFinderPoiFilter nameFinderPOIFilter;
|
||||
private PoiLegacyFilter searchByNamePOIFilter;
|
||||
private PoiLegacyFilter customPOIFilter;
|
||||
private PoiLegacyFilter showAllPOIFilter;
|
||||
private List<PoiLegacyFilter> cacheTopStandardFilters;
|
||||
|
||||
private static final String UDF_CAR_AID = "car_aid";
|
||||
|
@ -44,6 +48,7 @@ public class PoiFiltersHelper {
|
|||
public PoiFiltersHelper(OsmandApplication application){
|
||||
this.application = application;
|
||||
}
|
||||
|
||||
public NameFinderPoiFilter getNameFinderPOIFilter() {
|
||||
if(nameFinderPOIFilter == null){
|
||||
nameFinderPOIFilter = new NameFinderPoiFilter(application);
|
||||
|
@ -51,7 +56,43 @@ public class PoiFiltersHelper {
|
|||
return nameFinderPOIFilter;
|
||||
}
|
||||
|
||||
public PoiLegacyFilter getSearchByNamePOIFilter() {
|
||||
if(searchByNamePOIFilter == null){
|
||||
PoiLegacyFilter filter = new SearchByNameFilter(application);
|
||||
filter.setStandardFilter(true);
|
||||
searchByNamePOIFilter = filter;
|
||||
}
|
||||
return searchByNamePOIFilter;
|
||||
}
|
||||
|
||||
public PoiLegacyFilter getCustomPOIFilter() {
|
||||
if(customPOIFilter == null){
|
||||
PoiLegacyFilter filter = new PoiLegacyFilter(application.getString(R.string.poi_filter_custom_filter),
|
||||
PoiLegacyFilter.CUSTOM_FILTER_ID, new LinkedHashMap<PoiCategory, LinkedHashSet<String>>(), application); //$NON-NLS-1$
|
||||
filter.setStandardFilter(true);
|
||||
customPOIFilter = filter;
|
||||
}
|
||||
return customPOIFilter;
|
||||
}
|
||||
|
||||
public PoiLegacyFilter getShowAllPOIFilter() {
|
||||
if(showAllPOIFilter == null){
|
||||
PoiLegacyFilter filter = new PoiLegacyFilter(null, application); //$NON-NLS-1$
|
||||
filter.setStandardFilter(true);
|
||||
showAllPOIFilter = filter;
|
||||
}
|
||||
return showAllPOIFilter;
|
||||
}
|
||||
|
||||
|
||||
private PoiLegacyFilter getFilterById(String filterId, PoiLegacyFilter... filters){
|
||||
for(PoiLegacyFilter pf : filters) {
|
||||
if(pf.getFilterId().equals(filterId)){
|
||||
return pf;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PoiLegacyFilter getFilterById(String filterId){
|
||||
if(filterId == null){
|
||||
|
@ -62,6 +103,18 @@ public class PoiFiltersHelper {
|
|||
return f;
|
||||
}
|
||||
}
|
||||
PoiLegacyFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(),
|
||||
getShowAllPOIFilter(), getNameFinderPOIFilter());
|
||||
if (ff != null) {
|
||||
return ff;
|
||||
}
|
||||
if(filterId.startsWith(PoiLegacyFilter.STD_PREFIX)) {
|
||||
String typeId = filterId.substring(PoiLegacyFilter.STD_PREFIX.length());
|
||||
PoiType tp = application.getPoiTypes().getPoiTypeByKey(typeId);
|
||||
if(tp != null) {
|
||||
return new PoiLegacyFilter(tp, application);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -117,19 +170,6 @@ public class PoiFiltersHelper {
|
|||
public List<PoiLegacyFilter> getTopDefinedPoiFilters() {
|
||||
if (cacheTopStandardFilters == null) {
|
||||
cacheTopStandardFilters = new ArrayList<PoiLegacyFilter>();
|
||||
// by name
|
||||
PoiLegacyFilter filter = new SearchByNameFilter(application);
|
||||
filter.setStandardFilter(true);
|
||||
cacheTopStandardFilters.add(filter);
|
||||
// custom
|
||||
filter = new PoiLegacyFilter(application.getString(R.string.poi_filter_custom_filter),
|
||||
PoiLegacyFilter.CUSTOM_FILTER_ID, new LinkedHashMap<PoiCategory, LinkedHashSet<String>>(), application); //$NON-NLS-1$
|
||||
filter.setStandardFilter(true);
|
||||
cacheTopStandardFilters.add(filter);
|
||||
// all
|
||||
cacheTopStandardFilters.add(new PoiLegacyFilter(null, application));
|
||||
// name finder
|
||||
cacheTopStandardFilters.add(getNameFinderPOIFilter());
|
||||
// user defined
|
||||
cacheTopStandardFilters.addAll(getUserDefinedPoiFilters());
|
||||
// default
|
||||
|
@ -139,7 +179,10 @@ public class PoiFiltersHelper {
|
|||
}
|
||||
sortListOfFilters(cacheTopStandardFilters);
|
||||
}
|
||||
return Collections.unmodifiableList(cacheTopStandardFilters);
|
||||
List<PoiLegacyFilter> result = new ArrayList<PoiLegacyFilter>();
|
||||
result.add(getShowAllPOIFilter());
|
||||
result.addAll(cacheTopStandardFilters);
|
||||
return result;
|
||||
}
|
||||
|
||||
private PoiFilterDbHelper openDbHelper(){
|
||||
|
@ -287,13 +330,13 @@ public class PoiFiltersHelper {
|
|||
for(PoiCategory a : types.keySet()){
|
||||
if(types.get(a) == null){
|
||||
insertCategories.bindString(1, p.getFilterId());
|
||||
insertCategories.bindString(2, a.getKey());
|
||||
insertCategories.bindString(2, a.getKeyName());
|
||||
insertCategories.bindNull(3);
|
||||
insertCategories.execute();
|
||||
} else {
|
||||
for(String s : types.get(a)){
|
||||
insertCategories.bindString(1, p.getFilterId());
|
||||
insertCategories.bindString(2, a.getKey());
|
||||
insertCategories.bindString(2, a.getKeyName());
|
||||
insertCategories.bindString(3, s);
|
||||
insertCategories.execute();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Set;
|
|||
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiFilter;
|
||||
|
@ -47,10 +48,10 @@ public class PoiLegacyFilter {
|
|||
|
||||
|
||||
// constructor for standard filters
|
||||
public PoiLegacyFilter(PoiFilter type, OsmandApplication application) {
|
||||
public PoiLegacyFilter(AbstractPoiType type, OsmandApplication application) {
|
||||
this.app = application;
|
||||
isStandardFilter = true;
|
||||
filterId = STD_PREFIX + (type == null ? null : type.getName());
|
||||
filterId = STD_PREFIX + (type == null ? null : type.getKeyName());
|
||||
poiTypes = application.getPoiTypes();
|
||||
name = type == null ? application.getString(R.string.poi_filter_closest_poi) : type.getTranslation(); //$NON-NLS-1$
|
||||
if (type == null) {
|
||||
|
|
Loading…
Reference in a new issue