add text message forwarding
This commit is contained in:
parent
5e97a97e5f
commit
394a990e9c
|
@ -29,6 +29,7 @@ import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
import com.simplemobiletools.smsmessenger.R
|
import com.simplemobiletools.smsmessenger.R
|
||||||
|
import com.simplemobiletools.smsmessenger.activities.NewConversationActivity
|
||||||
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
||||||
import com.simplemobiletools.smsmessenger.activities.ThreadActivity
|
import com.simplemobiletools.smsmessenger.activities.ThreadActivity
|
||||||
import com.simplemobiletools.smsmessenger.dialogs.SelectTextDialog
|
import com.simplemobiletools.smsmessenger.dialogs.SelectTextDialog
|
||||||
|
@ -68,6 +69,7 @@ class ThreadAdapter(
|
||||||
findItem(R.id.cab_copy_to_clipboard).isVisible = isOneItemSelected && hasText
|
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_save_as).isVisible = isOneItemSelected && selectedItem?.attachment?.attachments?.size == 1
|
||||||
findItem(R.id.cab_share).isVisible = isOneItemSelected && hasText
|
findItem(R.id.cab_share).isVisible = isOneItemSelected && hasText
|
||||||
|
findItem(R.id.cab_forward_message).isVisible = isOneItemSelected && hasText
|
||||||
findItem(R.id.cab_select_text).isVisible = isOneItemSelected && hasText
|
findItem(R.id.cab_select_text).isVisible = isOneItemSelected && hasText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +83,7 @@ class ThreadAdapter(
|
||||||
R.id.cab_copy_to_clipboard -> copyToClipboard()
|
R.id.cab_copy_to_clipboard -> copyToClipboard()
|
||||||
R.id.cab_save_as -> saveAs()
|
R.id.cab_save_as -> saveAs()
|
||||||
R.id.cab_share -> shareText()
|
R.id.cab_share -> shareText()
|
||||||
|
R.id.cab_forward_message -> forwardMessage()
|
||||||
R.id.cab_select_text -> selectText()
|
R.id.cab_select_text -> selectText()
|
||||||
R.id.cab_delete -> askConfirmDelete()
|
R.id.cab_delete -> askConfirmDelete()
|
||||||
R.id.cab_select_all -> selectAll()
|
R.id.cab_select_all -> selectAll()
|
||||||
|
@ -209,6 +212,15 @@ class ThreadAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun forwardMessage() {
|
||||||
|
val message = getSelectedItems().firstOrNull() as? Message ?: return
|
||||||
|
Intent(activity, NewConversationActivity::class.java).apply {
|
||||||
|
action = Intent.ACTION_SEND
|
||||||
|
putExtra(Intent.EXTRA_TEXT, message.body)
|
||||||
|
activity.startActivity(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getSelectedItems() = messages.filter { selectedKeys.contains((it as? Message)?.hashCode() ?: 0) } as ArrayList<ThreadItem>
|
private fun getSelectedItems() = messages.filter { selectedKeys.contains((it as? Message)?.hashCode() ?: 0) } as ArrayList<ThreadItem>
|
||||||
|
|
||||||
private fun isThreadDateTime(position: Int) = messages.getOrNull(position) is ThreadDateTime
|
private fun isThreadDateTime(position: Int) = messages.getOrNull(position) is ThreadDateTime
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
android:icon="@drawable/ic_save_vector"
|
android:icon="@drawable/ic_save_vector"
|
||||||
android:title="@string/save_as"
|
android:title="@string/save_as"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_forward_message"
|
||||||
|
android:title="@string/forward_message"
|
||||||
|
app:showAsAction="never" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/cab_select_text"
|
android:id="@+id/cab_select_text"
|
||||||
android:title="@string/select_text"
|
android:title="@string/select_text"
|
||||||
|
|
Loading…
Reference in New Issue