try to simplify previous method during refactor

This commit is contained in:
neslihanturan 2019-05-18 12:26:20 +03:00
parent 034a2e2f08
commit bcd7e648b6

View file

@ -9,6 +9,10 @@ import fr.free.nrw.commons.nearby.mvp.contract.NearbyParentFragmentContract;
import fr.free.nrw.commons.wikidata.WikidataEditListener;
import timber.log.Timber;
import static fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED;
import static fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.MAP_UPDATED;
import static fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.PERMISSION_JUST_GRANTED;
public class NearbyParentFragmentPresenter
implements NearbyParentFragmentContract.UserActions,
WikidataEditListener.WikidataP18EditListener,
@ -18,6 +22,7 @@ public class NearbyParentFragmentPresenter
private NearbyParentFragmentContract.View nearbyParentFragmentView;
private boolean isNearbyLocked;
private LatLng curLatLng;
public NearbyParentFragmentPresenter(NearbyParentFragmentContract.View nearbyParentFragmentView) {
this.nearbyParentFragmentView = nearbyParentFragmentView;
@ -79,6 +84,29 @@ public class NearbyParentFragmentPresenter
return;
}
//nearbyParentFragmentView.registerLocationUpdates(locationManager);
LatLng lastLocation = locationManager.getLastLocation();
if (curLatLng != null) {
// TODO figure out what is happening here about orientation change
}
curLatLng = lastLocation;
if (curLatLng == null) {
Timber.d("Skipping update of nearby places as location is unavailable");
return;
}
if (locationChangeType.equals(LOCATION_SIGNIFICANTLY_CHANGED)
|| locationChangeType.equals(MAP_UPDATED)) {
}
}