fix #76, make sure a notification is shown if app is paused
This commit is contained in:
parent
e3f7d80987
commit
766f1ef78c
|
@ -51,6 +51,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
private var threadId = 0
|
||||
private var currentSIMCardIndex = 0
|
||||
private var isActivityVisible = false
|
||||
private var threadItems = ArrayList<ThreadItem>()
|
||||
private var bus: EventBus? = null
|
||||
private var participants = ArrayList<SimpleContact>()
|
||||
|
@ -86,6 +87,16 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
isActivityVisible = true
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
isActivityVisible = false
|
||||
}
|
||||
|
||||
private fun setupThread() {
|
||||
val privateCursor = getMyContactsCursor().loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
|
@ -643,7 +654,10 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
@Subscribe(threadMode = ThreadMode.ASYNC)
|
||||
fun refreshMessages(event: Events.RefreshMessages) {
|
||||
notificationManager.cancel(threadId)
|
||||
if (isActivityVisible) {
|
||||
notificationManager.cancel(threadId)
|
||||
}
|
||||
|
||||
messages = getMessages(threadId)
|
||||
setupAdapter()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue