add a Mark as Unread menu item at the thread screen

This commit is contained in:
tibbi 2020-06-18 11:14:51 +02:00
parent 21891ff677
commit 22b6040a86
4 changed files with 30 additions and 0 deletions

View file

@ -199,6 +199,7 @@ class ThreadActivity : SimpleActivity() {
R.id.block_number -> blockNumber()
R.id.delete -> askConfirmDelete()
R.id.manage_people -> managePeople()
R.id.mark_as_unread -> markAsUnread()
else -> return super.onOptionsItemSelected(item)
}
return true
@ -392,6 +393,16 @@ class ThreadActivity : SimpleActivity() {
showSelectedContacts()
}
private fun markAsUnread() {
ensureBackgroundThread {
conversationsDB.markUnread(threadId.toLong())
markThreadMessagesUnread(threadId)
runOnUiThread {
finish()
}
}
}
@SuppressLint("MissingPermission")
private fun getThreadItems(): ArrayList<ThreadItem> {
messages.sortBy { it.date }