add a menu button for deleting the whole opened conversation
This commit is contained in:
parent
013fa62606
commit
a569ae2b05
|
@ -12,6 +12,7 @@ import android.view.View
|
|||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
|
@ -91,6 +92,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.delete -> askConfirmDelete()
|
||||
R.id.manage_people -> managePeople()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
@ -148,6 +150,14 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun askConfirmDelete() {
|
||||
ConfirmationDialog(this, getString(R.string.delete_whole_conversation_confirmation)) {
|
||||
deleteThread(threadId)
|
||||
refreshMessages()
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun managePeople() {
|
||||
if (thread_add_contacts.isVisible()) {
|
||||
hideKeyboard()
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/delete"
|
||||
android:icon="@drawable/ic_delete_vector"
|
||||
android:title="@string/delete"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/manage_people"
|
||||
android:icon="@drawable/add_person_vector"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<string name="new_message">New message</string>
|
||||
|
||||
<!-- Confirmation dialog -->
|
||||
<string name="delete_whole_conversation_confirmation">Are you sure you want to delete all messages of this conversation?</string>
|
||||
<string name="delete_conversations_confirmation">Are you sure you want to delete %s?</string> <!-- Are you sure you want to delete 5 conversations? -->
|
||||
|
||||
<!-- Are you sure you want to delete 5 conversations? -->
|
||||
|
|
Loading…
Reference in New Issue