When arriving at a homepoint, move it to the front of the deque.
This commit is contained in:
parent
55bde3b812
commit
9b67ca8bfd
2 changed files with 8 additions and 3 deletions
|
@ -40,7 +40,7 @@ interface DatabaseChangedListener
|
||||||
class Trackbook : Application()
|
class Trackbook : Application()
|
||||||
{
|
{
|
||||||
val database: net.voussoir.trkpt.Database = net.voussoir.trkpt.Database(this)
|
val database: net.voussoir.trkpt.Database = net.voussoir.trkpt.Database(this)
|
||||||
val homepoints: ArrayList<Homepoint> = ArrayList()
|
val homepoints: ArrayDeque<Homepoint> = ArrayDeque()
|
||||||
val database_changed_listeners = ArrayList<DatabaseChangedListener>()
|
val database_changed_listeners = ArrayList<DatabaseChangedListener>()
|
||||||
|
|
||||||
fun call_database_changed_listeners()
|
fun call_database_changed_listeners()
|
||||||
|
|
|
@ -251,11 +251,16 @@ class TrackerService: Service()
|
||||||
Log.i("VOUSSOIR", "Omitting due to not accurate enough.")
|
Log.i("VOUSSOIR", "Omitting due to not accurate enough.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for (homepoint in trackbook.homepoints)
|
for ((index, homepoint) in trackbook.homepoints.withIndex())
|
||||||
{
|
{
|
||||||
if (homepoint.location.distanceTo(location) < homepoint.radius)
|
if (homepoint.location.distanceTo(location) < homepoint.radius)
|
||||||
{
|
{
|
||||||
Log.i("VOUSSOIR", "Omitting due to homepoint ${homepoint.name}.")
|
Log.i("VOUSSOIR", "Omitting due to homepoint ${index} ${homepoint.name}.")
|
||||||
|
if (index > 0)
|
||||||
|
{
|
||||||
|
trackbook.homepoints.remove(homepoint)
|
||||||
|
trackbook.homepoints.addFirst(homepoint)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue