Fetch markers only when screen is on
This commit is contained in:
parent
ce3d261c48
commit
381373b4b7
@ -49,10 +49,10 @@ import com.uam.wmi.findmytutor.service.UserService;
|
|||||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||||
import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
|
import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.MapMarker;
|
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.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -100,6 +100,7 @@ public class MapActivity extends BaseActivity
|
|||||||
private String myId;
|
private String myId;
|
||||||
private boolean isTutor;
|
private boolean isTutor;
|
||||||
private ApproximatedLocalization approximatedLocalization;
|
private ApproximatedLocalization approximatedLocalization;
|
||||||
|
private boolean shouldFetchNewCoords = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -115,7 +116,9 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
mStatusChecker = () -> {
|
mStatusChecker = () -> {
|
||||||
try {
|
try {
|
||||||
|
if (shouldFetchNewCoords) {
|
||||||
fetchTopCoords();
|
fetchTopCoords();
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
mHandler.postDelayed(mStatusChecker, mInterval);
|
mHandler.postDelayed(mStatusChecker, mInterval);
|
||||||
}
|
}
|
||||||
@ -389,7 +392,7 @@ public class MapActivity extends BaseActivity
|
|||||||
public void onSuccess(List<Coordinate> coordsList) {
|
public void onSuccess(List<Coordinate> coordsList) {
|
||||||
|
|
||||||
if (tmpLocalMarker != null && coordsList.isEmpty()) {
|
if (tmpLocalMarker != null && coordsList.isEmpty()) {
|
||||||
Timber.e("200 empty []");
|
Log.e("MapActivity", "200 empty []");
|
||||||
mapboxMap.clear();
|
mapboxMap.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -592,6 +595,7 @@ public class MapActivity extends BaseActivity
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mapView.onResume();
|
mapView.onResume();
|
||||||
|
shouldFetchNewCoords = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -604,12 +608,15 @@ public class MapActivity extends BaseActivity
|
|||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
mapView.onStop();
|
mapView.onStop();
|
||||||
|
shouldFetchNewCoords = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
mapView.onPause();
|
mapView.onPause();
|
||||||
|
shouldFetchNewCoords = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user