add poi filters functionality
git-svn-id: https://osmand.googlecode.com/svn/trunk@154 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
d903637801
commit
865b834fb6
1 changed files with 3 additions and 8 deletions
|
@ -38,14 +38,10 @@ public class SearchPOIActivity extends ListActivity {
|
||||||
|
|
||||||
public static final String AMENITY_FILTER = "amenity_filter";
|
public static final String AMENITY_FILTER = "amenity_filter";
|
||||||
|
|
||||||
private List<Amenity> amenityList;
|
|
||||||
|
|
||||||
private Button searchPOILevel;
|
private Button searchPOILevel;
|
||||||
|
|
||||||
private PoiFilter filter;
|
private PoiFilter filter;
|
||||||
|
|
||||||
private AmenityAdapter amenityAdapter;
|
private AmenityAdapter amenityAdapter;
|
||||||
|
|
||||||
private LatLon lastKnownMapLocation;
|
private LatLon lastKnownMapLocation;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,8 +52,7 @@ public class SearchPOIActivity extends ListActivity {
|
||||||
searchPOILevel.setOnClickListener(new OnClickListener() {
|
searchPOILevel.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
amenityList = filter.searchFurther(lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude());
|
amenityAdapter.setNewModel(filter.searchFurther(lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||||
amenityAdapter.setNewModel(amenityList);
|
|
||||||
searchPOILevel.setEnabled(filter.isSearchFurtherAvailable());
|
searchPOILevel.setEnabled(filter.isSearchFurtherAvailable());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,7 +74,7 @@ public class SearchPOIActivity extends ListActivity {
|
||||||
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) {
|
||||||
Amenity amenity = amenityList.get(pos);
|
Amenity amenity = ((AmenityAdapter)getListAdapter()).getItem(pos);
|
||||||
String format = amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(v.getContext()));
|
String format = amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(v.getContext()));
|
||||||
if (amenity.getOpeningHours() != null) {
|
if (amenity.getOpeningHours() != null) {
|
||||||
format += "\nOpening hours : " + amenity.getOpeningHours();
|
format += "\nOpening hours : " + amenity.getOpeningHours();
|
||||||
|
@ -93,7 +88,7 @@ public class SearchPOIActivity extends ListActivity {
|
||||||
public void onListItemClick(ListView parent, View v, int position, long id) {
|
public void onListItemClick(ListView parent, View v, int position, long id) {
|
||||||
SharedPreferences prefs = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_READABLE);
|
SharedPreferences prefs = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_READABLE);
|
||||||
if (prefs != null) {
|
if (prefs != null) {
|
||||||
Amenity amenity = amenityList.get(position);
|
Amenity amenity = ((AmenityAdapter)getListAdapter()).getItem(position);
|
||||||
OsmandSettings.setMapLocationToShow(this, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude());
|
OsmandSettings.setMapLocationToShow(this, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude());
|
||||||
Intent newIntent = new Intent(SearchPOIActivity.this, MapActivity.class);
|
Intent newIntent = new Intent(SearchPOIActivity.this, MapActivity.class);
|
||||||
startActivity(newIntent);
|
startActivity(newIntent);
|
||||||
|
|
Loading…
Reference in a new issue