Minor fixes and improvements
This commit is contained in:
@@ -111,14 +111,7 @@ class MessageDetailFragment : Fragment() {
|
||||
text.linksClickable = true
|
||||
text.setTextIsSelectable(true)
|
||||
|
||||
var removed = false
|
||||
val labels = item.labels.iterator()
|
||||
while (labels.hasNext()) {
|
||||
if (labels.next().type == Label.Type.UNREAD) {
|
||||
labels.remove()
|
||||
removed = true
|
||||
}
|
||||
}
|
||||
val removed = item.labels.removeAll { it.type==Label.Type.UNREAD }
|
||||
val messageRepo = Singleton.getMessageRepository(context)
|
||||
if (removed) {
|
||||
if (activity is MainActivity) {
|
||||
@@ -173,15 +166,14 @@ class MessageDetailFragment : Fragment() {
|
||||
Singleton.labeler.delete(item)
|
||||
messageRepo.save(item)
|
||||
}
|
||||
(activity as? MainActivity)?.updateUnread()
|
||||
activity.onBackPressed()
|
||||
return true
|
||||
}
|
||||
R.id.mark_unread -> {
|
||||
Singleton.labeler.markAsUnread(item)
|
||||
messageRepo.save(item)
|
||||
if (activity is MainActivity) {
|
||||
(activity as MainActivity).updateUnread()
|
||||
}
|
||||
(activity as? MainActivity)?.updateUnread()
|
||||
return true
|
||||
}
|
||||
R.id.archive -> {
|
||||
@@ -190,6 +182,7 @@ class MessageDetailFragment : Fragment() {
|
||||
}
|
||||
Singleton.labeler.archive(item)
|
||||
messageRepo.save(item)
|
||||
(activity as? MainActivity)?.updateUnread()
|
||||
return true
|
||||
}
|
||||
else -> return false
|
||||
|
||||
Reference in New Issue
Block a user