Use lock icons for call security indication

This commit is contained in:
Juha Heinanen
2022-08-07 18:03:45 +03:00
parent 158682634d
commit c1036cddde
11 changed files with 30 additions and 13 deletions

View File

@ -788,9 +788,9 @@ class BaresipService: Service() {
}
"call verified", "call secure" -> {
if (ev[0] == "call secure") {
call!!.security = R.drawable.box_yellow
call!!.security = R.drawable.locked_yellow
} else {
call!!.security = R.drawable.box_green
call!!.security = R.drawable.locked_green
call.zid = ev[1]
}
if (!isMainVisible)

View File

@ -83,7 +83,7 @@ class Call(val callp: Long, val ua: UserAgent, val peerUri: String, val dir: Str
}
init {
if (ua.account.mediaEnc != "") security = R.drawable.box_red
if (ua.account.mediaEnc != "") security = R.drawable.unlocked
}
fun destroy() {

View File

@ -303,7 +303,7 @@ class MainActivity : AppCompatActivity() {
if (Api.cmd_exec("zrtp_unverify " + call.zid) != 0) {
Log.e(TAG, "Command 'zrtp_unverify ${call.zid}' failed")
} else {
securityButton.setImageResource(R.drawable.box_yellow)
securityButton.setImageResource(R.drawable.locked_yellow)
securityButton.tag = "yellow"
}
}
@ -1039,9 +1039,9 @@ class MainActivity : AppCompatActivity() {
setPositiveButton(getString(R.string.yes)) { dialog, _ ->
val security: Int = if (Api.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
Log.e(TAG, "Command 'zrtp_verify ${ev[3]}' failed")
R.drawable.box_yellow
R.drawable.locked_yellow
} else {
R.drawable.box_green
R.drawable.locked_green
}
call.security = security
call.zid = ev[3]
@ -1056,10 +1056,10 @@ class MainActivity : AppCompatActivity() {
dialog.dismiss()
}
setNeutralButton(getString(R.string.no)) { dialog, _ ->
call.security = R.drawable.box_yellow
call.security = R.drawable.locked_yellow
call.zid = ev[3]
if (aor == aorSpinner.tag) {
securityButton.setImageResource(R.drawable.box_yellow)
securityButton.setImageResource(R.drawable.locked_yellow)
securityButton.tag = "yellow"
securityButton.visibility = if (Call.ofCallp(callp) == null)
View.INVISIBLE
@ -1078,7 +1078,7 @@ class MainActivity : AppCompatActivity() {
handleNextEvent("Call $callp that is verified is not found")
return
}
val tag: String = if (call.security == R.drawable.box_yellow)
val tag: String = if (call.security == R.drawable.locked_yellow)
"yellow"
else
"green"
@ -1718,13 +1718,13 @@ class MainActivity : AppCompatActivity() {
private fun setSecurityButtonTag(button: ImageButton, security: Int) {
when (security) {
R.drawable.box_red -> {
R.drawable.unlocked -> {
button.tag = "red"
}
R.drawable.box_yellow -> {
R.drawable.locked_yellow -> {
button.tag = "yellow"
}
R.drawable.box_green -> {
R.drawable.locked_green -> {
button.tag = "green"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,5 @@
<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/colorGreen" 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

@ -0,0 +1,5 @@
<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/colorYellow" 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

@ -0,0 +1,5 @@
<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/colorRed" 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>

View File

@ -104,6 +104,7 @@
android:layout_weight ="0"
android:layout_gravity="center_vertical"
android:visibility="invisible"
android:background="#00000000"
android:contentDescription="@string/app_name" >
</ImageButton>

View File

@ -15,7 +15,8 @@
<color name="colorBlack">#000000</color>
<color name="colorStrong">@color/colorBlack</color>
<color name="colorGreen">#01df01</color>
<color name="colorRed">#df0101</color>
<color name="colorRed">#ff0000</color>
<color name="colorYellow">#ffef00</color>
<color name="colorLight">@color/colorWhite</color>
<color name="colorDark">#383838</color>
<color name="colorSpinnerText">@color/colorDark</color>