- Replaced all strings with string resource references.

- Added missing 7.3.0 changelog file.
This commit is contained in:
Juha Heinanen
2019-05-08 13:42:11 +03:00
parent 9033f2b07c
commit adbf62ad7d
22 changed files with 323 additions and 178 deletions
@@ -14,7 +14,7 @@ class AboutActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_about)
val aboutText = findViewById(R.id.aboutText) as TextView
aboutText.text = String.format(getText(R.string.aboutText).toString(),
aboutText.text = String.format(getText(R.string.about_text).toString(),
BuildConfig.VERSION_NAME)
aboutText.setTextColor(Color.BLACK)
}
@@ -390,43 +390,47 @@ class AccountActivity : AppCompatActivity() {
fun onClick(v: View) {
when (v) {
findViewById(R.id.DisplayNameTitle) as TextView-> {
Utils.alertView(this, "Display Name", getString(R.string.dispName))
Utils.alertView(this, getString(R.string.display_name),
getString(R.string.display_name_help))
}
findViewById(R.id.AuthUserTitle) as TextView -> {
Utils.alertView(this, "Authentication Username",
getString(R.string.authUser))
Utils.alertView(this, getString(R.string.authentication_username),
getString(R.string.authentication_username_help))
}
findViewById(R.id.AuthPassTitle) as TextView-> {
Utils.alertView(this, "Authentication Password",
getString(R.string.authPass))
Utils.alertView(this, getString(R.string.authentication_password),
getString(R.string.authentication_password_help))
}
findViewById(R.id.OutboundProxyTitle) as TextView -> {
Utils.alertView(this, "Outbound Proxies",
getString(R.string.obProxies))
Utils.alertView(this, getString(R.string.outbound_proxies),
getString(R.string.outbound_proxies_help))
}
findViewById(R.id.RegTitle) as TextView -> {
Utils.alertView(this, "Register", getString(R.string.register))
}
findViewById(R.id.MediaNatTitle) as TextView -> {
Utils.alertView(this, "Media NAT Traversal", getString(R.string.mediaNat))
}
findViewById(R.id.StunServerTitle) as TextView -> {
Utils.alertView(this, "STUN Server", getString(R.string.stunServer))
Utils.alertView(this, "Register", getString(R.string.register_help))
}
findViewById(R.id.AudioCodecsTitle) as TextView -> {
Utils.alertView(this, "Audio Codecs", getString(R.string.auCodecs))
Utils.alertView(this, getString(R.string.audio_codecs),
getString(R.string.audio_codecs_help))
}
findViewById(R.id.MediaNatTitle) as TextView -> {
Utils.alertView(this, getString(R.string.media_nat),
getString(R.string.media_nat_help))
}
findViewById(R.id.StunServerTitle) as TextView -> {
Utils.alertView(this, getString(R.string.stun_server),
getString(R.string.stun_server_help))
}
findViewById(R.id.MediaEncTitle) as TextView -> {
Utils.alertView(this, "Media Encryption",
getText(R.string.mediaEnc).toString())
Utils.alertView(this, getString(R.string.media_encryption),
getString(R.string.media_encryption_help))
}
findViewById(R.id.VoicemailUriTitle) as TextView -> {
Utils.alertView(this, "Voicemail URI",
getText(R.string.vmUri).toString())
Utils.alertView(this, getString(R.string.voicemail_uri),
getString(R.string.voicemain_uri_help))
}
findViewById(R.id.DefaultTitle) as TextView -> {
Utils.alertView(this, "Default Account",
getText(R.string.defaultAccount).toString())
Utils.alertView(this, getString(R.string.default_account),
getText(R.string.default_account_help).toString())
}
}
}
@@ -351,7 +351,7 @@ class BaresipService: Service() {
R.color.colorBaresip))
.setContentIntent(pi)
.setAutoCancel(true)
.setContentTitle("Incoming call from")
.setContentTitle(getString(R.string.incoming_call_from))
.setContentText(caller)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
nb.setVibrate(LongArray(0))
@@ -368,8 +368,10 @@ class BaresipService: Service() {
rejectIntent.putExtra("callp", callp)
val rejectPendingIntent = PendingIntent.getService(this,
REJECT_REQ_CODE, rejectIntent, PendingIntent.FLAG_UPDATE_CURRENT)
nb.addAction(R.drawable.ic_stat, "Answer", answerPendingIntent)
nb.addAction(R.drawable.ic_stat, "Reject", rejectPendingIntent)
nb.addAction(R.drawable.ic_stat, getString(R.string.answer),
answerPendingIntent)
nb.addAction(R.drawable.ic_stat, getString(R.string.reject),
rejectPendingIntent)
nm.notify(CALL_NOTIFICATION_ID, nb.build())
return
}
@@ -436,7 +438,7 @@ class BaresipService: Service() {
.setContentIntent(pi)
.setDefaults(Notification.DEFAULT_SOUND)
.setAutoCancel(true)
.setContentTitle("Call transfer request to")
.setContentTitle(getString(R.string.transfer_request))
.setContentText(target)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
nb.setVibrate(LongArray(0))
@@ -455,8 +457,10 @@ class BaresipService: Service() {
denyIntent.putExtra("callp", callp)
val denyPendingIntent = PendingIntent.getService(this,
DENY_REQ_CODE, denyIntent, PendingIntent.FLAG_UPDATE_CURRENT)
nb.addAction(R.drawable.ic_stat, "Accept", acceptPendingIntent)
nb.addAction(R.drawable.ic_stat, "Deny", denyPendingIntent)
nb.addAction(R.drawable.ic_stat, getString(R.string.accept),
acceptPendingIntent)
nb.addAction(R.drawable.ic_stat, getString(R.string.deny),
denyPendingIntent)
nm.notify(TRANSFER_NOTIFICATION_ID, nb.build())
return
}
@@ -541,7 +545,7 @@ class BaresipService: Service() {
.setContentIntent(pi)
.setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
.setAutoCancel(true)
.setContentTitle("Message from $sender")
.setContentTitle(getString(R.string.message_from) + " " + sender)
.setContentText(text)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
nb.setVibrate(LongArray(0))
@@ -59,10 +59,10 @@ class ChatActivity : AppCompatActivity() {
else
chatPeer = chatPeer.substring(4)
}
setTitle("Chat with $chatPeer")
setTitle("${getString(R.string.chat_with)} $chatPeer")
val headerView = findViewById(R.id.account) as TextView
val headerText = "Account ${aor.substringAfter(":")}"
val headerText = "${getString(R.string.account)} ${aor.substringAfter(":")}"
headerView.text = headerText
listView = findViewById(R.id.messages) as ListView
@@ -99,16 +99,17 @@ class ChatActivity : AppCompatActivity() {
}
}
val builder = AlertDialog.Builder(this@ChatActivity, R.style.Theme_AppCompat)
if (chatPeer.contains("@") || Utils.checkTelNo(chatPeer))
builder.setMessage("Do you want to delete message or add peer $chatPeer to contacts?")
.setPositiveButton("Cancel", dialogClickListener)
.setNegativeButton("Delete Message", dialogClickListener)
.setNeutralButton("Add Contact", dialogClickListener)
if (ContactsActivity.contactName(peerUri) == peerUri)
builder.setMessage(String.format(getText(R.string.long_message_question).toString(),
chatPeer))
.setPositiveButton(getString(R.string.cancel), dialogClickListener)
.setNegativeButton(getString(R.string.delete_message), dialogClickListener)
.setNeutralButton(getString(R.string.add_contact), dialogClickListener)
.show()
else
builder.setMessage("Do you want to delete message?")
.setPositiveButton("Cancel", dialogClickListener)
.setNegativeButton("Delete Message", dialogClickListener)
builder.setMessage(getText(R.string.short_message_question))
.setPositiveButton(getString(R.string.cancel), dialogClickListener)
.setNegativeButton(getString(R.string.delete_message), dialogClickListener)
.show()
true
}
@@ -133,10 +134,10 @@ class ChatActivity : AppCompatActivity() {
Message.add(msg)
chatMessages.add(msg)
if (Api.message_send(ua.uap, peerUri, msgText, time.toString()) != 0) {
Toast.makeText(getApplicationContext(), "Sending of message failed!",
Toast.makeText(getApplicationContext(), "${getString(R.string.message_failed)}!",
Toast.LENGTH_SHORT).show()
msg.direction = R.drawable.arrow_up_red
msg.responseReason = "Sending of message failed"
msg.responseReason = getString(R.string.message_failed)
} else {
newMessage.text.clear()
BaresipService.chatTexts.remove("$aor::$peerUri")
@@ -218,31 +218,39 @@ class ConfigActivity : AppCompatActivity() {
fun onClick(v: View) {
when (v) {
findViewById(R.id.AutoStartTitle) as TextView-> {
Utils.alertView(this, "Start Automatically", getString(R.string.autoStart))
Utils.alertView(this, getString(R.string.start_automatically),
getString(R.string.start_automatically_help))
}
findViewById(R.id.ListenAddressTitle) as TextView-> {
Utils.alertView(this, "Listen Address", getString(R.string.listenAddress))
Utils.alertView(this, getString(R.string.listen_address),
getString(R.string.listen_address_help))
}
findViewById(R.id.PreferIPv6Title) as TextView-> {
Utils.alertView(this, "Prefer IPv6", getString(R.string.preferIPv6))
Utils.alertView(this, getString(R.string.prefer_ipv6),
getString(R.string.prefer_ipv6_help))
}
findViewById(R.id.DnsServersTitle) as TextView -> {
Utils.alertView(this, "DNS Servers", getString(R.string.dnsServers))
Utils.alertView(this, getString(R.string.dns_servers),
getString(R.string.dns_servers_help))
}
findViewById(R.id.OpusBitRateTitle) as TextView-> {
Utils.alertView(this, "Opus Bit Rate", getString(R.string.opusBitRate))
Utils.alertView(this, getString(R.string.opus_bit_rate),
getString(R.string.opus_bit_rate_help))
}
findViewById(R.id.IceLiteTitle) as TextView-> {
Utils.alertView(this, "ICE Lite Mode", getString(R.string.iceLite))
Utils.alertView(this, getString(R.string.ice_lite_mode),
getString(R.string.ice_lite_mode_help))
}
findViewById(R.id.VolumeTitle) as TextView-> {
Utils.alertView(this, "Call Volume", getString(R.string.callVolume))
Utils.alertView(this, getString(R.string.default_call_volume),
getString(R.string.default_call_volume_help))
}
findViewById(R.id.DebugTitle) as TextView-> {
Utils.alertView(this, "Debug", getString(R.string.debug))
Utils.alertView(this, getString(R.string.debug), getString(R.string.debug_help))
}
findViewById(R.id.ResetTitle) as TextView-> {
Utils.alertView(this, "Reset", getString(R.string.reset))
Utils.alertView(this, getString(R.string.reset_config),
getString(R.string.reset_config_help))
}
}
}
@@ -208,18 +208,18 @@ class MainActivity : AppCompatActivity() {
securityButton.setOnClickListener {
when (securityButton.tag) {
"red" -> {
Utils.alertView(this, "Alert", "This call is NOT secure!")
Utils.alertView(this, getString(R.string.alert),
getString(R.string.call_not_secure))
}
"yellow" -> {
Utils.alertView(this, "Alert",
"This call is SECURE, but peer is NOT verified!")
Utils.alertView(this, getString(R.string.alert),
getString(R.string.peer_not_verified))
}
"green" -> {
val unverifyDialog = AlertDialog.Builder(this)
unverifyDialog.setTitle("Info")
unverifyDialog.setMessage("This call is SECURE and peer is VERIFIED! " +
"Do you want to unverify the peer?")
unverifyDialog.setPositiveButton("Unverify") { dialog, _ ->
unverifyDialog.setTitle(getString(R.string.info))
unverifyDialog.setMessage(getString(R.string.call_is_secure))
unverifyDialog.setPositiveButton(getString(R.string.unverify)) { dialog, _ ->
val calls = Call.uaCalls(UserAgent.uas()[aorSpinner.selectedItemPosition],
"")
if (calls.size > 0) {
@@ -233,7 +233,7 @@ class MainActivity : AppCompatActivity() {
}
dialog.dismiss()
}
unverifyDialog.setNegativeButton("No") { dialog, _ ->
unverifyDialog.setNegativeButton(getString(R.string.no)) { dialog, _ ->
dialog.dismiss()
}
unverifyDialog.create().show()
@@ -257,7 +257,8 @@ class MainActivity : AppCompatActivity() {
}
}
if (!Utils.checkSipUri(uri))
Utils.alertView(this, "Notice", "Invalid SIP URI '$uri'")
Utils.alertView(this, getString(R.string.notice),
"${getString(R.string.invalid_sip_uri)} '$uri'")
else
call(ua, uri, "outgoing")
} else {
@@ -328,11 +329,11 @@ class MainActivity : AppCompatActivity() {
val rate = status.split('=')[1]
val txCodec = codecs.split(',')[0].split("/")
val rxCodec = codecs.split(',')[1].split("/")
Utils.alertView(this, "Call Info",
"Duration: $duration\n" +
"Codecs: ${txCodec[0]} ch ${txCodec[2]}/" +
Utils.alertView(this, getString(R.string.call_info),
"${getString(R.string.duration)}: $duration\n" +
"${getString(R.string.codecs)}: ${txCodec[0]} ch ${txCodec[2]}/" +
"${rxCodec[0]} ch ${rxCodec[2]}\n" +
"Rate: $rate")
"${getString(R.string.rate)}: $rate")
}
}
}
@@ -359,10 +360,10 @@ class MainActivity : AppCompatActivity() {
}
val builder = AlertDialog.Builder(this@MainActivity,
R.style.Theme_AppCompat)
builder.setTitle("Voicemail Messages")
builder.setTitle(getString(R.string.voicemail_messages))
builder.setMessage(acc.vmMessage())
.setPositiveButton("Cancel", dialogClickListener)
.setNegativeButton("Check", dialogClickListener)
.setPositiveButton(getString(R.string.cancel), dialogClickListener)
.setNegativeButton(getString(R.string.check), dialogClickListener)
.show()
}
}
@@ -447,7 +448,7 @@ class MainActivity : AppCompatActivity() {
when (action) {
"call" -> {
if (!Call.calls().isEmpty()) {
Toast.makeText(applicationContext, "You already have an active call!",
Toast.makeText(applicationContext, getString(R.string.call_already_active),
Toast.LENGTH_SHORT).show()
return
}
@@ -561,9 +562,9 @@ class MainActivity : AppCompatActivity() {
Log.d("Baresip", "Handling service event 'stopped' with param ${params[0]}")
if (params[0] != "") {
val alertDialog = AlertDialog.Builder(this).create()
alertDialog.setTitle("Notice")
alertDialog.setMessage("Baresip failed to start! Listen Address was reset. Restart baresip.")
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK"
alertDialog.setTitle(getString(R.string.notice))
alertDialog.setMessage(getString(R.string.start_failed))
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getString(R.string.ok)
) { dialog, _ ->
dialog.dismiss()
quitTimer.cancel()
@@ -601,7 +602,8 @@ class MainActivity : AppCompatActivity() {
"registering failed" -> {
uaAdapter.notifyDataSetChanged()
Toast.makeText(applicationContext,
"Registering of $aor failed: ${ev[1]}",
String.format(getText(R.string.registering_failed).toString(),
aor) + ": ${ev[1]}",
Toast.LENGTH_LONG).show()
}
"call ringing" -> {
@@ -618,7 +620,7 @@ class MainActivity : AppCompatActivity() {
Manifest.permission.RECORD_AUDIO) ==
PackageManager.PERMISSION_DENIED) {
Toast.makeText(applicationContext,
"You have not granted microphone permission.",
getString(R.string.no_microphone_permission),
Toast.LENGTH_SHORT).show()
Api.ua_hangup(uap, callp, 486, "Busy Here")
return
@@ -633,7 +635,7 @@ class MainActivity : AppCompatActivity() {
(ua != UserAgent.uas()[aorSpinner.selectedItemPosition])) {
aorSpinner.setSelection(account_index)
} else {
callTitle.text = "Incoming call from ..."
callTitle.text = getString(R.string.incoming_call_from_dots)
callUri.setAdapter(null)
callUri.setText(Utils.friendlyUri(ContactsActivity.contactName(call.peerURI),
Utils.aorDomain(ua.account.aor)))
@@ -665,9 +667,9 @@ class MainActivity : AppCompatActivity() {
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL)
if (ua == UserAgent.uas()[aorSpinner.selectedItemPosition]) {
if (call.dir == "in")
callTitle.text = "Incoming call from ..."
callTitle.text = getString(R.string.incoming_call_from_dots)
else
callTitle.text = "Outgoing call to ..."
callTitle.text = getString(R.string.outgoing_call_to_dots)
if (acc.mediaEnc == "") {
securityButton.visibility = View.INVISIBLE
} else {
@@ -683,7 +685,7 @@ class MainActivity : AppCompatActivity() {
holdButton.setImageResource(R.drawable.pause)
holdButton.visibility = View.VISIBLE
dtmf.setText("")
dtmf.hint = "DTMF"
dtmf.hint = getString(R.string.dtmf)
dtmf.visibility = View.VISIBLE
dtmf.requestFocus()
if (dtmfWatcher != null) dtmf.removeTextChangedListener(dtmfWatcher)
@@ -700,9 +702,9 @@ class MainActivity : AppCompatActivity() {
return
}
val verifyDialog = AlertDialog.Builder(this@MainActivity)
verifyDialog.setTitle("Verify")
verifyDialog.setMessage("Do you want to verify SAS <${ev[1]}> <${ev[2]}>?")
verifyDialog.setPositiveButton("Yes") { dialog, _ ->
verifyDialog.setTitle(getString(R.string.verify))
verifyDialog.setMessage("${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) {
Log.e("Baresip", "Command 'zrtp_verify ${ev[3]}' failed")
@@ -719,7 +721,7 @@ class MainActivity : AppCompatActivity() {
dialog.dismiss()
}
}
verifyDialog.setNegativeButton("No") { dialog, _ ->
verifyDialog.setNegativeButton(getString(R.string.no)) { dialog, _ ->
call.security = R.drawable.box_yellow
call.zid = ev[3]
if (ua == UserAgent.uas()[aorSpinner.selectedItemPosition]) {
@@ -758,15 +760,15 @@ class MainActivity : AppCompatActivity() {
val transferDialog = AlertDialog.Builder(this)
val target = Utils.friendlyUri(ContactsActivity.contactName(ev[1]),
Utils.aorDomain(aor))
transferDialog.setMessage("Do you accept to transfer call to $target?")
transferDialog.setPositiveButton("Yes") { dialog, _ ->
transferDialog.setMessage("${getString(R.string.transfer_query)} $target?")
transferDialog.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
if (call in Call.calls())
Api.ua_hangup(uap, callp, 0, "")
call(ua, ev[1], "transferring")
showCall(ua)
dialog.dismiss()
}
transferDialog.setNegativeButton("No") { dialog, _ ->
transferDialog.setNegativeButton(getString(R.string.no)) { dialog, _ ->
if (call in Call.calls())
Api.call_notify_sipfrag(callp, 603, "Decline")
dialog.dismiss()
@@ -795,10 +797,12 @@ class MainActivity : AppCompatActivity() {
val param = ev[1].trim()
if ((param != "") && (Call.uaCalls(ua, "").size == 0)) {
if (param.get(0).isDigit())
Toast.makeText(applicationContext, "Call failed: $param",
Toast.makeText(applicationContext,
"${getString(R.string.call_failed)}: $param",
Toast.LENGTH_LONG).show()
else
Toast.makeText(applicationContext, "Call closed: $param",
Toast.makeText(applicationContext,
"${getString(R.string.call_closed)}: $param",
Toast.LENGTH_LONG).show()
}
}
@@ -959,8 +963,8 @@ class MainActivity : AppCompatActivity() {
CONFIG_CODE -> {
if ((resultCode == RESULT_OK) &&
(data!!.getBooleanExtra("restart", true)))
Utils.alertView(this, "Notice",
"You need to restart baresip in order to activate the new config!")
Utils.alertView(this, getString(R.string.notice),
getString(R.string.restart_needed))
if (resultCode == RESULT_CANCELED)
Log.d("Baresip", "Config canceled")
}
@@ -1000,7 +1004,7 @@ class MainActivity : AppCompatActivity() {
if (ContextCompat.checkSelfPermission(applicationContext, Manifest.permission.RECORD_AUDIO)
== PackageManager.PERMISSION_DENIED) {
Toast.makeText(applicationContext,
"You have not granted microphone permission.", Toast.LENGTH_SHORT).show()
getString(R.string.no_microphone_permission), Toast.LENGTH_SHORT).show()
return
}
if (ua != UserAgent.uas()[aorSpinner.selectedItemPosition])
@@ -1073,9 +1077,9 @@ class MainActivity : AppCompatActivity() {
private fun showCall(ua: UserAgent) {
if (Call.uaCalls(ua, "").size == 0) {
callTitle.text = "Outgoing call to ..."
callTitle.text = getString(R.string.outgoing_call_to_dots)
callUri.text.clear()
callUri.hint = "Callee"
callUri.hint = getString(R.string.callee)
callUri.isFocusable = true
callUri.isFocusableInTouchMode = true
imm.hideSoftInputFromWindow(callUri.windowToken, 0)
@@ -1096,11 +1100,11 @@ class MainActivity : AppCompatActivity() {
if (callsOut.size > 0) {
call = callsOut[callsOut.size - 1]
if (call.status == "transferring")
callTitle.text = "Transferring call to ..."
callTitle.text = getString(R.string.transferring_call_to_dots)
else
callTitle.text = "Outgoing call to ..."
callTitle.text = getString(R.string.outgoing_call_to_dots)
} else {
callTitle.text = "Incoming call from ..."
callTitle.text = getString(R.string.incoming_call_from_dots)
call = callsIn[callsIn.size - 1]
}
callUri.setText(Utils.friendlyUri(ContactsActivity.contactName(call.peerURI),