mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
fixed typo in nearbyActivity (#1394)
This commit is contained in:
parent
35a7d49590
commit
f8fb9f1ce9
1 changed files with 13 additions and 13 deletions
|
|
@ -68,7 +68,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
@Inject
|
@Inject
|
||||||
NearbyController nearbyController;
|
NearbyController nearbyController;
|
||||||
|
|
||||||
private LatLng curLatLang;
|
private LatLng curLatLng;
|
||||||
private Bundle bundle;
|
private Bundle bundle;
|
||||||
private Disposable placesDisposable;
|
private Disposable placesDisposable;
|
||||||
private boolean lockNearbyView; //Determines if the nearby places needs to be refreshed
|
private boolean lockNearbyView; //Determines if the nearby places needs to be refreshed
|
||||||
|
|
@ -342,12 +342,12 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
locationManager.registerLocationManager();
|
locationManager.registerLocationManager();
|
||||||
LatLng lastLocation = locationManager.getLastLocation();
|
LatLng lastLocation = locationManager.getLastLocation();
|
||||||
|
|
||||||
if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed
|
if (curLatLng != null && curLatLng.equals(lastLocation)) { //refresh view only if location has changed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
curLatLang = lastLocation;
|
curLatLng = lastLocation;
|
||||||
|
|
||||||
if (curLatLang == null) {
|
if (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;
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +356,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
.equals(LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED)) {
|
.equals(LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED)) {
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
placesDisposable = Observable.fromCallable(() -> nearbyController
|
placesDisposable = Observable.fromCallable(() -> nearbyController
|
||||||
.loadAttractionsFromLocation(curLatLang))
|
.loadAttractionsFromLocation(curLatLng))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::populatePlaces);
|
.subscribe(this::populatePlaces);
|
||||||
|
|
@ -365,7 +365,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
Gson gson = new GsonBuilder()
|
Gson gson = new GsonBuilder()
|
||||||
.registerTypeAdapter(Uri.class, new UriSerializer())
|
.registerTypeAdapter(Uri.class, new UriSerializer())
|
||||||
.create();
|
.create();
|
||||||
String gsonCurLatLng = gson.toJson(curLatLang);
|
String gsonCurLatLng = gson.toJson(curLatLng);
|
||||||
bundle.putString("CurLatLng", gsonCurLatLng);
|
bundle.putString("CurLatLng", gsonCurLatLng);
|
||||||
updateMapFragment(true);
|
updateMapFragment(true);
|
||||||
}
|
}
|
||||||
|
|
@ -378,7 +378,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
.registerTypeAdapter(Uri.class, new UriSerializer())
|
.registerTypeAdapter(Uri.class, new UriSerializer())
|
||||||
.create();
|
.create();
|
||||||
String gsonPlaceList = gson.toJson(placeList);
|
String gsonPlaceList = gson.toJson(placeList);
|
||||||
String gsonCurLatLng = gson.toJson(curLatLang);
|
String gsonCurLatLng = gson.toJson(curLatLng);
|
||||||
String gsonBoundaryCoordinates = gson.toJson(boundaryCoordinates);
|
String gsonBoundaryCoordinates = gson.toJson(boundaryCoordinates);
|
||||||
|
|
||||||
if (placeList.size() == 0) {
|
if (placeList.size() == 0) {
|
||||||
|
|
@ -457,20 +457,20 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
|
|
||||||
NearbyMapFragment nearbyMapFragment = getMapFragment();
|
NearbyMapFragment nearbyMapFragment = getMapFragment();
|
||||||
|
|
||||||
if (nearbyMapFragment != null && curLatLang != null) {
|
if (nearbyMapFragment != null && curLatLng != null) {
|
||||||
hideProgressBar(); // In case it is visible (this happens, not an impossible case)
|
hideProgressBar(); // In case it is visible (this happens, not an impossible case)
|
||||||
/*
|
/*
|
||||||
* If we are close to nearby places boundaries, we need a significant update to
|
* If we are close to nearby places boundaries, we need a significant update to
|
||||||
* get new nearby places. Check order is south, north, west, east
|
* get new nearby places. Check order is south, north, west, east
|
||||||
* */
|
* */
|
||||||
if (nearbyMapFragment.boundaryCoordinates != null
|
if (nearbyMapFragment.boundaryCoordinates != null
|
||||||
&& (curLatLang.getLatitude() <= nearbyMapFragment.boundaryCoordinates[0].getLatitude()
|
&& (curLatLng.getLatitude() <= nearbyMapFragment.boundaryCoordinates[0].getLatitude()
|
||||||
|| curLatLang.getLatitude() >= nearbyMapFragment.boundaryCoordinates[1].getLatitude()
|
|| curLatLng.getLatitude() >= nearbyMapFragment.boundaryCoordinates[1].getLatitude()
|
||||||
|| curLatLang.getLongitude() <= nearbyMapFragment.boundaryCoordinates[2].getLongitude()
|
|| curLatLng.getLongitude() <= nearbyMapFragment.boundaryCoordinates[2].getLongitude()
|
||||||
|| curLatLang.getLongitude() >= nearbyMapFragment.boundaryCoordinates[3].getLongitude())) {
|
|| curLatLng.getLongitude() >= nearbyMapFragment.boundaryCoordinates[3].getLongitude())) {
|
||||||
// populate places
|
// populate places
|
||||||
placesDisposable = Observable.fromCallable(() -> nearbyController
|
placesDisposable = Observable.fromCallable(() -> nearbyController
|
||||||
.loadAttractionsFromLocation(curLatLang))
|
.loadAttractionsFromLocation(curLatLng))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::populatePlaces);
|
.subscribe(this::populatePlaces);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue