diff --git a/app/build.gradle b/app/build.gradle
index 6df03903..6bc04e5f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -36,7 +36,7 @@ android {
}
dependencies {
- implementation 'com.simplemobiletools:commons:5.24.16'
+ implementation 'com.simplemobiletools:commons:5.24.17'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'org.greenrobot:eventbus:3.2.0'
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt
index 5ebb2da7..cf5fca65 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt
@@ -34,8 +34,10 @@ class ThreadAdapter(
override fun getActionMenuId() = R.menu.cab_thread
override fun prepareActionMode(menu: Menu) {
+ val isOneItemSelected = isOneItemSelected()
menu.apply {
- findItem(R.id.cab_copy_to_clipboard).isVisible = isOneItemSelected()
+ findItem(R.id.cab_copy_to_clipboard).isVisible = isOneItemSelected
+ findItem(R.id.cab_share).isVisible = isOneItemSelected
}
}
@@ -46,6 +48,7 @@ class ThreadAdapter(
when (id) {
R.id.cab_copy_to_clipboard -> copyToClipboard()
+ R.id.cab_share -> shareText()
R.id.cab_select_all -> selectAll()
R.id.cab_delete -> askConfirmDelete()
}
@@ -102,6 +105,11 @@ class ThreadAdapter(
activity.copyToClipboard(firstItem.body)
}
+ private fun shareText() {
+ val firstItem = getSelectedItems().first() as? Message ?: return
+ activity.shareTextIntent(firstItem.body)
+ }
+
private fun askConfirmDelete() {
val itemsCnt = selectedKeys.size
val items = resources.getQuantityString(R.plurals.delete_messages, itemsCnt, itemsCnt)
diff --git a/app/src/main/res/menu/cab_thread.xml b/app/src/main/res/menu/cab_thread.xml
index ce1a7e27..ab250efa 100644
--- a/app/src/main/res/menu/cab_thread.xml
+++ b/app/src/main/res/menu/cab_thread.xml
@@ -6,6 +6,11 @@
android:icon="@drawable/ic_copy"
android:title="@string/copy_to_clipboard"
app:showAsAction="ifRoom" />
+