File tree 2 files changed +10
-11
lines changed
locus-api-android/src/main/java/locus/api/android
features/augmentedReality
2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import locus.api.objects.Storable
12
12
import locus.api.objects.extra.Location
13
13
import locus.api.objects.geoData.Track
14
14
import java.security.NoSuchAlgorithmException
15
+ import kotlin.math.abs
15
16
16
17
object UtilsAddonAR {
17
18
@@ -116,7 +117,7 @@ object UtilsAddonAR {
116
117
// do some tests if is really need to send new location
117
118
val timeDiff = loc.time - mLastLocation!! .time
118
119
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 ) )
120
121
if (timeDiff < 5000 || distDiff < 5 && altDiff < 10 ) {
121
122
return
122
123
}
Original file line number Diff line number Diff line change @@ -156,8 +156,6 @@ object LocusUtils {
156
156
versions.add(lv)
157
157
}
158
158
} catch (ignored: PackageManager .NameNotFoundException ) {
159
- // Logger.logD(TAG, "getAvailableVersions($ctx), " +
160
- // "e: $ignored")
161
159
}
162
160
}
163
161
@@ -423,17 +421,17 @@ object LocusUtils {
423
421
loc.longitude = oldLoc.longitude
424
422
loc.latitude = oldLoc.latitude
425
423
loc.time = oldLoc.time
426
- if ( oldLoc.hasAccuracyHor) {
427
- loc.accuracy = oldLoc.accuracyHor
424
+ oldLoc.accuracyHor?. let {
425
+ loc.accuracy = it
428
426
}
429
- if ( oldLoc.hasAltitude) {
430
- loc.altitude = oldLoc.altitude
427
+ oldLoc.altitude?. let {
428
+ loc.altitude = it
431
429
}
432
- if ( oldLoc.hasBearing) {
433
- loc.bearing = oldLoc.bearing
430
+ oldLoc.bearing?. let {
431
+ loc.bearing = it
434
432
}
435
- if ( oldLoc.hasSpeed) {
436
- loc.speed = oldLoc.speed
433
+ oldLoc.speed?. let {
434
+ loc.speed = it
437
435
}
438
436
return loc
439
437
}
You can’t perform that action at this time.
0 commit comments