Add buttons for removing statuses/locations in sharing tab #122
@ -38,6 +38,7 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
android:windowSoftInputMode="adjustPan"
|
||||||
android:name=".activity.MapActivity"
|
android:name=".activity.MapActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
|
@ -65,11 +65,17 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private Runnable mStatusChecker;
|
private Runnable mStatusChecker;
|
||||||
private FusedLocationProviderClient mFusedLocationClient;
|
private FusedLocationProviderClient mFusedLocationClient;
|
||||||
|
private Location fakeLoc = null;
|
||||||
|
|
||||||
public BackgroundLocalizationService() {
|
public BackgroundLocalizationService() {
|
||||||
providers.add(LocationManager.GPS_PROVIDER);
|
providers.add(LocationManager.GPS_PROVIDER);
|
||||||
providers.add(LocationManager.NETWORK_PROVIDER);
|
providers.add(LocationManager.NETWORK_PROVIDER);
|
||||||
providers.add(LocationManager.PASSIVE_PROVIDER);
|
providers.add(LocationManager.PASSIVE_PROVIDER);
|
||||||
|
fakeLoc = new Location("");
|
||||||
|
|
||||||
|
fakeLoc.setLatitude(0);
|
||||||
|
fakeLoc.setLongitude(0);
|
||||||
|
fakeLoc.setAltitude(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -112,9 +118,13 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
if (!stopService) {
|
if (!stopService) {
|
||||||
mStatusChecker = () -> {
|
mStatusChecker = () -> {
|
||||||
try {
|
try {
|
||||||
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||||
getLocalizationFromListeners();
|
sendCoordinateToBackend(fakeLoc);
|
||||||
changeBackgroundMode();
|
} else {
|
||||||
|
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
||||||
|
getLocalizationFromListeners();
|
||||||
|
changeBackgroundMode();
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
mFusedLocationClient = null;
|
mFusedLocationClient = null;
|
||||||
destroyLocationListeners();
|
destroyLocationListeners();
|
||||||
@ -200,7 +210,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
destroyLocationListeners();
|
destroyLocationListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroyLocationListeners(){
|
private void destroyLocationListeners() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -231,9 +241,8 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
String locationLevel = PrefUtils.getLocationLevel(getApplicationContext());
|
String locationLevel = PrefUtils.getLocationLevel(getApplicationContext());
|
||||||
String status = (PrefUtils.isStatusEnabled(getApplicationContext())) ? PrefUtils.getUserStatus(getApplicationContext()) : "";
|
String status = (PrefUtils.isStatusEnabled(getApplicationContext())) ? PrefUtils.getUserStatus(getApplicationContext()) : "";
|
||||||
|
|
||||||
|
|
||||||
if (locationLevel.equals(SharingLevel.PRESENCE.toString())) {
|
if (locationLevel.equals(SharingLevel.PRESENCE.toString())) {
|
||||||
if(!MapUtils.checkIfCoordinateIsValid(latitude,longitude)){
|
if (!MapUtils.checkIfCoordinateIsValid(latitude, longitude)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +286,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
Log.e(TAG,"onErr" + valueOf(e));
|
Log.e(TAG, "onErr" + valueOf(e));
|
||||||
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user