- More work on strings.
This commit is contained in:
@@ -39,7 +39,8 @@ class AccountListAdapter(private val cxt: Context, private val rows: ArrayList<A
|
||||
actionView.setOnClickListener { _ ->
|
||||
Log.d("Baresip", "Delete button clicked")
|
||||
val deleteDialog = AlertDialog.Builder(cxt)
|
||||
deleteDialog.setMessage("${cxt.getString(R.string.delete_account)} ${ua.account.aor}?")
|
||||
deleteDialog.setMessage(String.format(cxt.getString(R.string.delete_account),
|
||||
ua.account.aor))
|
||||
deleteDialog.setPositiveButton(cxt.getText(R.string.cancel)) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
||||
@@ -39,21 +39,21 @@ class AccountsActivity : AppCompatActivity() {
|
||||
if (!aor.startsWith("sip:")) aor = "sip:$aor"
|
||||
if (!Utils.checkAorUri(aor)) {
|
||||
Log.d("Baresip", "Invalid SIP Address of Record $aor")
|
||||
Utils.alertView(this, "Notice",
|
||||
"Invalid SIP Address of Record: $aor")
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
String.format(getString(R.string.invalid_aor), aor))
|
||||
} else if (Account.exists(aor)) {
|
||||
Log.d("Baresip", "Account $aor already exists")
|
||||
Utils.alertView(this, "Notice",
|
||||
"Account $aor already exists")
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
String.format(getString(R.string.account_exists), aor))
|
||||
} else {
|
||||
val ua = UserAgent.uaAlloc("<$aor>;stunserver=\"stun:stun.l.google.com:19302\";regq=0.5;pubint=0;regint=0")
|
||||
if (ua == null) {
|
||||
Log.e("Baresip", "Failed to allocate UA for $aor")
|
||||
Utils.alertView(this, "Notice",
|
||||
"Failed to allocate new account.")
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
getString(R.string.account_allocation_failure))
|
||||
} else {
|
||||
newAorView.setText("")
|
||||
newAorView.hint = "SIP URI user@domain"
|
||||
newAorView.hint = getString(R.string.sip_uri_user_domain)
|
||||
newAorView.clearFocus()
|
||||
UserAgent.add(ua, R.drawable.dot_yellow)
|
||||
generateAccounts()
|
||||
@@ -88,14 +88,13 @@ class AccountsActivity : AppCompatActivity() {
|
||||
R.id.export_accounts -> {
|
||||
if (Utils.requestPermission(this,
|
||||
android.Manifest.permission.WRITE_EXTERNAL_STORAGE))
|
||||
askPassword("Encrypt Password")
|
||||
askPassword(getString(R.string.encrypt_password))
|
||||
}
|
||||
R.id.import_accounts -> {
|
||||
if (Utils.requestPermission(this,
|
||||
android.Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
askPassword("Decrypt Password")
|
||||
android.Manifest.permission.READ_EXTERNAL_STORAGE))
|
||||
askPassword(getString(R.string.decrypt_password))
|
||||
|
||||
}
|
||||
}
|
||||
android.R.id.home -> {
|
||||
Log.d("Baresip", "Back array was pressed at Accounts")
|
||||
@@ -120,23 +119,20 @@ class AccountsActivity : AppCompatActivity() {
|
||||
dialog.dismiss()
|
||||
password = input.text.toString()
|
||||
if (password != "") {
|
||||
if (title == "Encrypt Password") {
|
||||
if (title == getString(R.string.encrypt_password)) {
|
||||
if (exportAccounts(dir, password))
|
||||
Utils.alertView(this, "Info",
|
||||
"Exported accounts to Download folder file 'accounts.bs'.")
|
||||
Utils.alertView(this, getString(R.string.info),
|
||||
getString(R.string.exported_accounts))
|
||||
else
|
||||
Utils.alertView(this, "Error",
|
||||
"Failed to export accounts to Download folder.")
|
||||
Utils.alertView(this, getString(R.string.error),
|
||||
getString(R.string.export_accounts_error))
|
||||
} else {
|
||||
if (importAccounts(dir, password))
|
||||
Utils.alertView(this, "Info",
|
||||
"Imported accounts from Download folder file " +
|
||||
"'accounts.bs'. You need to restart baresip.")
|
||||
Utils.alertView(this, getString(R.string.info),
|
||||
getString(R.string.imported_accounts))
|
||||
else
|
||||
Utils.alertView(this, "Error",
|
||||
"Failed to import accounts from Download folder. " +
|
||||
"Either file 'accounts.bs' doesn't exist or " +
|
||||
"you gave wrong Decrypt Password.")
|
||||
Utils.alertView(this, getString(R.string.error),
|
||||
getString(R.string.import_accounts_error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ChatActivity : AppCompatActivity() {
|
||||
else
|
||||
chatPeer = chatPeer.substring(4)
|
||||
}
|
||||
setTitle("${getString(R.string.chat_with)} $chatPeer")
|
||||
setTitle(String.format(getString(R.string.chat_with), chatPeer))
|
||||
|
||||
val headerView = findViewById(R.id.account) as TextView
|
||||
val headerText = "${getString(R.string.account)} ${aor.substringAfter(":")}"
|
||||
|
||||
@@ -91,7 +91,7 @@ class ChatsActivity: AppCompatActivity() {
|
||||
.setNeutralButton(getText(R.string.add_contact), dialogClickListener)
|
||||
.show()
|
||||
else
|
||||
builder.setMessage("${getString(R.string.short_chat_question)} '$peer'?")
|
||||
builder.setMessage(String.format(getString(R.string.short_chat_question), peer))
|
||||
.setPositiveButton(getText(R.string.cancel), dialogClickListener)
|
||||
.setNegativeButton(getText(R.string.delete), dialogClickListener)
|
||||
.show()
|
||||
|
||||
@@ -53,8 +53,8 @@ class ContactListAdapter(private val cxt: Context, private val rows: ArrayList<C
|
||||
}
|
||||
}
|
||||
val builder = AlertDialog.Builder(cxt, R.style.Theme_AppCompat)
|
||||
builder.setMessage(cxt.getString(R.string.contact_action_question) +
|
||||
" '${Contact.contacts()[pos].name}'?")
|
||||
builder.setMessage(String.format(cxt.getString(R.string.contact_action_question),
|
||||
Contact.contacts()[pos].name))
|
||||
.setNeutralButton(cxt.getText(R.string.call), dialogClickListener)
|
||||
.setNegativeButton(cxt.getText(R.string.send_message), dialogClickListener)
|
||||
.setPositiveButton(cxt.getText(R.string.cancel), dialogClickListener)
|
||||
@@ -74,8 +74,8 @@ class ContactListAdapter(private val cxt: Context, private val rows: ArrayList<C
|
||||
}
|
||||
}
|
||||
val builder = AlertDialog.Builder(cxt, R.style.Theme_AppCompat)
|
||||
builder.setMessage(cxt.getString(R.string.contact_delete_question) +
|
||||
" '${Contact.contacts()[pos].name}'?")
|
||||
builder.setMessage(String.format(cxt.getString(R.string.contact_delete_question),
|
||||
Contact.contacts()[pos].name))
|
||||
.setNegativeButton(cxt.getText(R.string.delete), dialogClickListener)
|
||||
.setPositiveButton(cxt.getText(R.string.cancel), dialogClickListener)
|
||||
.show()
|
||||
|
||||
@@ -30,9 +30,8 @@ class ContactsActivity : AppCompatActivity() {
|
||||
val plusButton = findViewById(R.id.plusButton) as ImageButton
|
||||
plusButton.setOnClickListener {
|
||||
if (Contact.contacts().size >= Contact.CONTACTS_SIZE) {
|
||||
Utils.alertView(this, "Notice",
|
||||
"Your maximum number of contacts " +
|
||||
"(${Contact.CONTACTS_SIZE}) has been exceeded.")
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
String.format(getString(R.string.contacts_exceeded), Contact.CONTACTS_SIZE))
|
||||
} else {
|
||||
val i = Intent(this, ContactActivity::class.java)
|
||||
val b = Bundle()
|
||||
@@ -58,12 +57,10 @@ class ContactsActivity : AppCompatActivity() {
|
||||
when (item.itemId) {
|
||||
R.id.export_contacts -> {
|
||||
if (saveContacts(dir))
|
||||
Utils.alertView(this,"",
|
||||
"Exported contacts to Download folder as 'contacts.bs'.")
|
||||
Utils.alertView(this,"", getString(R.string.exported_contacts))
|
||||
else
|
||||
Utils.alertView(this,"Error",
|
||||
"Failed to export contacts to Download folder. " +
|
||||
"Check Apps -> baresip -> Permissions -> Storage.")
|
||||
Utils.alertView(this,getString(R.string.error),
|
||||
getString(R.string.export_error))
|
||||
}
|
||||
R.id.import_contacts -> {
|
||||
if (restoreContacts(dir)) {
|
||||
@@ -72,10 +69,8 @@ class ContactsActivity : AppCompatActivity() {
|
||||
clAdapter.notifyDataSetChanged()
|
||||
saveContacts(applicationContext.filesDir)
|
||||
} else
|
||||
Utils.alertView(this,"Error",
|
||||
"Failed to import contacts from Download folder. " +
|
||||
"Check Apps -> baresip -> Permissions -> Storage and that " +
|
||||
"the file exists in the folder.")
|
||||
Utils.alertView(this,getString(R.string.error),
|
||||
getString(R.string.import_error))
|
||||
}
|
||||
android.R.id.home -> {
|
||||
Log.d("Baresip", "Back array was pressed at Contacts")
|
||||
|
||||
@@ -703,7 +703,8 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
val verifyDialog = AlertDialog.Builder(this@MainActivity)
|
||||
verifyDialog.setTitle(getString(R.string.verify))
|
||||
verifyDialog.setMessage("${getString(R.string.verify_sas)} <${ev[1]}> <${ev[2]}>?")
|
||||
verifyDialog.setMessage(String.format(getString(R.string.verify_sas),
|
||||
ev[1], ev[2]))
|
||||
verifyDialog.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
val security: Int
|
||||
if (Api.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
|
||||
@@ -760,7 +761,8 @@ class MainActivity : AppCompatActivity() {
|
||||
val transferDialog = AlertDialog.Builder(this)
|
||||
val target = Utils.friendlyUri(ContactsActivity.contactName(ev[1]),
|
||||
Utils.aorDomain(aor))
|
||||
transferDialog.setMessage("${getString(R.string.transfer_query)} $target?")
|
||||
transferDialog.setMessage(String.format(getString(R.string.transfer_query),
|
||||
target))
|
||||
transferDialog.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
if (call in Call.calls())
|
||||
Api.ua_hangup(uap, callp, 0, "")
|
||||
|
||||
Reference in New Issue
Block a user