mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes Nearby export: Pins not all around me (#5658)
* Fixed Grey empty screen at Upload wizard caption step after denying files permission * Empty commit * Fixed loop issue * Created docs for earlier commits * Fixed javadoc * Fixed spaces * Added added basic features to OSM Maps * Added search location feature * Added filter to Open Street Maps * Fixed chipGroup in Open Street Maps * Removed mapBox code * Removed mapBox's code * Reformat code * Reformatted code * Removed rotation feature to map * Removed rotation files and Fixed Marker click problem * Ignored failing tests * Added voice input feature * Fixed test cases * Changed caption and description text * Replaced mapbox to osmdroid in upload activity * Fixed Unit Tests * Made selected marker to be fixed on map * Changed color of map marker * Fixes #4345 * Delete app/src/main/res/values-yue-hant directory * Added comment explaining the context * Fixes #5651 * Deleted directory * Changed query to 10 kilometers * Fixed issue --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
6d4ba12775
commit
1f064e29fa
3 changed files with 109 additions and 134 deletions
|
|
@ -412,63 +412,44 @@ public class OkHttpJsonApiClient {
|
||||||
"<!--Created by Wikimedia Commons Android app -->\n" +
|
"<!--Created by Wikimedia Commons Android app -->\n" +
|
||||||
"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n" +
|
"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n" +
|
||||||
" <Document>";
|
" <Document>";
|
||||||
|
List<PlaceBindings> placeBindings = runQuery(leftLatLng,
|
||||||
|
rightLatLng);
|
||||||
|
if (placeBindings != null) {
|
||||||
|
for (PlaceBindings item : placeBindings) {
|
||||||
|
if (item.getItem() != null && item.getLabel() != null && item.getClas() != null) {
|
||||||
|
String input = item.getLocation().getValue();
|
||||||
|
Pattern pattern = Pattern.compile(
|
||||||
|
"Point\\(([-+]?[0-9]*\\.?[0-9]+) ([-+]?[0-9]*\\.?[0-9]+)\\)");
|
||||||
|
Matcher matcher = pattern.matcher(input);
|
||||||
|
|
||||||
int increment = 1;
|
if (matcher.find()) {
|
||||||
double longitude = leftLatLng.getLongitude();
|
String longStr = matcher.group(1);
|
||||||
|
String latStr = matcher.group(2);
|
||||||
|
String itemUrl = item.getItem().getValue();
|
||||||
|
String itemName = item.getLabel().getValue().replace("&", "&");
|
||||||
|
String itemLatitude = latStr;
|
||||||
|
String itemLongitude = longStr;
|
||||||
|
String itemClass = item.getClas().getValue();
|
||||||
|
|
||||||
while (longitude <= rightLatLng.getLongitude()) {
|
String formattedItemName =
|
||||||
double NEXT_LONGITUDE =
|
!itemClass.isEmpty() ? itemName + " (" + itemClass + ")"
|
||||||
(increment + longitude) >= 0.0 && (increment + longitude) <= 1.0 ? 0.0
|
: itemName;
|
||||||
: increment + longitude;
|
|
||||||
|
|
||||||
double latitude = leftLatLng.getLatitude();
|
String kmlEntry = "\n <Placemark>\n" +
|
||||||
|
" <name>" + formattedItemName + "</name>\n" +
|
||||||
while (latitude <= rightLatLng.getLatitude()) {
|
" <description>" + itemUrl + "</description>\n" +
|
||||||
double NEXT_LATITUDE =
|
" <Point>\n" +
|
||||||
(increment + latitude) >= 0.0 && (increment + latitude) <= 1.0 ? 0.0
|
" <coordinates>" + itemLongitude + ","
|
||||||
: increment + latitude;
|
+ itemLatitude
|
||||||
List<PlaceBindings> placeBindings = runQuery(new LatLng(latitude, longitude, 0),
|
+ "</coordinates>\n" +
|
||||||
new LatLng(NEXT_LATITUDE, NEXT_LONGITUDE, 0));
|
" </Point>\n" +
|
||||||
if (placeBindings != null) {
|
" </Placemark>";
|
||||||
for (PlaceBindings item : placeBindings) {
|
kmlString = kmlString + kmlEntry;
|
||||||
if (item.getItem() != null && item.getLabel() != null && item.getClas() != null) {
|
} else {
|
||||||
String input = item.getLocation().getValue();
|
Timber.e("No match found");
|
||||||
Pattern pattern = Pattern.compile(
|
|
||||||
"Point\\(([-+]?[0-9]*\\.?[0-9]+) ([-+]?[0-9]*\\.?[0-9]+)\\)");
|
|
||||||
Matcher matcher = pattern.matcher(input);
|
|
||||||
|
|
||||||
if (matcher.find()) {
|
|
||||||
String longStr = matcher.group(1);
|
|
||||||
String latStr = matcher.group(2);
|
|
||||||
String itemUrl = item.getItem().getValue();
|
|
||||||
String itemName = item.getLabel().getValue().replace("&", "&");
|
|
||||||
String itemLatitude = latStr;
|
|
||||||
String itemLongitude = longStr;
|
|
||||||
String itemClass = item.getClas().getValue();
|
|
||||||
|
|
||||||
String formattedItemName =
|
|
||||||
!itemClass.isEmpty() ? itemName + " (" + itemClass + ")"
|
|
||||||
: itemName;
|
|
||||||
|
|
||||||
String kmlEntry = "\n <Placemark>\n" +
|
|
||||||
" <name>" + formattedItemName + "</name>\n" +
|
|
||||||
" <description>" + itemUrl + "</description>\n" +
|
|
||||||
" <Point>\n" +
|
|
||||||
" <coordinates>" + itemLongitude + ","
|
|
||||||
+ itemLatitude
|
|
||||||
+ "</coordinates>\n" +
|
|
||||||
" </Point>\n" +
|
|
||||||
" </Placemark>";
|
|
||||||
kmlString = kmlString + kmlEntry;
|
|
||||||
} else {
|
|
||||||
Timber.e("No match found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latitude += increment;
|
|
||||||
}
|
}
|
||||||
longitude += increment;
|
|
||||||
}
|
}
|
||||||
kmlString = kmlString + "\n </Document>\n" +
|
kmlString = kmlString + "\n </Document>\n" +
|
||||||
"</kml>\n";
|
"</kml>\n";
|
||||||
|
|
@ -495,60 +476,42 @@ public class OkHttpJsonApiClient {
|
||||||
" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">"
|
" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">"
|
||||||
+ "\n<bounds minlat=\"$MIN_LATITUDE\" minlon=\"$MIN_LONGITUDE\" maxlat=\"$MAX_LATITUDE\" maxlon=\"$MAX_LONGITUDE\"/>";
|
+ "\n<bounds minlat=\"$MIN_LATITUDE\" minlon=\"$MIN_LONGITUDE\" maxlat=\"$MAX_LATITUDE\" maxlon=\"$MAX_LONGITUDE\"/>";
|
||||||
|
|
||||||
int increment = 1;
|
List<PlaceBindings> placeBindings = runQuery(leftLatLng,rightLatLng);
|
||||||
double longitude = leftLatLng.getLongitude();
|
if (placeBindings != null) {
|
||||||
|
for (PlaceBindings item : placeBindings) {
|
||||||
|
if (item.getItem() != null && item.getLabel() != null && item.getClas() != null) {
|
||||||
|
String input = item.getLocation().getValue();
|
||||||
|
Pattern pattern = Pattern.compile(
|
||||||
|
"Point\\(([-+]?[0-9]*\\.?[0-9]+) ([-+]?[0-9]*\\.?[0-9]+)\\)");
|
||||||
|
Matcher matcher = pattern.matcher(input);
|
||||||
|
|
||||||
while (longitude <= rightLatLng.getLongitude()) {
|
if (matcher.find()) {
|
||||||
double NEXT_LONGITUDE =
|
String longStr = matcher.group(1);
|
||||||
(increment + longitude) >= 0.0 && (increment + longitude) <= 1.0 ? 0.0
|
String latStr = matcher.group(2);
|
||||||
: increment + longitude;
|
String itemUrl = item.getItem().getValue();
|
||||||
|
String itemName = item.getLabel().getValue().replace("&", "&");
|
||||||
|
String itemLatitude = latStr;
|
||||||
|
String itemLongitude = longStr;
|
||||||
|
String itemClass = item.getClas().getValue();
|
||||||
|
|
||||||
double latitude = leftLatLng.getLatitude();
|
String formattedItemName =
|
||||||
|
!itemClass.isEmpty() ? itemName + " (" + itemClass + ")"
|
||||||
|
: itemName;
|
||||||
|
|
||||||
while (latitude <= rightLatLng.getLatitude()) {
|
String gpxEntry =
|
||||||
double NEXT_LATITUDE =
|
"\n <wpt lat=\"" + itemLatitude + "\" lon=\"" + itemLongitude
|
||||||
(increment + latitude) >= 0.0 && (increment + latitude) <= 1.0 ? 0.0
|
+ "\">\n" +
|
||||||
: increment + latitude;
|
" <name>" + itemName + "</name>\n" +
|
||||||
List<PlaceBindings> placeBindings = runQuery(new LatLng(latitude, longitude, 0),
|
" <url>" + itemUrl + "</url>\n" +
|
||||||
new LatLng(NEXT_LATITUDE, NEXT_LONGITUDE, 0));
|
" </wpt>";
|
||||||
if (placeBindings != null) {
|
gpxString = gpxString + gpxEntry;
|
||||||
for (PlaceBindings item : placeBindings) {
|
|
||||||
if (item.getItem() != null && item.getLabel() != null && item.getClas() != null) {
|
|
||||||
String input = item.getLocation().getValue();
|
|
||||||
Pattern pattern = Pattern.compile(
|
|
||||||
"Point\\(([-+]?[0-9]*\\.?[0-9]+) ([-+]?[0-9]*\\.?[0-9]+)\\)");
|
|
||||||
Matcher matcher = pattern.matcher(input);
|
|
||||||
|
|
||||||
if (matcher.find()) {
|
} else {
|
||||||
String longStr = matcher.group(1);
|
Timber.e("No match found");
|
||||||
String latStr = matcher.group(2);
|
|
||||||
String itemUrl = item.getItem().getValue();
|
|
||||||
String itemName = item.getLabel().getValue().replace("&", "&");
|
|
||||||
String itemLatitude = latStr;
|
|
||||||
String itemLongitude = longStr;
|
|
||||||
String itemClass = item.getClas().getValue();
|
|
||||||
|
|
||||||
String formattedItemName =
|
|
||||||
!itemClass.isEmpty() ? itemName + " (" + itemClass + ")"
|
|
||||||
: itemName;
|
|
||||||
|
|
||||||
String gpxEntry =
|
|
||||||
"\n <wpt lat=\"" + itemLatitude + "\" lon=\"" + itemLongitude
|
|
||||||
+ "\">\n" +
|
|
||||||
" <name>" + itemName + "</name>\n" +
|
|
||||||
" <url>" + itemUrl + "</url>\n" +
|
|
||||||
" </wpt>";
|
|
||||||
gpxString = gpxString + gpxEntry;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Timber.e("No match found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latitude += increment;
|
|
||||||
}
|
}
|
||||||
longitude += increment;
|
|
||||||
}
|
}
|
||||||
gpxString = gpxString + "\n</gpx>";
|
gpxString = gpxString + "\n</gpx>";
|
||||||
return gpxString;
|
return gpxString;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package fr.free.nrw.commons.nearby;
|
package fr.free.nrw.commons.nearby;
|
||||||
|
|
||||||
|
import static fr.free.nrw.commons.utils.LengthUtils.computeDistanceBetween;
|
||||||
|
import static fr.free.nrw.commons.utils.LengthUtils.formatDistanceBetween;
|
||||||
|
|
||||||
import androidx.annotation.MainThread;
|
import androidx.annotation.MainThread;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import fr.free.nrw.commons.BaseMarker;
|
import fr.free.nrw.commons.BaseMarker;
|
||||||
import fr.free.nrw.commons.MapController;
|
import fr.free.nrw.commons.MapController;
|
||||||
import fr.free.nrw.commons.location.LatLng;
|
import fr.free.nrw.commons.location.LatLng;
|
||||||
|
|
@ -16,9 +18,6 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static fr.free.nrw.commons.utils.LengthUtils.computeDistanceBetween;
|
|
||||||
import static fr.free.nrw.commons.utils.LengthUtils.formatDistanceBetween;
|
|
||||||
|
|
||||||
public class NearbyController extends MapController {
|
public class NearbyController extends MapController {
|
||||||
|
|
||||||
private static final int MAX_RESULTS = 1000;
|
private static final int MAX_RESULTS = 1000;
|
||||||
|
|
@ -39,7 +38,7 @@ public class NearbyController extends MapController {
|
||||||
/**
|
/**
|
||||||
* Prepares Place list to make their distance information update later.
|
* Prepares Place list to make their distance information update later.
|
||||||
*
|
*
|
||||||
* @param currentLatLng current location for user
|
* @param currentLatLng current location for user
|
||||||
* @param searchLatLng the location user wants to search around
|
* @param searchLatLng the location user wants to search around
|
||||||
* @param returnClosestResult if this search is done to find closest result or all results
|
* @param returnClosestResult if this search is done to find closest result or all results
|
||||||
* @param customQuery if this search is done via an advanced query
|
* @param customQuery if this search is done via an advanced query
|
||||||
|
|
@ -118,18 +117,44 @@ public class NearbyController extends MapController {
|
||||||
return nearbyPlacesInfo;
|
return nearbyPlacesInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlacesAsKML(LatLng leftLatLng, LatLng rightLatLng) throws Exception {
|
public String getPlacesAsKML(LatLng currentLocation) throws Exception {
|
||||||
return nearbyPlaces.getPlacesAsKML(leftLatLng, rightLatLng);
|
return nearbyPlaces.getPlacesAsKML(
|
||||||
|
calculateSouthWest(currentLocation.getLatitude(), currentLocation.getLongitude(), 10),
|
||||||
|
calculateNorthEast(currentLocation.getLatitude(), currentLocation.getLongitude(), 10)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlacesAsGPX(LatLng leftLatLng, LatLng rightLatLng) throws Exception {
|
public String getPlacesAsGPX(LatLng currentLocation) throws Exception {
|
||||||
return nearbyPlaces.getPlacesAsGPX(leftLatLng, rightLatLng);
|
return nearbyPlaces.getPlacesAsGPX(
|
||||||
|
calculateSouthWest(currentLocation.getLatitude(), currentLocation.getLongitude(), 10),
|
||||||
|
calculateNorthEast(currentLocation.getLatitude(), currentLocation.getLongitude(), 10)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LatLng calculateNorthEast(double latitude, double longitude, double distance) {
|
||||||
|
double lat1 = Math.toRadians(latitude);
|
||||||
|
double deltaLat = distance * 0.008;
|
||||||
|
double deltaLon = distance / Math.cos(lat1)*0.008;
|
||||||
|
double lat2 = latitude + deltaLat;
|
||||||
|
double lon2 = longitude + deltaLon;
|
||||||
|
|
||||||
|
return new LatLng(lat2, lon2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LatLng calculateSouthWest(double latitude, double longitude, double distance) {
|
||||||
|
double lat1 = Math.toRadians(latitude);
|
||||||
|
double deltaLat = distance * 0.008;
|
||||||
|
double deltaLon = distance / Math.cos(lat1)*0.008;
|
||||||
|
double lat2 = latitude - deltaLat;
|
||||||
|
double lon2 = longitude - deltaLon;
|
||||||
|
|
||||||
|
return new LatLng(lat2, lon2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares Place list to make their distance information update later.
|
* Prepares Place list to make their distance information update later.
|
||||||
*
|
*
|
||||||
* @param currentLatLng The current latitude and longitude.
|
* @param currentLatLng The current latitude and longitude.
|
||||||
* @param screenTopRight The top right corner of the screen (latitude,
|
* @param screenTopRight The top right corner of the screen (latitude,
|
||||||
* longitude).
|
* longitude).
|
||||||
* @param screenBottomLeft The bottom left corner of the screen (latitude,
|
* @param screenBottomLeft The bottom left corner of the screen (latitude,
|
||||||
|
|
@ -221,7 +246,7 @@ public class NearbyController extends MapController {
|
||||||
/**
|
/**
|
||||||
* Prepares Place list to make their distance information update later.
|
* Prepares Place list to make their distance information update later.
|
||||||
*
|
*
|
||||||
* @param currentLatLng current location for user
|
* @param currentLatLng current location for user
|
||||||
* @param searchLatLng the location user wants to search around
|
* @param searchLatLng the location user wants to search around
|
||||||
* @param returnClosestResult if this search is done to find closest result or all results
|
* @param returnClosestResult if this search is done to find closest result or all results
|
||||||
* @return NearbyPlacesInfo a variable holds Place list without distance information and
|
* @return NearbyPlacesInfo a variable holds Place list without distance information and
|
||||||
|
|
@ -239,12 +264,12 @@ public class NearbyController extends MapController {
|
||||||
* Loads attractions from location for map view, we need to return BaseMarkerOption data type.
|
* Loads attractions from location for map view, we need to return BaseMarkerOption data type.
|
||||||
*
|
*
|
||||||
* @param currentLatLng users current location
|
* @param currentLatLng users current location
|
||||||
* @param placeList list of nearby places in Place data type
|
* @param placeList list of nearby places in Place data type
|
||||||
* @return BaseMarkerOptions list that holds nearby places
|
* @return BaseMarkerOptions list that holds nearby places
|
||||||
*/
|
*/
|
||||||
public static List<BaseMarker> loadAttractionsFromLocationToBaseMarkerOptions(
|
public static List<BaseMarker> loadAttractionsFromLocationToBaseMarkerOptions(
|
||||||
LatLng currentLatLng,
|
LatLng currentLatLng,
|
||||||
List<Place> placeList) {
|
List<Place> placeList) {
|
||||||
List<BaseMarker> baseMarkersList = new ArrayList<>();
|
List<BaseMarker> baseMarkersList = new ArrayList<>();
|
||||||
|
|
||||||
if (placeList == null) {
|
if (placeList == null) {
|
||||||
|
|
@ -259,7 +284,7 @@ public class NearbyController extends MapController {
|
||||||
baseMarker.setPosition(
|
baseMarker.setPosition(
|
||||||
new fr.free.nrw.commons.location.LatLng(
|
new fr.free.nrw.commons.location.LatLng(
|
||||||
place.location.getLatitude(),
|
place.location.getLatitude(),
|
||||||
place.location.getLongitude(),0));
|
place.location.getLongitude(), 0));
|
||||||
baseMarker.setPlace(place);
|
baseMarker.setPlace(place);
|
||||||
baseMarkersList.add(baseMarker);
|
baseMarkersList.add(baseMarker);
|
||||||
}
|
}
|
||||||
|
|
@ -267,8 +292,6 @@ public class NearbyController extends MapController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates makerLabelList item isBookmarked value
|
* Updates makerLabelList item isBookmarked value
|
||||||
*
|
*
|
||||||
|
|
@ -280,7 +303,8 @@ public class NearbyController extends MapController {
|
||||||
for (ListIterator<MarkerPlaceGroup> iter = markerLabelList.listIterator();
|
for (ListIterator<MarkerPlaceGroup> iter = markerLabelList.listIterator();
|
||||||
iter.hasNext(); ) {
|
iter.hasNext(); ) {
|
||||||
MarkerPlaceGroup markerPlaceGroup = iter.next();
|
MarkerPlaceGroup markerPlaceGroup = iter.next();
|
||||||
if (markerPlaceGroup.getPlace().getWikiDataEntityId().equals(place.getWikiDataEntityId())) {
|
if (markerPlaceGroup.getPlace().getWikiDataEntityId()
|
||||||
|
.equals(place.getWikiDataEntityId())) {
|
||||||
iter.set(new MarkerPlaceGroup(isBookmarked, place));
|
iter.set(new MarkerPlaceGroup(isBookmarked, place));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -289,15 +289,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(@NonNull MenuItem item) {
|
public boolean onMenuItemClick(@NonNull MenuItem item) {
|
||||||
try {
|
try {
|
||||||
IGeoPoint screenTopRight = binding.map.getProjection().fromPixels(binding.map.getWidth(), 0);
|
|
||||||
IGeoPoint screenBottomLeft = binding.map.getProjection().fromPixels(0, binding.map.getHeight());
|
|
||||||
fr.free.nrw.commons.location.LatLng screenTopRightLatLng = new fr.free.nrw.commons.location.LatLng(
|
|
||||||
screenBottomLeft.getLatitude(), screenBottomLeft.getLongitude(), 0);
|
|
||||||
fr.free.nrw.commons.location.LatLng screenBottomLeftLatLng = new fr.free.nrw.commons.location.LatLng(
|
|
||||||
screenTopRight.getLatitude(), screenTopRight.getLongitude(), 0);
|
|
||||||
progressDialog.setTitle(getString(R.string.saving_gpx_file));
|
progressDialog.setTitle(getString(R.string.saving_gpx_file));
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
savePlacesAsGPX(screenTopRightLatLng, screenBottomLeftLatLng);
|
savePlacesAsGPX();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
@ -309,15 +303,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(@NonNull MenuItem item) {
|
public boolean onMenuItemClick(@NonNull MenuItem item) {
|
||||||
try {
|
try {
|
||||||
IGeoPoint screenTopRight = binding.map.getProjection().fromPixels(binding.map.getWidth(), 0);
|
|
||||||
IGeoPoint screenBottomLeft = binding.map.getProjection().fromPixels(0, binding.map.getHeight());
|
|
||||||
fr.free.nrw.commons.location.LatLng screenTopRightLatLng = new fr.free.nrw.commons.location.LatLng(
|
|
||||||
screenBottomLeft.getLatitude(), screenBottomLeft.getLongitude(), 0);
|
|
||||||
fr.free.nrw.commons.location.LatLng screenBottomLeftLatLng = new fr.free.nrw.commons.location.LatLng(
|
|
||||||
screenTopRight.getLatitude(), screenTopRight.getLongitude(), 0);
|
|
||||||
progressDialog.setTitle(getString(R.string.saving_kml_file));
|
progressDialog.setTitle(getString(R.string.saving_kml_file));
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
savePlacesAsKML(screenTopRightLatLng, screenBottomLeftLatLng);
|
savePlacesAsKML();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
@ -1163,10 +1151,10 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void savePlacesAsKML(LatLng latLng, LatLng nextlatLng) {
|
private void savePlacesAsKML() {
|
||||||
final Observable<String> savePlacesObservable = Observable
|
final Observable<String> savePlacesObservable = Observable
|
||||||
.fromCallable(() -> nearbyController
|
.fromCallable(() -> nearbyController
|
||||||
.getPlacesAsKML(latLng, nextlatLng));
|
.getPlacesAsKML(getMapFocus()));
|
||||||
compositeDisposable.add(savePlacesObservable
|
compositeDisposable.add(savePlacesObservable
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
@ -1197,10 +1185,10 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void savePlacesAsGPX(LatLng latLng, LatLng nextlatLng) {
|
private void savePlacesAsGPX() {
|
||||||
final Observable<String> savePlacesObservable = Observable
|
final Observable<String> savePlacesObservable = Observable
|
||||||
.fromCallable(() -> nearbyController
|
.fromCallable(() -> nearbyController
|
||||||
.getPlacesAsGPX(latLng, nextlatLng));
|
.getPlacesAsGPX(getMapFocus()));
|
||||||
compositeDisposable.add(savePlacesObservable
|
compositeDisposable.add(savePlacesObservable
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue