Replaced lock drawables with Material Design lock icons

This commit is contained in:
Juha Heinanen
2025-11-21 13:08:06 +02:00
parent df21c2eff3
commit d6002fcd4c
6 changed files with 33 additions and 43 deletions

View File

@ -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)

View File

@ -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() {

View File

@ -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 = ""

View File

@ -1,5 +0,0 @@
<vector android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/colorTrafficGreen" android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>

View File

@ -1,5 +0,0 @@
<vector android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/colorTrafficYellow" android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>

View File

@ -1,5 +0,0 @@
<vector android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/colorTrafficRed" android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"/>
</vector>