Skip to content

Commit

Permalink
- fix: complile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
menion committed Apr 16, 2024
1 parent 81c2465 commit 4e5195a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import locus.api.objects.Storable
import locus.api.objects.extra.Location
import locus.api.objects.geoData.Track
import java.security.NoSuchAlgorithmException
import kotlin.math.abs

object UtilsAddonAR {

Expand Down Expand Up @@ -116,7 +117,7 @@ object UtilsAddonAR {
// do some tests if is really need to send new location
val timeDiff = loc.time - mLastLocation!!.time
val distDiff = loc.distanceTo(mLastLocation!!).toDouble()
val altDiff = Math.abs(loc.altitude - mLastLocation!!.altitude)
val altDiff = abs((loc.altitude ?: 0.0) - (mLastLocation?.altitude ?: 0.0))
if (timeDiff < 5000 || distDiff < 5 && altDiff < 10) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ object LocusUtils {
versions.add(lv)
}
} catch (ignored: PackageManager.NameNotFoundException) {
// Logger.logD(TAG, "getAvailableVersions($ctx), " +
// "e: $ignored")
}
}

Expand Down Expand Up @@ -423,17 +421,17 @@ object LocusUtils {
loc.longitude = oldLoc.longitude
loc.latitude = oldLoc.latitude
loc.time = oldLoc.time
if (oldLoc.hasAccuracyHor) {
loc.accuracy = oldLoc.accuracyHor
oldLoc.accuracyHor?.let {
loc.accuracy = it
}
if (oldLoc.hasAltitude) {
loc.altitude = oldLoc.altitude
oldLoc.altitude?.let {
loc.altitude = it
}
if (oldLoc.hasBearing) {
loc.bearing = oldLoc.bearing
oldLoc.bearing?.let {
loc.bearing = it
}
if (oldLoc.hasSpeed) {
loc.speed = oldLoc.speed
oldLoc.speed?.let {
loc.speed = it
}
return loc
}
Expand Down

0 comments on commit 4e5195a

Please sign in to comment.