More elegant fix for #2657
This commit is contained in:
parent
d8dc055f82
commit
0927e79974
3 changed files with 18 additions and 0 deletions
|
@ -185,6 +185,14 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
// Issue 2657
|
||||
super.onDestroy();
|
||||
if (!(currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED)) {
|
||||
currentSearchTask.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
public Toolbar getClearToolbar(boolean visible) {
|
||||
final Toolbar tb = (Toolbar) findViewById(R.id.poiSplitbar);
|
||||
|
|
|
@ -215,6 +215,9 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
if (amenityList.size() == 0 && isAutomaticallyIncreaseSearch()) {
|
||||
int step = 5;
|
||||
while (amenityList.size() == 0 && step-- > 0 && isSearchFurtherAvailable()) {
|
||||
if (matcher != null && matcher.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
amenityList = searchFurther(lat, lon, matcher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -757,6 +757,10 @@ public class ResourceManager {
|
|||
try {
|
||||
if (!filter.isEmpty()) {
|
||||
for (AmenityIndexRepository index : amenityRepositories.values()) {
|
||||
if (matcher != null && matcher.isCancelled()) {
|
||||
searchAmenitiesInProgress = false;
|
||||
break;
|
||||
}
|
||||
if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) {
|
||||
List<Amenity> r = index.searchAmenities(MapUtils.get31TileNumberY(topLatitude),
|
||||
MapUtils.get31TileNumberX(leftLongitude), MapUtils.get31TileNumberY(bottomLatitude),
|
||||
|
@ -832,6 +836,9 @@ public class ResourceManager {
|
|||
List<Amenity> amenities = new ArrayList<Amenity>();
|
||||
List<AmenityIndexRepositoryBinary> list = new ArrayList<AmenityIndexRepositoryBinary>();
|
||||
for (AmenityIndexRepository index : amenityRepositories.values()) {
|
||||
if (matcher != null && matcher.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
if (index instanceof AmenityIndexRepositoryBinary) {
|
||||
if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) {
|
||||
if(index.checkContains(lat, lon)){
|
||||
|
|
Loading…
Reference in a new issue