mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Try to load un search this area is called
This commit is contained in:
parent
ab7f352bd2
commit
026a944859
3 changed files with 15 additions and 5 deletions
|
|
@ -103,7 +103,7 @@ public class NearbyController {
|
||||||
latestSearchRadius = nearbyPlaces.radius*1000; // to meter
|
latestSearchRadius = nearbyPlaces.radius*1000; // to meter
|
||||||
|
|
||||||
if (checkingAroundCurrentLocation) {
|
if (checkingAroundCurrentLocation) {
|
||||||
currentLocationSearchRadius = nearbyPlaces.radius;
|
currentLocationSearchRadius = nearbyPlaces.radius*1000; // to meter
|
||||||
currentLocation = curLatLng;
|
currentLocation = curLatLng;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
//showErrorMessage(getString(R.string.error_fetching_nearby_places));
|
//showErrorMessage(getString(R.string.error_fetching_nearby_places));
|
||||||
// TODO solve first unneeded method call here
|
// TODO solve first unneeded method call here
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
//nearbyParentFragmentPresenter.lockNearby(false);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,12 +153,16 @@ public class NearbyParentFragmentPresenter
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateMapAndList(LocationServiceManager.LocationChangeType locationChangeType, LatLng cameraTarget) {
|
public void updateMapAndList(LocationServiceManager.LocationChangeType locationChangeType, LatLng cameraTarget) {
|
||||||
|
Log.d("deneme2","update map and list is called");
|
||||||
if (isNearbyLocked) {
|
if (isNearbyLocked) {
|
||||||
|
Log.d("deneme2","isNearbyLocked");
|
||||||
|
|
||||||
Timber.d("Nearby is locked, so updateMapAndList returns");
|
Timber.d("Nearby is locked, so updateMapAndList returns");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nearbyParentFragmentView.isNetworkConnectionEstablished()) {
|
if (!nearbyParentFragmentView.isNetworkConnectionEstablished()) {
|
||||||
|
Log.d("deneme2","isNetworkConnectionEstablished");
|
||||||
Timber.d("Network connection is not established");
|
Timber.d("Network connection is not established");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -172,6 +176,8 @@ public class NearbyParentFragmentPresenter
|
||||||
curLatLng = lastLocation;
|
curLatLng = lastLocation;
|
||||||
|
|
||||||
if (curLatLng == null) {
|
if (curLatLng == null) {
|
||||||
|
Log.d("deneme2","curLatLng == null");
|
||||||
|
|
||||||
Timber.d("Skipping update of nearby places as location is unavailable");
|
Timber.d("Skipping update of nearby places as location is unavailable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -182,17 +188,20 @@ public class NearbyParentFragmentPresenter
|
||||||
*/
|
*/
|
||||||
if (locationChangeType.equals(LOCATION_SIGNIFICANTLY_CHANGED)
|
if (locationChangeType.equals(LOCATION_SIGNIFICANTLY_CHANGED)
|
||||||
|| locationChangeType.equals(MAP_UPDATED)) {
|
|| locationChangeType.equals(MAP_UPDATED)) {
|
||||||
|
Log.d("deneme2","LOCATION_SIGNIFICANTLY_CHANGED");
|
||||||
nearbyParentFragmentView.populatePlaces(lastLocation, lastLocation);
|
nearbyParentFragmentView.populatePlaces(lastLocation, lastLocation);
|
||||||
|
nearbyParentFragmentView.setSearchThisAreaProgressVisibility(false);
|
||||||
//nearbyMapFragmentView.updateMapToTrackPosition(curLatLng);
|
//nearbyMapFragmentView.updateMapToTrackPosition(curLatLng);
|
||||||
// TODO: when unneeded populate places call problem is solved, open commented out line and remove it from update map markers method
|
// TODO: when unneeded populate places call problem is solved, open commented out line and remove it from update map markers method
|
||||||
// TODO dont forget map updated state after an wikidata item is updated
|
// TODO dont forget map updated state after an wikidata item is updated
|
||||||
|
|
||||||
} else if (locationChangeType.equals(SEARCH_CUSTOM_AREA)) {
|
} else if (locationChangeType.equals(SEARCH_CUSTOM_AREA)) {
|
||||||
|
Log.d("deneme2","SEARCH_CUSTOM_AREA");
|
||||||
nearbyParentFragmentView.populatePlaces(lastLocation, cameraTarget);
|
nearbyParentFragmentView.populatePlaces(lastLocation, cameraTarget);
|
||||||
|
nearbyParentFragmentView.setSearchThisAreaProgressVisibility(false);
|
||||||
searchingThisArea = false;
|
searchingThisArea = false;
|
||||||
}
|
} else { // Means location changed slightly, ie user is walking or driving.
|
||||||
|
Log.d("deneme2","SLIGHT");
|
||||||
else { // Means location changed slightly, ie user is walking or driving.
|
|
||||||
nearbyMapFragmentView.updateMapToTrackPosition(curLatLng);
|
nearbyMapFragmentView.updateMapToTrackPosition(curLatLng);
|
||||||
searchingThisArea = false;
|
searchingThisArea = false;
|
||||||
}
|
}
|
||||||
|
|
@ -287,7 +296,7 @@ public class NearbyParentFragmentPresenter
|
||||||
double distance = LocationUtils.commonsLatLngToMapBoxLatLng(getCameraTarget())
|
double distance = LocationUtils.commonsLatLngToMapBoxLatLng(getCameraTarget())
|
||||||
.distanceTo(new com.mapbox.mapboxsdk.geometry.LatLng(NearbyController.currentLocation.getLatitude()
|
.distanceTo(new com.mapbox.mapboxsdk.geometry.LatLng(NearbyController.currentLocation.getLatitude()
|
||||||
, NearbyController.currentLocation.getLongitude()));
|
, NearbyController.currentLocation.getLongitude()));
|
||||||
if (distance > NearbyController.currentLocationSearchRadius * 1000 * 3 / 4) {
|
if (distance > NearbyController.currentLocationSearchRadius * 3 / 4) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue