Avoid lint warnings

This commit is contained in:
Juha Heinanen
2025-12-01 07:10:56 +02:00
parent 14579d229b
commit 08efb016cd
5 changed files with 19 additions and 9 deletions

View File

@ -59,6 +59,7 @@ object Api {
external fun account_dtmfmode(acc: Long): Int
external fun account_set_dtmfmode(acc: Long, mode: Int): Int
external fun account_extra(acc: Long): String
@Suppress("unused")
external fun account_debug(acc: Long)
external fun uag_reset_transp(register: Boolean, reinvite: Boolean)
@ -69,13 +70,16 @@ object Api {
external fun ua_alloc(uri: String): Long
external fun ua_destroy(uap: Long)
external fun ua_register(uap: Long): Int
@Suppress("unused")
external fun ua_isregistered(uap: Long): Boolean
external fun ua_unregister(uap: Long)
external fun ua_accept(uap: Long, msg: Long)
external fun ua_hangup(uap: Long, callp: Long, code: Int, reason: String)
external fun ua_call_alloc(uap: Long, xcallp: Long, video: Int): Long
external fun ua_answer(uap: Long, callp: Long, video: Int)
@Suppress("unused")
external fun ua_add_custom_header(uap: Long, name: String, body: String)
@Suppress("unused")
external fun ua_debug(uap: Long)
external fun sip_treply(msg: Long, code: Int, reason: String)
@ -84,10 +88,12 @@ object Api {
external fun call_connect(callp: Long, peer_uri: String): Int
external fun call_hold(callp: Long, hold: Boolean): Int
@Suppress("unused")
external fun call_ismuted(callp: Long): Boolean
external fun call_transfer(callp: Long, peer_uri: String): Int
external fun call_send_digit(callp: Long, digit: Char): Int
external fun call_notify_sipfrag(callp: Long, code: Int, reason: String)
@Suppress("unused")
external fun call_start_audio(callp: Long)
external fun call_audio_codecs(callp: Long): String
external fun call_duration(callp: Long): Int
@ -112,6 +118,7 @@ object Api {
external fun net_add_address_ifname(ip_addr: String, if_name: String): Int
external fun net_rm_address(ip_addr: String): Int
external fun net_debug()
@Suppress("unused")
external fun net_dns_debug()
external fun config_verify_server_set(verify: Boolean)

View File

@ -423,7 +423,7 @@ private fun Avatar(
Canvas(modifier = Modifier.fillMaxSize()) {
drawCircle(SolidColor(Color(color)))
}
val text = if (name.isNotBlank()) name.substring(0, 1).uppercase() else "?"
val text = if (name.isNotBlank()) name.take(1).uppercase() else "?"
Text(text, fontSize = 72.sp, color = Color.White)
}
} else {

View File

@ -906,7 +906,7 @@ class BaresipService: Service() {
val personBuilder = Person.Builder().setName(caller)
val contactColor = callerContact?.color() ?: "#B0B0B0"
val initial = if (caller.isNotEmpty()) caller.take(1) else "?"
val textAvatarBitmap = Utils.createTextAvatar(this, initial,contactColor)
val textAvatarBitmap = Utils.createTextAvatar(initial,contactColor)
var icon = IconCompat.createWithBitmap(textAvatarBitmap)
if (callerContact is Contact.BaresipContact) {
if (callerContact.avatarImage != null)
@ -1202,7 +1202,7 @@ class BaresipService: Service() {
val personBuilder = Person.Builder().setName(sender)
val contactColor = senderContact?.color() ?: "#B0B0B0"
val initial = if (sender.isNotEmpty()) sender.take(1) else "?"
val textAvatarBitmap = Utils.createTextAvatar(this, initial,contactColor)
val textAvatarBitmap = Utils.createTextAvatar(initial,contactColor)
var icon = IconCompat.createWithBitmap(textAvatarBitmap)
if (senderContact is Contact.BaresipContact) {
if (senderContact.avatarImage != null)

View File

@ -67,7 +67,7 @@ fun NavGraphBuilder.contactsScreenRoute(
navController: NavController,
viewModel: ViewModel
) {
composable("contacts") { backStackEntry ->
composable("contacts") { _ ->
ContactsScreen(navController = navController, viewModel = viewModel)
}
}

View File

@ -75,6 +75,7 @@ import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509TrustManager
import androidx.core.graphics.toColorInt
import androidx.navigation.NavController
object Utils {
@ -1103,7 +1104,7 @@ object Utils {
return output
}
fun createTextAvatar(context: Context, letter: String, colorHex: String): Bitmap {
fun createTextAvatar(letter: String, colorHex: String): Bitmap {
// Standard notification large icon size is usually 64dp or 48dp.
// We use a decent resolution (e.g. 128x128) and let Android scale it down.
val size = 128
@ -1145,7 +1146,8 @@ object Utils {
return bitmap
}
/*fun listFilesInDirectory(directoryPath: String): List<File> {
@Suppress("unused")
fun listFilesInDirectory(directoryPath: String): List<File> {
val directory = File(directoryPath)
if (!directory.exists()) {
Log.w(TAG, "Directory does not exist: $directoryPath")
@ -1164,9 +1166,10 @@ object Utils {
return emptyList()
}
return files.filter { it.isFile }
}*/
}
/*@SuppressLint("RestrictedApi")
@SuppressLint("RestrictedApi")
@Suppress("unused", "DEPRECATION")
fun printBackStack(navController: NavController) {
Log.e(TAG, "---- Current Navigation Back Stack ----")
navController.currentBackStack.value.forEachIndexed { index, navBackStackEntry ->
@ -1177,6 +1180,6 @@ object Utils {
Log.e(TAG, "$index: Route='${route}', Args=[$arguments], ID=${navBackStackEntry.id}")
}
Log.e(TAG, "--------------------------------------")
}*/
}
}