Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-06-13 23:39:12 +02:00
commit 90f2429811
4 changed files with 14 additions and 32 deletions

View file

@ -73,7 +73,7 @@
</provider> </provider>
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name" <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> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />

View file

@ -118,7 +118,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
private static int RESULT_REQUEST_CODE = 54; private static int RESULT_REQUEST_CODE = 54;
private CharSequence tChange; private CharSequence tChange;
public static boolean stopSearching = false;
@Override @Override
public boolean onCreateOptionsMenu(Menu omenu) { public boolean onCreateOptionsMenu(Menu omenu) {
@ -186,14 +185,6 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
return true; return true;
} }
@Override
protected void onDestroy() {
// Issue 2657
super.onDestroy();
if (!(currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED)) {
stopSearching = true;
}
}
public Toolbar getClearToolbar(boolean visible) { public Toolbar getClearToolbar(boolean visible) {
final Toolbar tb = (Toolbar) findViewById(R.id.poiSplitbar); final Toolbar tb = (Toolbar) findViewById(R.id.poiSplitbar);
@ -210,7 +201,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
.show(); .show();
return true; return true;
} }
if ((isNameSearch() && !Algorithms.objectEquals(filter.getFilterByName(), query)) || stopSearching) { if ((isNameSearch() && !Algorithms.objectEquals(filter.getFilterByName(), query)) ) {
filter.clearPreviousZoom(); filter.clearPreviousZoom();
filter.setFilterByName(query); filter.setFilterByName(query);
runNewSearchQuery(location, NEW_SEARCH_INIT); runNewSearchQuery(location, NEW_SEARCH_INIT);
@ -617,6 +608,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
public SearchAmenityTask(net.osmand.Location location, int requestType) { public SearchAmenityTask(net.osmand.Location location, int requestType) {
this.searchLocation = location; this.searchLocation = location;
this.requestType = requestType; this.requestType = requestType;
} }
net.osmand.Location getSearchedLocation() { net.osmand.Location getSearchedLocation() {
@ -648,28 +640,28 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
@Override @Override
protected void onPostExecute(List<Amenity> result) { protected void onPostExecute(List<Amenity> result) {
setSupportProgressBarIndeterminateVisibility(false);
currentSearchTask = null;
updateButtonState(false);
if (isNameSearch()) { if (isNameSearch()) {
if (isNominatimFilter() && !Algorithms.isEmpty(((NominatimPoiFilter) filter).getLastError())) { if (isNominatimFilter() && !Algorithms.isEmpty(((NominatimPoiFilter) filter).getLastError())) {
Toast.makeText(SearchPOIActivity.this, ((NominatimPoiFilter) filter).getLastError(), Toast.makeText(SearchPOIActivity.this, ((NominatimPoiFilter) filter).getLastError(),
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
} }
amenityAdapter.setNewModel(result);
if(showOnMapItem != null) { if(showOnMapItem != null) {
showOnMapItem.setEnabled(amenityAdapter.getCount() > 0); 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) // Issue #2667 (1)
if (tChange != null) { if (tChange != null) {
changeFilter(tChange); changeFilter(tChange);
tChange = null; tChange = null;
} }
updateButtonState(false); amenityAdapter.notifyDataSetChanged();
lastSearchedLocation = searchLocation;
} }
@Override @Override

View file

@ -30,7 +30,6 @@ import net.osmand.osm.PoiType;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.search.SearchPOIActivity;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import net.osmand.util.OpeningHoursParser; import net.osmand.util.OpeningHoursParser;

View file

@ -45,7 +45,6 @@ import net.osmand.plus.resources.AsyncLoadingThread.TileLoadDownloadRequest;
import net.osmand.plus.resources.AsyncLoadingThread.TransportLoadRequest; import net.osmand.plus.resources.AsyncLoadingThread.TransportLoadRequest;
import net.osmand.plus.srtmplugin.SRTMPlugin; import net.osmand.plus.srtmplugin.SRTMPlugin;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.activities.search.SearchPOIActivity;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
@ -758,10 +757,6 @@ public class ResourceManager {
try { try {
if (!filter.isEmpty()) { if (!filter.isEmpty()) {
for (AmenityIndexRepository index : amenityRepositories.values()) { for (AmenityIndexRepository index : amenityRepositories.values()) {
if (SearchPOIActivity.stopSearching) {
searchAmenitiesInProgress = false;
break;
}
if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) { if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) {
List<Amenity> r = index.searchAmenities(MapUtils.get31TileNumberY(topLatitude), List<Amenity> r = index.searchAmenities(MapUtils.get31TileNumberY(topLatitude),
MapUtils.get31TileNumberX(leftLongitude), MapUtils.get31TileNumberY(bottomLatitude), MapUtils.get31TileNumberX(leftLongitude), MapUtils.get31TileNumberY(bottomLatitude),
@ -837,9 +832,6 @@ public class ResourceManager {
List<Amenity> amenities = new ArrayList<Amenity>(); List<Amenity> amenities = new ArrayList<Amenity>();
List<AmenityIndexRepositoryBinary> list = new ArrayList<AmenityIndexRepositoryBinary>(); List<AmenityIndexRepositoryBinary> list = new ArrayList<AmenityIndexRepositoryBinary>();
for (AmenityIndexRepository index : amenityRepositories.values()) { for (AmenityIndexRepository index : amenityRepositories.values()) {
if (SearchPOIActivity.stopSearching) {
break;
}
if (index instanceof AmenityIndexRepositoryBinary) { if (index instanceof AmenityIndexRepositoryBinary) {
if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) { if (index.checkContains(topLatitude, leftLongitude, bottomLatitude, rightLongitude)) {
if(index.checkContains(lat, lon)){ if(index.checkContains(lat, lon)){
@ -847,6 +839,7 @@ public class ResourceManager {
} else { } else {
list.add((AmenityIndexRepositoryBinary) index); list.add((AmenityIndexRepositoryBinary) index);
} }
} }
} }
} }
@ -863,14 +856,12 @@ public class ResourceManager {
if (matcher != null && matcher.isCancelled()) { if (matcher != null && matcher.isCancelled()) {
break; break;
} }
if (SearchPOIActivity.stopSearching) {
break;
}
List<Amenity> result = index.searchAmenitiesByName(MapUtils.get31TileNumberX(lon), MapUtils.get31TileNumberY(lat), List<Amenity> result = index.searchAmenitiesByName(MapUtils.get31TileNumberX(lon), MapUtils.get31TileNumberY(lat),
left, top, right, bottom, left, top, right, bottom,
searchQuery, matcher); searchQuery, matcher);
amenities.addAll(result); amenities.addAll(result);
} }
return amenities; return amenities;
} }