Merge branch 'fix-fetching-coords-in-map' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
8be7d3aa11
@ -49,10 +49,10 @@ import com.uam.wmi.findmytutor.service.UserService;
|
||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||
import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
|
||||
import com.uam.wmi.findmytutor.utils.MapMarker;
|
||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -98,6 +98,7 @@ public class MapActivity extends BaseActivity
|
||||
private String myId;
|
||||
private boolean isTutor;
|
||||
private ApproximatedLocalization approximatedLocalization;
|
||||
private boolean shouldFetchNewCoords = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -113,7 +114,9 @@ public class MapActivity extends BaseActivity
|
||||
|
||||
mStatusChecker = () -> {
|
||||
try {
|
||||
fetchTopCoords();
|
||||
if (shouldFetchNewCoords) {
|
||||
fetchTopCoords();
|
||||
}
|
||||
} finally {
|
||||
mHandler.postDelayed(mStatusChecker, mInterval);
|
||||
}
|
||||
@ -224,7 +227,7 @@ public class MapActivity extends BaseActivity
|
||||
private void showError(Throwable e) {
|
||||
String message;
|
||||
|
||||
Log.e("ERR",e.toString());
|
||||
Log.e("ERR", e.toString());
|
||||
|
||||
if (e instanceof HttpException) {
|
||||
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
||||
@ -370,7 +373,7 @@ public class MapActivity extends BaseActivity
|
||||
|
||||
private void SaveCurrentManualLocation(PredefinedCoordViewModel resp) {
|
||||
Toast.makeText(getApplicationContext(), R.string.location_saved, Toast.LENGTH_SHORT).show();
|
||||
PrefUtils.putCurrentManualLocation(getApplicationContext(),resp.getPredefinedCoordinateId());
|
||||
PrefUtils.putCurrentManualLocation(getApplicationContext(), resp.getPredefinedCoordinateId());
|
||||
}
|
||||
|
||||
private void fetchTopCoords() {
|
||||
@ -387,7 +390,7 @@ public class MapActivity extends BaseActivity
|
||||
public void onSuccess(List<Coordinate> coordsList) {
|
||||
|
||||
if (tmpLocalMarker != null && coordsList.isEmpty()) {
|
||||
Timber.e("200 empty []");
|
||||
Log.e("MapActivity", "200 empty []");
|
||||
mapboxMap.clear();
|
||||
|
||||
}
|
||||
@ -590,6 +593,7 @@ public class MapActivity extends BaseActivity
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
shouldFetchNewCoords = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -602,12 +606,15 @@ public class MapActivity extends BaseActivity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
shouldFetchNewCoords = false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
shouldFetchNewCoords = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -719,6 +726,6 @@ public class MapActivity extends BaseActivity
|
||||
}
|
||||
|
||||
public void adjustMapToSearch(Integer zoom) {
|
||||
MapUtils.setZoom(mapboxMap,zoom);
|
||||
MapUtils.setZoom(mapboxMap, zoom);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user