implement number blocking from the Thread screen

This commit is contained in:
tibbi 2020-04-08 12:35:17 +02:00
parent 0fe917053c
commit bed5a80ccf
4 changed files with 15 additions and 180 deletions

View file

@ -5,6 +5,7 @@ import android.content.Intent
import android.os.Bundle
import android.provider.Telephony
import android.telephony.SmsManager
import android.text.TextUtils
import android.view.Gravity
import android.view.Menu
import android.view.MenuItem
@ -153,7 +154,20 @@ class ThreadActivity : SimpleActivity() {
}
private fun blockNumber() {
val baseString = R.string.block_confirmation
val numbers = selectedContacts.map { it.phoneNumber }.toTypedArray()
val numbersString = TextUtils.join(", ", numbers)
val question = String.format(resources.getString(baseString), numbersString)
ConfirmationDialog(this, question) {
ensureBackgroundThread {
numbers.forEach {
addBlockedNumber(it)
}
refreshMessages()
finish()
}
}
}
private fun askConfirmDelete() {