quick action show/hide poi

This commit is contained in:
Rosty 2016-12-30 12:33:37 +02:00
parent 8e3035c5d7
commit efb24f7c03
3 changed files with 19 additions and 9 deletions

View file

@ -139,12 +139,12 @@
<string name="city_type_district">District</string> <string name="city_type_district">District</string>
<string name="city_type_neighbourhood">Neighbourhood</string> <string name="city_type_neighbourhood">Neighbourhood</string>
<string name="map_widget_search">Search</string> <string name="map_widget_search">Search</string>
<string name="shared_string_is_open_24_7">Open 24/7</string> <string name="shared_string_is_open_24_7">Open 24/7</string>
<string name="storage_directory_card">Memory card</string> <string name="storage_directory_card">Memory card</string>
<string name="coords_format">Coordinate format</string> <string name="coords_format">Coordinate format</string>
<string name="coords_format_descr">Format for the geographical coordinates</string> <string name="coords_format_descr">Format for the geographical coordinates</string>
<string name="app_mode_bus">Bus</string> <string name="app_mode_bus">Bus</string>
<string name="app_mode_train">Train</string> <string name="app_mode_train">Train</string>
<string name="current_track">Current track</string> <string name="current_track">Current track</string>
<string name="map_widget_battery">Battery level</string> <string name="map_widget_battery">Battery level</string>
<string name="change_markers_position">Change marker\'s position</string> <string name="change_markers_position">Change marker\'s position</string>
@ -156,7 +156,7 @@
<string name="access_direction_haptic_feedback">Direction haptic feedback</string> <string name="access_direction_haptic_feedback">Direction haptic feedback</string>
<string name="access_direction_haptic_feedback_descr">Indicate target point direction by vibration</string> <string name="access_direction_haptic_feedback_descr">Indicate target point direction by vibration</string>
<string name="use_osm_live_routing_description">Enable navigation for OSM Live changes (Beta)</string> <string name="use_osm_live_routing_description">Enable navigation for OSM Live changes (Beta)</string>
<string name="use_osm_live_routing">OSM Live navigation</string> <string name="use_osm_live_routing">OSM Live navigation</string>
<string name="access_no_destination">Destination is not set</string> <string name="access_no_destination">Destination is not set</string>
<string name="map_widget_magnetic_bearing">Magnetic bearing</string> <string name="map_widget_magnetic_bearing">Magnetic bearing</string>
<string name="map_widget_bearing">Relative bearing</string> <string name="map_widget_bearing">Relative bearing</string>
@ -261,7 +261,7 @@
<string name="osm_live_header">This subscription enables hourly updates for all maps around the world. <string name="osm_live_header">This subscription enables hourly updates for all maps around the world.
Part of the income goes back to the OSM community and is paid for each OSM contribution. Part of the income goes back to the OSM community and is paid for each OSM contribution.
If you love OsmAnd and OSM and want to support them, this is the perfect way to do it.</string> If you love OsmAnd and OSM and want to support them, this is the perfect way to do it.</string>
<string name="select_map_marker">Select map marker</string> <string name="select_map_marker">Select map marker</string>
<string name="map_markers_other">Other markers</string> <string name="map_markers_other">Other markers</string>
<string name="upload_anonymously">Upload anonymously</string> <string name="upload_anonymously">Upload anonymously</string>
@ -1080,8 +1080,8 @@
<string name="route_info">Route information</string> <string name="route_info">Route information</string>
<string name="routing_attr_prefer_motorway_name">Prefer motorways</string> <string name="routing_attr_prefer_motorway_name">Prefer motorways</string>
<string name="routing_attr_prefer_motorway_description">Prefer motorways</string> <string name="routing_attr_prefer_motorway_description">Prefer motorways</string>
<string name="routing_attr_avoid_toll_name">Avoid toll roads</string> <string name="routing_attr_avoid_toll_name">Avoid toll roads</string>
<string name="routing_attr_avoid_toll_description">Avoid toll roads</string> <string name="routing_attr_avoid_toll_description">Avoid toll roads</string>
<string name="routing_attr_avoid_unpaved_name">Avoid unpaved roads</string> <string name="routing_attr_avoid_unpaved_name">Avoid unpaved roads</string>

View file

@ -308,6 +308,10 @@ public class PoiFiltersHelper {
saveSelectedPoiFilters(); saveSelectedPoiFilters();
} }
public void hidePoiFilters() {
selectedPoiFilters.clear();
}
public String getFiltersName(Set<PoiUIFilter> filters) { public String getFiltersName(Set<PoiUIFilter> filters) {
if (filters.isEmpty()) { if (filters.isEmpty()) {
return application.getResources().getString(R.string.shared_string_none); return application.getResources().getString(R.string.shared_string_none);

View file

@ -22,6 +22,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.editors.EditCategoryDialogFragment; import net.osmand.plus.mapcontextmenu.editors.EditCategoryDialogFragment;
import net.osmand.plus.mapcontextmenu.editors.SelectCategoryDialogFragment; import net.osmand.plus.mapcontextmenu.editors.SelectCategoryDialogFragment;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.widgets.AutoCompleteTextViewEx; import net.osmand.plus.widgets.AutoCompleteTextViewEx;
import java.lang.reflect.Type; import java.lang.reflect.Type;
@ -423,8 +424,13 @@ public class QuickActionFactory {
@Override @Override
public void execute(MapActivity activity) { public void execute(MapActivity activity) {
activity.getMyApplication().getSettings().SHOW_NEARBY_POI.set( PoiFiltersHelper pf = activity.getMyApplication().getPoiFilters();
!activity.getMyApplication().getSettings().SHOW_NEARBY_POI.get());
if (pf.getSelectedPoiFilters().isEmpty()){
pf.loadSelectedPoiFilters();
} else pf.hidePoiFilters();
} }
@Override @Override