Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
90f2429811
4 changed files with 14 additions and 32 deletions
|
@ -73,7 +73,7 @@
|
|||
</provider>
|
||||
|
||||
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name"
|
||||
android:screenOrientation="unspecified" android:launchMode="singleTop" android:windowSoftInputMode="adjustResize">
|
||||
android:screenOrientation="unspecified" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
|
|
|
@ -118,7 +118,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
private static int RESULT_REQUEST_CODE = 54;
|
||||
|
||||
private CharSequence tChange;
|
||||
public static boolean stopSearching = false;
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu omenu) {
|
||||
|
@ -186,14 +185,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
// Issue 2657
|
||||
super.onDestroy();
|
||||
if (!(currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED)) {
|
||||
stopSearching = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Toolbar getClearToolbar(boolean visible) {
|
||||
final Toolbar tb = (Toolbar) findViewById(R.id.poiSplitbar);
|
||||
|
@ -210,7 +201,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
.show();
|
||||
return true;
|
||||
}
|
||||
if ((isNameSearch() && !Algorithms.objectEquals(filter.getFilterByName(), query)) || stopSearching) {
|
||||
if ((isNameSearch() && !Algorithms.objectEquals(filter.getFilterByName(), query)) ) {
|
||||
filter.clearPreviousZoom();
|
||||
filter.setFilterByName(query);
|
||||
runNewSearchQuery(location, NEW_SEARCH_INIT);
|
||||
|
@ -474,7 +465,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
}
|
||||
|
||||
private synchronized void runNewSearchQuery(net.osmand.Location location, int requestType) {
|
||||
if (currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED) {
|
||||
if (currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED ) {
|
||||
currentSearchTask = new SearchAmenityTask(location, requestType);
|
||||
currentSearchTask.execute();
|
||||
}
|
||||
|
@ -617,6 +608,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
public SearchAmenityTask(net.osmand.Location location, int requestType) {
|
||||
this.searchLocation = location;
|
||||
this.requestType = requestType;
|
||||
|
||||
}
|
||||
|
||||
net.osmand.Location getSearchedLocation() {
|
||||
|
@ -648,28 +640,28 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(List<Amenity> result) {
|
||||
setSupportProgressBarIndeterminateVisibility(false);
|
||||
currentSearchTask = null;
|
||||
updateButtonState(false);
|
||||
if (isNameSearch()) {
|
||||
if (isNominatimFilter() && !Algorithms.isEmpty(((NominatimPoiFilter) filter).getLastError())) {
|
||||
Toast.makeText(SearchPOIActivity.this, ((NominatimPoiFilter) filter).getLastError(),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
amenityAdapter.setNewModel(result);
|
||||
if(showOnMapItem != null) {
|
||||
showOnMapItem.setEnabled(amenityAdapter.getCount() > 0);
|
||||
}
|
||||
} else {
|
||||
amenityAdapter.setNewModel(result);
|
||||
}
|
||||
amenityAdapter.setNewModel(result);
|
||||
amenityAdapter.notifyDataSetChanged();
|
||||
lastSearchedLocation = searchLocation;
|
||||
setSupportProgressBarIndeterminateVisibility(false);
|
||||
stopSearching = false;
|
||||
currentSearchTask = null;
|
||||
//Toast.makeText(SearchPOIActivity.this, "onPostExecute has run", Toast.LENGTH_SHORT).show();
|
||||
// Issue #2667 (1)
|
||||
if (tChange != null) {
|
||||
changeFilter(tChange);
|
||||
tChange = null;
|
||||
}
|
||||
updateButtonState(false);
|
||||
amenityAdapter.notifyDataSetChanged();
|
||||
lastSearchedLocation = searchLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,6 @@ import net.osmand.osm.PoiType;
|
|||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchPOIActivity;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
|
|
|
@ -45,7 +45,6 @@ import net.osmand.plus.resources.AsyncLoadingThread.TileLoadDownloadRequest;
|
|||
import net.osmand.plus.resources.AsyncLoadingThread.TransportLoadRequest;
|
||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.activities.search.SearchPOIActivity;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
@ -758,10 +757,6 @@ public class ResourceManager {
|
|||
try {
|
||||
if (!filter.isEmpty()) {
|
||||
for (AmenityIndexRepository index : amenityRepositories.values()) {
|
||||
if (SearchPOIActivity.stopSearching) {
|
||||
searchAmenitiesInProgress = false;
|
||||
break;
|
||||
}
|
||||
if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) {
|
||||
List<Amenity> r = index.searchAmenities(MapUtils.get31TileNumberY(topLatitude),
|
||||
MapUtils.get31TileNumberX(leftLongitude), MapUtils.get31TileNumberY(bottomLatitude),
|
||||
|
@ -837,9 +832,6 @@ public class ResourceManager {
|
|||
List<Amenity> amenities = new ArrayList<Amenity>();
|
||||
List<AmenityIndexRepositoryBinary> list = new ArrayList<AmenityIndexRepositoryBinary>();
|
||||
for (AmenityIndexRepository index : amenityRepositories.values()) {
|
||||
if (SearchPOIActivity.stopSearching) {
|
||||
break;
|
||||
}
|
||||
if (index instanceof AmenityIndexRepositoryBinary) {
|
||||
if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) {
|
||||
if(index.checkContains(lat, lon)){
|
||||
|
@ -847,6 +839,7 @@ public class ResourceManager {
|
|||
} else {
|
||||
list.add((AmenityIndexRepositoryBinary) index);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -863,14 +856,12 @@ public class ResourceManager {
|
|||
if (matcher != null && matcher.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
if (SearchPOIActivity.stopSearching) {
|
||||
break;
|
||||
}
|
||||
List<Amenity> result = index.searchAmenitiesByName(MapUtils.get31TileNumberX(lon), MapUtils.get31TileNumberY(lat),
|
||||
left, top, right, bottom,
|
||||
searchQuery, matcher);
|
||||
amenities.addAll(result);
|
||||
}
|
||||
|
||||
return amenities;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue