allow sharing attachments too

This commit is contained in:
tibbi 2022-03-07 13:53:32 +01:00
parent 394a990e9c
commit 79f51e42d5
2 changed files with 7 additions and 2 deletions

View File

@ -10,7 +10,6 @@ import com.reddit.indicatorfastscroll.FastScrollItemIndicator
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.PhoneNumber
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.commons.models.SimpleContact
import com.simplemobiletools.smsmessenger.R

View File

@ -69,7 +69,7 @@ class ThreadAdapter(
findItem(R.id.cab_copy_to_clipboard).isVisible = isOneItemSelected && hasText
findItem(R.id.cab_save_as).isVisible = isOneItemSelected && selectedItem?.attachment?.attachments?.size == 1
findItem(R.id.cab_share).isVisible = isOneItemSelected && hasText
findItem(R.id.cab_forward_message).isVisible = isOneItemSelected && hasText
findItem(R.id.cab_forward_message).isVisible = isOneItemSelected
findItem(R.id.cab_select_text).isVisible = isOneItemSelected && hasText
}
}
@ -214,9 +214,15 @@ class ThreadAdapter(
private fun forwardMessage() {
val message = getSelectedItems().firstOrNull() as? Message ?: return
val attachment = message.attachment?.attachments?.firstOrNull()
Intent(activity, NewConversationActivity::class.java).apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, message.body)
if (attachment != null) {
putExtra(Intent.EXTRA_STREAM, attachment.getUri())
}
activity.startActivity(this)
}
}