From 04d5fa2bf1cb3868ef418f8c6e81ff8d1a794ca0 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Sat, 26 Apr 2025 10:46:47 +0300 Subject: [PATCH] Completed app bar icon tooltips --- app/build.gradle.kts | 4 +- .../kotlin/com/tutpro/baresip/MainActivity.kt | 116 ++++++++---------- 2 files changed, 56 insertions(+), 64 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7a36fd67..12a221f1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,8 +11,8 @@ android { applicationId = "com.tutpro.baresip" minSdk = 28 targetSdk = 35 - versionCode = 426 - versionName = "65.3.0" + versionCode = 427 + versionName = "66.0.0" externalNativeBuild { cmake { cFlags += "-DHAVE_INTTYPES_H -lstdc++" diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt index 40dcdf77..ba753b7a 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt @@ -678,8 +678,9 @@ class MainActivity : ComponentActivity() { ), actions = { - IconButton( - modifier = Modifier.combinedClickable( + Icon( + imageVector = recImage, + modifier = Modifier.size(40.dp).combinedClickable( onClick = { if (Call.call("connected") == null) { BaresipService.isRecOn = !BaresipService.isRecOn @@ -696,77 +697,68 @@ class MainActivity : ComponentActivity() { onLongClick = { alertTitle.value = "Call Recording" alertMessage.value = "If activated, new incoming and outgoing calls will be recorded." + - "Recordings can be played on Call Details page" + " Recordings can be played on Call Details page" showAlert.value = true } ), - onClick = {} - ) { - Icon( - imageVector = recImage, - tint = Color.Unspecified, - contentDescription = null - ) - } + tint = Color.Unspecified, + contentDescription = null + ) - Spacer(modifier = Modifier.width(16.dp)) + Spacer(modifier = Modifier.width(22.dp)) - IconButton( - modifier = Modifier.padding(end=12.dp) - .combinedClickable( - onClick = { - if (Call.call("connected") != null) { - BaresipService.isMicMuted = !BaresipService.isMicMuted - if (BaresipService.isMicMuted) { - micIcon = R.drawable.mic_off - Api.calls_mute(true) - } else { - micIcon = R.drawable.mic_on - Api.calls_mute(false) - } - } - }, - onLongClick = { - alertTitle.value = "Microphone" - alertMessage.value = "If activated, microphone is muted." - showAlert.value = true - }, - ), - onClick = {} - ) { - Icon( - imageVector = ImageVector.vectorResource(micIcon), - tint = Color.Unspecified, - contentDescription = null) - } - - IconButton( - modifier = Modifier.padding(end=6.dp) - .combinedClickable( + Icon( + imageVector = ImageVector.vectorResource(micIcon), + modifier = Modifier.size(40.dp).combinedClickable( onClick = { - if (Build.VERSION.SDK_INT >= 31) - Log.d(TAG, "Toggling speakerphone when dev/mode is " + - "${am.communicationDevice!!.type}/${am.mode}" - ) - Utils.toggleSpeakerPhone(ContextCompat.getMainExecutor(ctx), am) - speakerIcon = if (Utils.isSpeakerPhoneOn(am)) - R.drawable.speaker_on - else - R.drawable.speaker_off + if (Call.call("connected") != null) { + BaresipService.isMicMuted = !BaresipService.isMicMuted + if (BaresipService.isMicMuted) { + micIcon = R.drawable.mic_off + Api.calls_mute(true) + } else { + micIcon = R.drawable.mic_on + Api.calls_mute(false) + } + } }, onLongClick = { - alertTitle.value = "Speakerphone" - alertMessage.value = "If activated, audio is player via speakerphone." + alertTitle.value = "Microphone" + alertMessage.value = "If activated during call, microphone is muted." showAlert.value = true }, ), - onClick = {} - ) { - Icon( - imageVector = ImageVector.vectorResource(speakerIcon), - tint = Color.Unspecified, - contentDescription = null) - } + tint = Color.Unspecified, + contentDescription = null + ) + + Spacer(modifier = Modifier.width(16.dp)) + + Icon( + imageVector = ImageVector.vectorResource(speakerIcon), + modifier = Modifier.size(40.dp).combinedClickable( + onClick = { + if (Build.VERSION.SDK_INT >= 31) + Log.d(TAG, "Toggling speakerphone when dev/mode is " + + "${am.communicationDevice!!.type}/${am.mode}" + ) + Utils.toggleSpeakerPhone(ContextCompat.getMainExecutor(ctx), am) + speakerIcon = if (Utils.isSpeakerPhoneOn(am)) + R.drawable.speaker_on + else + R.drawable.speaker_off + }, + onLongClick = { + alertTitle.value = "Speakerphone" + alertMessage.value = "If activated, audio is player via device speakerphone." + showAlert.value = true + }, + ), + tint = Color.Unspecified, + contentDescription = null + ) + + Spacer(modifier = Modifier.width(8.dp)) IconButton( onClick = { menuExpanded = !menuExpanded }