diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml
index e2dd3670d0..0129b3fe77 100644
--- a/OsmAnd/AndroidManifest.xml
+++ b/OsmAnd/AndroidManifest.xml
@@ -25,6 +25,7 @@
+
diff --git a/OsmAnd/res/layout/editing_poi_filter.xml b/OsmAnd/res/layout/editing_poi_filter.xml
new file mode 100644
index 0000000000..42b32c888c
--- /dev/null
+++ b/OsmAnd/res/layout/editing_poi_filter.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/editing_poi_filter_list.xml b/OsmAnd/res/layout/editing_poi_filter_list.xml
new file mode 100644
index 0000000000..1cf11d0ed5
--- /dev/null
+++ b/OsmAnd/res/layout/editing_poi_filter_list.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/values-ru-rRU/strings.xml b/OsmAnd/res/values-ru-rRU/strings.xml
index 8f5796e5fc..7596cb2570 100644
--- a/OsmAnd/res/values-ru-rRU/strings.xml
+++ b/OsmAnd/res/values-ru-rRU/strings.xml
@@ -211,4 +211,5 @@
Удалить
Сохранить
Сброс
+Фильтровать
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 880703b8c4..214de0a88b 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -213,4 +213,5 @@
Delete
Commit
Reset
+Filter
diff --git a/OsmAnd/src/com/osmand/activities/EditPOIFilterActivity.java b/OsmAnd/src/com/osmand/activities/EditPOIFilterActivity.java
new file mode 100644
index 0000000000..04c39d17c9
--- /dev/null
+++ b/OsmAnd/src/com/osmand/activities/EditPOIFilterActivity.java
@@ -0,0 +1,119 @@
+/**
+ *
+ */
+package com.osmand.activities;
+
+import android.app.AlertDialog;
+import android.app.ListActivity;
+import android.app.AlertDialog.Builder;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.View.OnClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.ScrollView;
+import android.widget.TextView;
+
+import com.osmand.PoiFilter;
+import com.osmand.PoiFiltersHelper;
+import com.osmand.R;
+import com.osmand.activities.search.SearchPOIActivity;
+import com.osmand.data.AmenityType;
+
+/**
+ * @author Frolov
+ *
+ */
+public class EditPOIFilterActivity extends ListActivity {
+
+ private Button filterLevel;
+ private PoiFilter filter;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ setContentView(R.layout.editing_poi_filter);
+
+ filterLevel = (Button) findViewById(R.id.filter_currentButton);
+ filterLevel.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // TODO
+
+ }
+ });
+
+ Bundle bundle = this.getIntent().getExtras();
+ String filterId = bundle.getString(SearchPOIActivity.AMENITY_FILTER);
+ filter = PoiFiltersHelper.getFilterById(this, filterId);
+
+ setListAdapter(new AmenityAdapter(AmenityType.getCategories()));
+ }
+
+ private void showDialog(AmenityType amenity) {
+ Builder builder = new AlertDialog.Builder(this);
+ ScrollView scroll = new ScrollView(this);
+ ListView listView = new ListView(this);
+ scroll.addView(listView);
+ builder.setView(scroll);
+ builder.setNegativeButton("Close", null);
+ builder.setNeutralButton("Select all", null);
+ builder.setMultiChoiceItems(AmenityType.getSubCategories(amenity).toArray(new String[0]), null, null);
+ builder.show();
+
+ }
+
+
+ class AmenityAdapter extends ArrayAdapter {
+ AmenityAdapter(AmenityType[] amenityTypes) {
+ super(EditPOIFilterActivity.this, R.layout.editing_poi_filter_list, amenityTypes);
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ LayoutInflater inflater = getLayoutInflater();
+ View row = convertView;
+ if (row == null) {
+ row = inflater.inflate(R.layout.editing_poi_filter_list, parent, false);
+ }
+ AmenityType model = getItem(position);
+
+ CheckBox check = (CheckBox) row.findViewById(R.id.filter_poi_check);
+ check.setChecked(filter.isTypeAccepted(model));
+
+ TextView text = (TextView) row.findViewById(R.id.filter_poi_label);
+ text.setText(AmenityType.toPublicString(model));
+ addRowListener(model, text, check);
+ return (row);
+ }
+
+ private void addRowListener(final AmenityType model,final TextView text, final CheckBox check) {
+ text.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ showDialog(model);
+ }
+ });
+
+ check.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ if(check.isChecked()) {
+ showDialog(model);
+ } else {
+ filter.setTypeToAccept(model,false);
+ }
+ }
+ });
+ }
+
+ }
+
+}
diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java
index cb3d4da774..0c2de9aa9c 100644
--- a/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java
+++ b/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java
@@ -13,6 +13,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
@@ -22,6 +23,7 @@ import com.osmand.OsmandSettings;
import com.osmand.PoiFilter;
import com.osmand.PoiFiltersHelper;
import com.osmand.R;
+import com.osmand.activities.EditPOIFilterActivity;
/**
* @author Maxim Frolov
@@ -42,6 +44,26 @@ public class SearchPoiFilterActivity extends ListActivity {
filters.addAll(PoiFiltersHelper.getOsmDefinedPoiFilters(this));
setListAdapter(new AmenityAdapter(filters));
typeFace = Typeface.create((String)null, Typeface.ITALIC);
+
+ // ListActivity has a ListView, which you can get with:
+ ListView lv = getListView();
+
+ // Then you can create a listener like so:
+ lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
+ @Override
+ public boolean onItemLongClick(AdapterView> av, View v, int pos, long id) {
+ PoiFilter poi = ((AmenityAdapter) getListAdapter()).getItem(pos);
+ if(!poi.isStandardFilter()) {
+ Bundle bundle = new Bundle();
+ Intent newIntent = new Intent(SearchPoiFilterActivity.this, EditPOIFilterActivity.class);
+ // folder selected
+ bundle.putString(SearchPOIActivity.AMENITY_FILTER, poi.getFilterId());
+ newIntent.putExtras(bundle);
+ startActivityForResult(newIntent, 0);
+ }
+ return true;
+ }
+ });
}