Skip to content

Commit 4e5195a

Browse files
committed
- fix: complile fixes
1 parent 81c2465 commit 4e5195a

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Diff for: locus-api-android/src/main/java/locus/api/android/features/augmentedReality/UtilsAddonAR.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import locus.api.objects.Storable
1212
import locus.api.objects.extra.Location
1313
import locus.api.objects.geoData.Track
1414
import java.security.NoSuchAlgorithmException
15+
import kotlin.math.abs
1516

1617
object UtilsAddonAR {
1718

@@ -116,7 +117,7 @@ object UtilsAddonAR {
116117
// do some tests if is really need to send new location
117118
val timeDiff = loc.time - mLastLocation!!.time
118119
val distDiff = loc.distanceTo(mLastLocation!!).toDouble()
119-
val altDiff = Math.abs(loc.altitude - mLastLocation!!.altitude)
120+
val altDiff = abs((loc.altitude ?: 0.0) - (mLastLocation?.altitude ?: 0.0))
120121
if (timeDiff < 5000 || distDiff < 5 && altDiff < 10) {
121122
return
122123
}

Diff for: locus-api-android/src/main/java/locus/api/android/utils/LocusUtils.kt

+8-10
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ object LocusUtils {
156156
versions.add(lv)
157157
}
158158
} catch (ignored: PackageManager.NameNotFoundException) {
159-
// Logger.logD(TAG, "getAvailableVersions($ctx), " +
160-
// "e: $ignored")
161159
}
162160
}
163161

@@ -423,17 +421,17 @@ object LocusUtils {
423421
loc.longitude = oldLoc.longitude
424422
loc.latitude = oldLoc.latitude
425423
loc.time = oldLoc.time
426-
if (oldLoc.hasAccuracyHor) {
427-
loc.accuracy = oldLoc.accuracyHor
424+
oldLoc.accuracyHor?.let {
425+
loc.accuracy = it
428426
}
429-
if (oldLoc.hasAltitude) {
430-
loc.altitude = oldLoc.altitude
427+
oldLoc.altitude?.let {
428+
loc.altitude = it
431429
}
432-
if (oldLoc.hasBearing) {
433-
loc.bearing = oldLoc.bearing
430+
oldLoc.bearing?.let {
431+
loc.bearing = it
434432
}
435-
if (oldLoc.hasSpeed) {
436-
loc.speed = oldLoc.speed
433+
oldLoc.speed?.let {
434+
loc.speed = it
437435
}
438436
return loc
439437
}

0 commit comments

Comments
 (0)