diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt
index a539b8d5..30403c2f 100644
--- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt
+++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt
@@ -965,9 +965,9 @@ class BaresipService: Service() {
}
"call verified", "call secure" -> {
if (ev[0] == "call secure") {
- call!!.security = R.drawable.locked_yellow
+ call!!.security = R.color.colorTrafficYellow
} else {
- call!!.security = R.drawable.locked_green
+ call!!.security = R.color.colorTrafficGreen
call.zid = ev[1]
}
if (!isMainVisible)
diff --git a/app/src/main/kotlin/com/tutpro/baresip/Call.kt b/app/src/main/kotlin/com/tutpro/baresip/Call.kt
index 76fe5e90..aa6e1cf2 100644
--- a/app/src/main/kotlin/com/tutpro/baresip/Call.kt
+++ b/app/src/main/kotlin/com/tutpro/baresip/Call.kt
@@ -9,7 +9,7 @@ class Call(val callp: Long, val ua: UserAgent, val peerUri: String, val dir: Str
var onHoldCall: Call? = null
var newCall: Call? = null
var rejected = false // Incoming rejected by user or outgoing fails but not due to 408 or 480
- var security = R.drawable.unlocked
+ var security = R.color.colorTrafficRed
var zid = ""
var startTime: GregorianCalendar? = null // Set when call is established
var referTo = ""
@@ -87,7 +87,7 @@ class Call(val callp: Long, val ua: UserAgent, val peerUri: String, val dir: Str
}
init {
- if (ua.account.mediaEnc != "") security = R.drawable.unlocked
+ if (ua.account.mediaEnc != "") security = R.color.colorTrafficRed
}
fun destroy() {
diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt
index b36a2cbe..729116a3 100644
--- a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt
+++ b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt
@@ -62,6 +62,8 @@ import androidx.compose.material.icons.filled.Dialpad
import androidx.compose.material.icons.filled.History
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
+import androidx.compose.material.icons.filled.Lock
+import androidx.compose.material.icons.filled.LockOpen
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.Mic
import androidx.compose.material.icons.filled.MicOff
@@ -815,7 +817,7 @@ private fun BottomBar(ctx: Context, viewModel: ViewModel, navController: NavCont
private val callUri = mutableStateOf("")
private var callUriEnabled = mutableStateOf(true)
private val callUriLabel = mutableStateOf("")
-private var securityIcon = mutableIntStateOf(-1)
+private var securityIconTint = mutableIntStateOf(-1)
private val showCallTimer = mutableStateOf(false)
private var callDuration = 0
private val showSuggestions = mutableStateOf(false)
@@ -1049,8 +1051,8 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
) {
Icon(
imageVector = ImageVector.vectorResource(
- uasStatus.value[selected] ?:
- R.drawable.locked_yellow),
+ uasStatus.value[selected] ?: R.drawable.circle_yellow
+ ),
contentDescription = null,
tint = Color.Unspecified,
modifier = Modifier
@@ -1265,7 +1267,7 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) {
},
modifier = Modifier.padding(start = 6.dp,
top = 4.dp,
- end = if (securityIcon.intValue != -1) 6.dp else 0.dp),
+ end = if (securityIconTint.intValue != -1) 6.dp else 0.dp),
)
DisposableEffect(Unit) {
onDispose {
@@ -1276,28 +1278,31 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) {
}
}
}
- if (securityIcon.intValue != -1) {
+ if (securityIconTint.intValue != -1) {
Icon(
- imageVector = ImageVector.vectorResource(securityIcon.intValue),
+ imageVector = if (securityIconTint.intValue == R.color.colorTrafficRed)
+ Icons.Filled.LockOpen
+ else
+ Icons.Filled.Lock,
contentDescription = null,
modifier = Modifier
.size(28.dp)
.padding(top = 4.dp)
.clickable {
- when (securityIcon.intValue) {
- R.drawable.unlocked -> {
+ when (securityIconTint.intValue) {
+ R.color.colorTrafficRed -> {
alertTitle.value = ctx.getString(R.string.alert)
alertMessage.value = ctx.getString(R.string.call_not_secure)
showAlert.value = true
}
- R.drawable.locked_yellow -> {
+ R.color.colorTrafficYellow -> {
alertTitle.value = ctx.getString(R.string.alert)
alertMessage.value = ctx.getString(R.string.peer_not_verified)
showAlert.value = true
}
- R.drawable.locked_green -> {
+ R.color.colorTrafficGreen -> {
dialogTitle.value = ctx.getString(R.string.info)
dialogMessage.value = ctx.getString(R.string.call_is_secure)
positiveText.value = ctx.getString(R.string.unverify)
@@ -1311,7 +1316,7 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) {
"Command 'zrtp_unverify ${call.zid}' failed"
)
else
- securityIcon.intValue = R.drawable.locked_yellow
+ securityIconTint.intValue = R.color.colorTrafficYellow
}
}
negativeText.value = ctx.getString(R.string.cancel)
@@ -1319,7 +1324,7 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) {
}
}
},
- tint = Color.Unspecified,
+ tint = colorResource(securityIconTint.intValue)
)
}
}
@@ -2049,7 +2054,7 @@ private fun showCall(ctx: Context, viewModel: ViewModel, ua: UserAgent?, showCal
callUriLabel.value = ctx.getString(R.string.outgoing_call_to_dots)
callUriEnabled.value = true
showCallTimer.value = false
- securityIcon.intValue = -1
+ securityIconTint.intValue = -1
showHangupButton.value = false
callTransfer.value = false
dtmfText.value = ""
@@ -2089,7 +2094,7 @@ private fun showCall(ctx: Context, viewModel: ViewModel, ua: UserAgent?, showCal
ctx.getString(R.string.outgoing_call_to_dots)
callUri.value = Utils.friendlyUri(ctx, call.peerUri, ua.account)
showCallTimer.value = false
- securityIcon.intValue = -1
+ securityIconTint.intValue = -1
showCallButton.value = false
showCancelButton.value = call.status == "outgoing"
showHangupButton.value = !showCancelButton.value
@@ -2099,7 +2104,7 @@ private fun showCall(ctx: Context, viewModel: ViewModel, ua: UserAgent?, showCal
}
"incoming" -> {
showCallTimer.value = false
- securityIcon.intValue = -1
+ securityIconTint.intValue = -1
val uri = call.diverterUri()
if (uri != "") {
callUriLabel.value = ctx.getString(R.string.diverted_by_dots)
@@ -2135,9 +2140,9 @@ private fun showCall(ctx: Context, viewModel: ViewModel, ua: UserAgent?, showCal
callDuration = call.duration()
showCallTimer.value = true
if (ua.account.mediaEnc == "")
- securityIcon.intValue = -1
+ securityIconTint.intValue = -1
else
- securityIcon.intValue = call.security
+ securityIconTint.intValue = call.security
showCallButton.value = false
showCancelButton.value = false
showHangupButton.value = true
@@ -2253,20 +2258,20 @@ fun handleServiceEvent(ctx: Context, viewModel: ViewModel, event: String, params
onPositiveClicked.value = {
call.security = if (Api.cmd_exec("zrtp_verify ${ev[2]}") != 0) {
Log.e(TAG, "Command 'zrtp_verify ${ev[2]}' failed")
- R.drawable.locked_yellow
+ R.color.colorTrafficYellow
} else {
- R.drawable.locked_green
+ R.color.colorTrafficGreen
}
call.zid = ev[2]
if (aor == viewModel.selectedAor.value)
- securityIcon.intValue = call.security
+ securityIconTint.intValue = call.security
}
negativeText.value = ctx.getString(R.string.no)
onNegativeClicked.value = {
- call.security = R.drawable.locked_yellow
+ call.security = R.color.colorTrafficYellow
call.zid = ev[2]
if (aor == viewModel.selectedAor.value)
- securityIcon.intValue = R.drawable.locked_yellow
+ securityIconTint.intValue = R.color.colorTrafficYellow
onNegativeClicked.value = {}
}
showDialog.value = true
@@ -2279,7 +2284,7 @@ fun handleServiceEvent(ctx: Context, viewModel: ViewModel, event: String, params
return
}
if (aor == viewModel.selectedAor.value)
- securityIcon.intValue = call.security
+ securityIconTint.intValue = call.security
}
"call transfer", "transfer show" -> {
if (!BaresipService.isMainVisible)
@@ -2330,7 +2335,7 @@ fun handleServiceEvent(ctx: Context, viewModel: ViewModel, event: String, params
}
else {
showCallTimer.value = false
- securityIcon.intValue = -1
+ securityIconTint.intValue = -1
}
if (aor == viewModel.selectedAor.value) {
ua.account.resumeUri = ""
diff --git a/app/src/main/res/drawable/locked_green.xml b/app/src/main/res/drawable/locked_green.xml
deleted file mode 100644
index e486aafd..00000000
--- a/app/src/main/res/drawable/locked_green.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/locked_yellow.xml b/app/src/main/res/drawable/locked_yellow.xml
deleted file mode 100644
index 2587b98e..00000000
--- a/app/src/main/res/drawable/locked_yellow.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/unlocked.xml b/app/src/main/res/drawable/unlocked.xml
deleted file mode 100644
index e27302b6..00000000
--- a/app/src/main/res/drawable/unlocked.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-