allow copying conversation numbers to clipboard
This commit is contained in:
parent
524a3546c4
commit
7d8e1a2155
|
@ -39,6 +39,7 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
|||
menu.apply {
|
||||
findItem(R.id.cab_add_number_to_contact).isVisible = isOneItemSelected() && getSelectedItems().firstOrNull()?.isGroupConversation == false
|
||||
findItem(R.id.cab_block_number).isVisible = isNougatPlus()
|
||||
findItem(R.id.cab_copy_number).isVisible = isOneItemSelected() && getSelectedItems().firstOrNull()?.isGroupConversation == false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +51,7 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
|||
when (id) {
|
||||
R.id.cab_add_number_to_contact -> addNumberToContact()
|
||||
R.id.cab_block_number -> askConfirmBlock()
|
||||
R.id.cab_copy_number -> copyNumberToClipboard()
|
||||
R.id.cab_select_all -> selectAll()
|
||||
R.id.cab_delete -> askConfirmDelete()
|
||||
}
|
||||
|
@ -110,6 +112,12 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
|||
}
|
||||
}
|
||||
|
||||
private fun copyNumberToClipboard() {
|
||||
val conversation = getSelectedItems().firstOrNull() ?: return
|
||||
activity.copyToClipboard(conversation.phoneNumber)
|
||||
finishActMode()
|
||||
}
|
||||
|
||||
private fun askConfirmDelete() {
|
||||
val itemsCnt = selectedKeys.size
|
||||
val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt)
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
android:icon="@drawable/ic_minus_circle_vector"
|
||||
android:title="@string/block_number"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/cab_copy_number"
|
||||
android:title="@string/copy_number_to_clipboard"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/cab_select_all"
|
||||
android:icon="@drawable/ic_select_all_vector"
|
||||
|
|
Loading…
Reference in New Issue