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