From bcd7e648b61c86587e22f1bec6007f86196c8809 Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Sat, 18 May 2019 12:26:20 +0300 Subject: [PATCH] try to simplify previous method during refactor --- .../NearbyParentFragmentPresenter.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/mvp/presenter/NearbyParentFragmentPresenter.java b/app/src/main/java/fr/free/nrw/commons/nearby/mvp/presenter/NearbyParentFragmentPresenter.java index 334eba782..39f0e88a0 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/mvp/presenter/NearbyParentFragmentPresenter.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/mvp/presenter/NearbyParentFragmentPresenter.java @@ -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)) { + + } + + + + + }