diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index ae5afe838f..68fd8e53d4 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -48,4 +48,5 @@
Search building incrementally
Choose region
Choose intersected street
+Closest Anemities
diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java
index ce94131c75..a63eaa762f 100644
--- a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java
+++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java
@@ -59,7 +59,7 @@ public class SearchPOIActivity extends ListActivity {
@Override
public void onClick(View v) {
ResourceManager resourceManager = ResourceManager.getResourceManager();
- if ( zoom > finalZoom) {
+ if (zoom > finalZoom) {
--zoom;
}
amenityList = resourceManager.searchAmenities(amenityType, lastKnownMapLocation.getLatitude(), lastKnownMapLocation
@@ -78,9 +78,14 @@ public class SearchPOIActivity extends ListActivity {
ResourceManager resourceManager = ResourceManager.getResourceManager();
lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(this);
amenityType = findAmenityType(anemity);
- amenityList = resourceManager.searchAmenities(amenityType, lastKnownMapLocation.getLatitude(), lastKnownMapLocation
- .getLongitude(), zoom, maxCount);
-
+ if (amenityType != null) {
+ amenityList = resourceManager.searchAmenities(amenityType, lastKnownMapLocation.getLatitude(), lastKnownMapLocation
+ .getLongitude(), zoom, maxCount);
+ } else {
+ amenityList = resourceManager.searchAmenities(amenityType, lastKnownMapLocation.getLatitude(), lastKnownMapLocation
+ .getLongitude(), zoom, 15);
+ }
+
if (amenityList != null) {
MapUtils.sortListOfMapObject(amenityList, lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude());
amenityAdapter = new AmenityAdapter(amenityList);
@@ -119,11 +124,11 @@ public class SearchPOIActivity extends ListActivity {
public void setNewModel(List> amenityList) {
setNotifyOnChange(false);
((AmenityAdapter) getListAdapter()).clear();
- for(Object obj: amenityList){
+ for (Object obj : amenityList) {
this.add(obj);
}
this.notifyDataSetChanged();
-
+
}
public View getView(int position, View convertView, ViewGroup parent) {
@@ -150,7 +155,7 @@ public class SearchPOIActivity extends ListActivity {
}
return (row);
}
-
+
private Object getModel(int position) {
return (((AmenityAdapter) getListAdapter()).getItem(position));
}
diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java
index be3fee23f6..76fd6082e7 100644
--- a/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java
+++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java
@@ -27,7 +27,6 @@ import com.osmand.data.Amenity.AmenityType;
*/
public class SearchPOIListActivity extends ListActivity {
-
List amenityList = new ArrayList();
@Override
@@ -40,6 +39,7 @@ public class SearchPOIListActivity extends ListActivity {
}
private void createAmenityTypeList() {
+ amenityList.add(getResources().getString(R.string.Closest_Anemities));
for (AmenityType type : AmenityType.values()) {
amenityList.add(Algoritms.capitalizeFirstLetterAndLowercase(type.toString()));
}
@@ -48,14 +48,16 @@ public class SearchPOIListActivity extends ListActivity {
public void onListItemClick(ListView parent, View v, int position, long id) {
AmenityType amenityType = findAmenityType(amenityList.get(position));
+ Bundle bundle = new Bundle();
+ Intent newIntent = new Intent(SearchPOIListActivity.this, SearchPOIActivity.class);
// folder selected
if (amenityType != null) {
- Bundle bundle = new Bundle();
bundle.putString(SearchPOIActivity.ANENITY_TYPE, amenityList.get(position));
- Intent newIntent = new Intent(SearchPOIListActivity.this, SearchPOIActivity.class);
- newIntent.putExtras(bundle);
- startActivityForResult(newIntent, 0);
+ } else {
+ bundle.putString(SearchPOIActivity.ANENITY_TYPE, "Closest_Anenities");
}
+ newIntent.putExtras(bundle);
+ startActivityForResult(newIntent, 0);
}
private AmenityType findAmenityType(String string) {