Fix up double timer bug
This commit is contained in:
parent
0f4f4ab8a9
commit
3cecc1e121
|
@ -66,8 +66,6 @@ class CollarDetailActivity : AppCompatActivity() {
|
||||||
mapMarker = Marker(map)
|
mapMarker = Marker(map)
|
||||||
configureMapPolygon()
|
configureMapPolygon()
|
||||||
|
|
||||||
refreshTimer.schedule(timerTask { triggerRefresh() }, 0L, 5000L)
|
|
||||||
|
|
||||||
boundingBox = Polygon(
|
boundingBox = Polygon(
|
||||||
listOf(
|
listOf(
|
||||||
CollarPos("20", "20"),
|
CollarPos("20", "20"),
|
||||||
|
@ -82,6 +80,7 @@ class CollarDetailActivity : AppCompatActivity() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
map.onPause()
|
map.onPause()
|
||||||
refreshTimer.cancel()
|
refreshTimer.cancel()
|
||||||
|
refreshTimer.purge()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.danilafe.fencelessgrazing
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
|
@ -60,12 +61,15 @@ class CollarListActivity : AppCompatActivity() {
|
||||||
map.onResume()
|
map.onResume()
|
||||||
refreshTimer = Timer()
|
refreshTimer = Timer()
|
||||||
refreshTimer.schedule(timerTask { triggerRefresh() }, 0L, 5000L)
|
refreshTimer.schedule(timerTask { triggerRefresh() }, 0L, 5000L)
|
||||||
|
Log.d("FencelessGrazing", "Should be resumed")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
map.onPause()
|
map.onPause()
|
||||||
refreshTimer.cancel()
|
refreshTimer.cancel()
|
||||||
|
refreshTimer.purge()
|
||||||
|
Log.d("FencelessGrazing", "Should be paused")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun triggerRefresh() {
|
private fun triggerRefresh() {
|
||||||
|
@ -107,7 +111,6 @@ class CollarListActivity : AppCompatActivity() {
|
||||||
collarList.adapter = summaryAdapter
|
collarList.adapter = summaryAdapter
|
||||||
collarList.layoutManager = layoutManager
|
collarList.layoutManager = layoutManager
|
||||||
collarList.addItemDecoration(DividerItemDecoration(collarList.context, layoutManager.orientation))
|
collarList.addItemDecoration(DividerItemDecoration(collarList.context, layoutManager.orientation))
|
||||||
refreshTimer.schedule(timerTask { triggerRefresh() }, 0L, 5000L)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateMapOverlay() {
|
private fun updateMapOverlay() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user