Merge branch 'fix-bg' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
59c28e35d8
@ -10,7 +10,7 @@ android {
|
|||||||
applicationId "com.uam.wmi.findmytutor"
|
applicationId "com.uam.wmi.findmytutor"
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 50
|
versionCode 52
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
@ -186,18 +186,19 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
private void changeBackgroundMode() {
|
private void changeBackgroundMode() {
|
||||||
Integer prevInterval = notify_interval;
|
Integer prevInterval = notify_interval;
|
||||||
Boolean shouldExtendTimeInterval = Stream.of(coordinatesHistory)
|
Boolean shouldExtendTimeInterval = Stream.of(coordinatesHistory)
|
||||||
.map(MapUtils::checkIfCoordinateIsValid).takeWhile(s -> !s).toList().size() == coordinatesHistory.size();
|
.map(MapUtils::checkIfCoordinateIsValid).takeWhile(s -> !s).toList().size() == coordinatesHistoryLength;
|
||||||
|
|
||||||
Boolean shouldAbbreviateTimeInterval = Stream.of(coordinatesHistory).
|
Boolean shouldAbbreviateTimeInterval = Stream.of(coordinatesHistory).
|
||||||
map(MapUtils::checkIfCoordinateIsValid).filter(x -> x).toList().size() > 0;
|
map(MapUtils::checkIfCoordinateIsValid).filter(x -> x).toList().size() > 0;
|
||||||
|
|
||||||
|
if (shouldExtendTimeInterval) {
|
||||||
|
notify_interval = notify_interval_outside_building;
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldAbbreviateTimeInterval) {
|
if (shouldAbbreviateTimeInterval) {
|
||||||
notify_interval = notify_interval_inside_building;
|
notify_interval = notify_interval_inside_building;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coordinatesHistory.size() > coordinatesHistoryLength && shouldExtendTimeInterval) {
|
|
||||||
notify_interval = notify_interval_outside_building;
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer changedMode = Long.valueOf(prevInterval).compareTo(Long.valueOf(notify_interval));
|
Integer changedMode = Long.valueOf(prevInterval).compareTo(Long.valueOf(notify_interval));
|
||||||
if (changedMode != 0) {
|
if (changedMode != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user