diff --git a/app/build.gradle b/app/build.gradle index 570bd30..a050b6f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ android { applicationId "com.uam.wmi.findmytutor" minSdkVersion 22 targetSdkVersion 27 - versionCode 50 + versionCode 52 versionName "1.0.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java index 76825a2..ad6a5f0 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java @@ -186,18 +186,19 @@ public class BackgroundLocalizationService extends Service { private void changeBackgroundMode() { Integer prevInterval = notify_interval; 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). map(MapUtils::checkIfCoordinateIsValid).filter(x -> x).toList().size() > 0; + if (shouldExtendTimeInterval) { + notify_interval = notify_interval_outside_building; + } + if (shouldAbbreviateTimeInterval) { 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)); if (changedMode != 0) {