Merge branch 'master' into add-sms-draft
This commit is contained in:
commit
14b7526ab3
|
@ -24,8 +24,10 @@ import com.simplemobiletools.smsmessenger.R
|
|||
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
||||
import com.simplemobiletools.smsmessenger.extensions.deleteConversation
|
||||
import com.simplemobiletools.smsmessenger.extensions.getSmsDraft
|
||||
import com.simplemobiletools.smsmessenger.extensions.markThreadMessagesUnread
|
||||
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
|
||||
import com.simplemobiletools.smsmessenger.models.Conversation
|
||||
import com.simplemobiletools.smsmessenger.models.Events
|
||||
import kotlinx.android.synthetic.main.item_conversation.view.*
|
||||
|
||||
class ConversationsAdapter(
|
||||
|
@ -61,6 +63,7 @@ class ConversationsAdapter(
|
|||
R.id.cab_copy_number -> copyNumberToClipboard()
|
||||
R.id.cab_delete -> askConfirmDelete()
|
||||
R.id.cab_select_all -> selectAll()
|
||||
R.id.cab_mark_as_unread -> markAsUnread()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,6 +188,23 @@ class ConversationsAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
private fun markAsUnread() {
|
||||
if (selectedKeys.isEmpty()) {
|
||||
return
|
||||
}
|
||||
val conversationsMarkedAsUnread = conversations.filter { selectedKeys.contains(it.hashCode()) } as ArrayList<Conversation>
|
||||
ensureBackgroundThread {
|
||||
conversationsMarkedAsUnread.filter { conversation -> conversation.read }.forEach {
|
||||
activity.markThreadMessagesUnread(it.threadId)
|
||||
}
|
||||
|
||||
activity.runOnUiThread {
|
||||
refreshMessages()
|
||||
finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun addNumberToContact() {
|
||||
val conversation = getSelectedItems().firstOrNull() ?: return
|
||||
Intent().apply {
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
android:id="@+id/cab_copy_number"
|
||||
android:title="@string/copy_number_to_clipboard"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/cab_mark_as_unread"
|
||||
android:title="@string/mark_as_unread"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/cab_select_all"
|
||||
android:title="@string/select_all"
|
||||
|
|
Loading…
Reference in New Issue