Stop timer when app is paused

I think this may fix the black screen issue. Hopefully. At least it is 
cleaner code than before.
This commit is contained in:
Finn M Glas 2020-05-19 11:42:33 +02:00
parent 83299d926f
commit 9e3cac35ae
No known key found for this signature in database
GPG key ID: 25037A2E81AB459C

View file

@ -66,6 +66,13 @@ class MainActivity : AppCompatActivity(),
loadSettings(sharedPref)
mDetector = GestureDetectorCompat(this, this)
mDetector.setOnDoubleTapListener(this)
}
override fun onResume() {
super.onResume()
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault())
@ -75,9 +82,11 @@ class MainActivity : AppCompatActivity(),
timeView.text = timeFormat.format(Date())
}
}
}
mDetector = GestureDetectorCompat(this, this)
mDetector.setOnDoubleTapListener(this)
override fun onPause() {
super.onPause()
clockTimer.cancel()
}
/** Touch- and Key-related functions to start activities */