Added tooltips to mic and speakerphone icons
This commit is contained in:
@ -82,7 +82,6 @@ import androidx.compose.material.icons.filled.KeyboardArrowUp
|
|||||||
import androidx.compose.material.icons.filled.Menu
|
import androidx.compose.material.icons.filled.Menu
|
||||||
import androidx.compose.material.icons.outlined.Clear
|
import androidx.compose.material.icons.outlined.Clear
|
||||||
import androidx.compose.material3.BasicAlertDialog
|
import androidx.compose.material3.BasicAlertDialog
|
||||||
import androidx.compose.material3.Button
|
|
||||||
import androidx.compose.material3.ButtonColors
|
import androidx.compose.material3.ButtonColors
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
@ -93,21 +92,17 @@ import androidx.compose.material3.IconButton
|
|||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.OutlinedTextFieldDefaults
|
import androidx.compose.material3.OutlinedTextFieldDefaults
|
||||||
import androidx.compose.material3.RichTooltip
|
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.material3.TextField
|
import androidx.compose.material3.TextField
|
||||||
import androidx.compose.material3.TooltipBox
|
|
||||||
import androidx.compose.material3.TooltipDefaults
|
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.material3.TopAppBarDefaults
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.Indicator
|
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.Indicator
|
||||||
import androidx.compose.material3.pulltorefresh.pullToRefresh
|
import androidx.compose.material3.pulltorefresh.pullToRefresh
|
||||||
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
||||||
import androidx.compose.material3.rememberTooltipState
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
@ -116,7 +111,6 @@ import androidx.compose.runtime.mutableFloatStateOf
|
|||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@ -153,12 +147,10 @@ import com.tutpro.baresip.CustomElements.SelectableAlertDialog
|
|||||||
import com.tutpro.baresip.CustomElements.Text
|
import com.tutpro.baresip.CustomElements.Text
|
||||||
import com.tutpro.baresip.CustomElements.verticalScrollbar
|
import com.tutpro.baresip.CustomElements.verticalScrollbar
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import kotlin.collections.set
|
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
@ -685,34 +677,9 @@ class MainActivity : ComponentActivity() {
|
|||||||
containerColor = LocalCustomColors.current.primary
|
containerColor = LocalCustomColors.current.primary
|
||||||
),
|
),
|
||||||
actions = {
|
actions = {
|
||||||
val scope = rememberCoroutineScope()
|
|
||||||
val tooltipState = rememberTooltipState()
|
|
||||||
TooltipBox(
|
|
||||||
positionProvider = TooltipDefaults.rememberRichTooltipPositionProvider(),
|
|
||||||
tooltip = {
|
|
||||||
RichTooltip(
|
|
||||||
title = { Text(
|
|
||||||
text = "Call Recording",
|
|
||||||
color = LocalCustomColors.current.alert,
|
|
||||||
fontSize = 18.sp,
|
|
||||||
modifier = Modifier.padding(bottom = 4.dp)
|
|
||||||
) },
|
|
||||||
text = { Text(
|
|
||||||
text = "If activated, new incoming or outgoing calls are recorded.",
|
|
||||||
color = LocalCustomColors.current.itemText,
|
|
||||||
fontSize = 16.sp
|
|
||||||
) },
|
|
||||||
caretSize = TooltipDefaults.caretSize,
|
|
||||||
shape = RoundedCornerShape(16.dp),
|
|
||||||
colors = TooltipDefaults.richTooltipColors(
|
|
||||||
containerColor = LocalCustomColors.current.cardBackground,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
enableUserInput = true,
|
|
||||||
state = tooltipState
|
|
||||||
) {
|
|
||||||
IconButton(
|
IconButton(
|
||||||
|
modifier = Modifier.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (Call.call("connected") == null) {
|
if (Call.call("connected") == null) {
|
||||||
BaresipService.isRecOn = !BaresipService.isRecOn
|
BaresipService.isRecOn = !BaresipService.isRecOn
|
||||||
@ -726,6 +693,14 @@ class MainActivity : ComponentActivity() {
|
|||||||
} else
|
} else
|
||||||
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT).show()
|
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT).show()
|
||||||
},
|
},
|
||||||
|
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"
|
||||||
|
showAlert.value = true
|
||||||
|
}
|
||||||
|
),
|
||||||
|
onClick = {}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = recImage,
|
imageVector = recImage,
|
||||||
@ -733,12 +708,12 @@ class MainActivity : ComponentActivity() {
|
|||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(16.dp))
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = Modifier.padding(end=12.dp),
|
modifier = Modifier.padding(end=12.dp)
|
||||||
|
.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (Call.call("connected") != null) {
|
if (Call.call("connected") != null) {
|
||||||
BaresipService.isMicMuted = !BaresipService.isMicMuted
|
BaresipService.isMicMuted = !BaresipService.isMicMuted
|
||||||
@ -750,7 +725,14 @@ class MainActivity : ComponentActivity() {
|
|||||||
Api.calls_mute(false)
|
Api.calls_mute(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
onLongClick = {
|
||||||
|
alertTitle.value = "Microphone"
|
||||||
|
alertMessage.value = "If activated, microphone is muted."
|
||||||
|
showAlert.value = true
|
||||||
|
},
|
||||||
|
),
|
||||||
|
onClick = {}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = ImageVector.vectorResource(micIcon),
|
imageVector = ImageVector.vectorResource(micIcon),
|
||||||
@ -759,7 +741,8 @@ class MainActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = Modifier.padding(end=6.dp),
|
modifier = Modifier.padding(end=6.dp)
|
||||||
|
.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (Build.VERSION.SDK_INT >= 31)
|
if (Build.VERSION.SDK_INT >= 31)
|
||||||
Log.d(TAG, "Toggling speakerphone when dev/mode is " +
|
Log.d(TAG, "Toggling speakerphone when dev/mode is " +
|
||||||
@ -770,7 +753,14 @@ class MainActivity : ComponentActivity() {
|
|||||||
R.drawable.speaker_on
|
R.drawable.speaker_on
|
||||||
else
|
else
|
||||||
R.drawable.speaker_off
|
R.drawable.speaker_off
|
||||||
}
|
},
|
||||||
|
onLongClick = {
|
||||||
|
alertTitle.value = "Speakerphone"
|
||||||
|
alertMessage.value = "If activated, audio is player via speakerphone."
|
||||||
|
showAlert.value = true
|
||||||
|
},
|
||||||
|
),
|
||||||
|
onClick = {}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = ImageVector.vectorResource(speakerIcon),
|
imageVector = ImageVector.vectorResource(speakerIcon),
|
||||||
|
|||||||
Submodule libbaresip-android updated: 3826d8b637...735e7e03c0
Reference in New Issue
Block a user