Replaced main screen topappbar icons with boxes
This commit is contained in:
@@ -52,6 +52,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
@@ -113,6 +114,7 @@ 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
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.draw.shadow
|
import androidx.compose.ui.draw.shadow
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
import androidx.compose.ui.focus.focusRequester
|
import androidx.compose.ui.focus.focusRequester
|
||||||
@@ -554,10 +556,12 @@ private fun TopAppBar(
|
|||||||
actions = {
|
actions = {
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
Icon(
|
|
||||||
imageVector = recImage,
|
Box(
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(40.dp)
|
.size(48.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (Call.call("connected") == null) {
|
if (Call.call("connected") == null) {
|
||||||
@@ -565,35 +569,39 @@ private fun TopAppBar(
|
|||||||
recImage = if (BaresipService.isRecOn) {
|
recImage = if (BaresipService.isRecOn) {
|
||||||
Api.module_load("sndfile")
|
Api.module_load("sndfile")
|
||||||
recOnImage
|
recOnImage
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Api.module_unload("sndfile")
|
Api.module_unload("sndfile")
|
||||||
recOffImage
|
recOffImage
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT)
|
|
||||||
.show()
|
|
||||||
},
|
},
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
alertTitle.value = ctx.getString(R.string.call_recording_title)
|
alertTitle.value = ctx.getString(R.string.call_recording_title)
|
||||||
alertMessage.value = ctx.getString(R.string.call_recording_tip)
|
alertMessage.value = ctx.getString(R.string.call_recording_tip)
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
tint = if (BaresipService.isRecOn)
|
) {
|
||||||
MaterialTheme.colorScheme.error
|
Icon(
|
||||||
else
|
imageVector = recImage,
|
||||||
MaterialTheme.colorScheme.onPrimary,
|
contentDescription = null,
|
||||||
contentDescription = null
|
tint = if (BaresipService.isRecOn)
|
||||||
)
|
MaterialTheme.colorScheme.error
|
||||||
|
else
|
||||||
|
MaterialTheme.colorScheme.onPrimary,
|
||||||
|
modifier = Modifier.size(40.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(22.dp))
|
Spacer(modifier = Modifier.width(22.dp))
|
||||||
|
|
||||||
Icon(
|
Box(
|
||||||
imageVector = currentMicIcon,
|
contentAlignment = Alignment.Center,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(40.dp)
|
.size(48.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (Call.call("connected") != null) {
|
if (Call.call("connected") != null) {
|
||||||
@@ -601,8 +609,7 @@ private fun TopAppBar(
|
|||||||
if (BaresipService.isMicMuted) {
|
if (BaresipService.isMicMuted) {
|
||||||
viewModel.updateMicIcon(Icons.Filled.MicOff)
|
viewModel.updateMicIcon(Icons.Filled.MicOff)
|
||||||
Api.calls_mute(true)
|
Api.calls_mute(true)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
viewModel.updateMicIcon(Icons.Filled.Mic)
|
viewModel.updateMicIcon(Icons.Filled.Mic)
|
||||||
Api.calls_mute(false)
|
Api.calls_mute(false)
|
||||||
}
|
}
|
||||||
@@ -612,21 +619,27 @@ private fun TopAppBar(
|
|||||||
alertTitle.value = ctx.getString(R.string.microphone_title)
|
alertTitle.value = ctx.getString(R.string.microphone_title)
|
||||||
alertMessage.value = ctx.getString(R.string.microphone_tip)
|
alertMessage.value = ctx.getString(R.string.microphone_tip)
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
tint = if (BaresipService.isMicMuted)
|
) {
|
||||||
MaterialTheme.colorScheme.error
|
Icon(
|
||||||
else
|
imageVector = currentMicIcon,
|
||||||
MaterialTheme.colorScheme.onPrimary,
|
contentDescription = null,
|
||||||
contentDescription = null
|
tint = if (BaresipService.isMicMuted)
|
||||||
)
|
MaterialTheme.colorScheme.error
|
||||||
|
else
|
||||||
|
MaterialTheme.colorScheme.onPrimary,
|
||||||
|
modifier = Modifier.size(40.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(16.dp))
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
|
|
||||||
Icon(
|
Box(
|
||||||
imageVector = Icons.Filled.SpeakerPhone,
|
contentAlignment = Alignment.Center,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(40.dp)
|
.size(48.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (Build.VERSION.SDK_INT >= 31)
|
if (Build.VERSION.SDK_INT >= 31)
|
||||||
@@ -640,14 +653,19 @@ private fun TopAppBar(
|
|||||||
alertTitle.value = ctx.getString(R.string.speakerphone_title)
|
alertTitle.value = ctx.getString(R.string.speakerphone_title)
|
||||||
alertMessage.value = ctx.getString(R.string.speakerphone_tip)
|
alertMessage.value = ctx.getString(R.string.speakerphone_tip)
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
tint = if (isSpeakerOn.value)
|
) {
|
||||||
MaterialTheme.colorScheme.error
|
Icon(
|
||||||
else
|
imageVector = Icons.Filled.SpeakerPhone,
|
||||||
MaterialTheme.colorScheme.onPrimary,
|
contentDescription = null,
|
||||||
contentDescription = null
|
tint = if (isSpeakerOn.value)
|
||||||
)
|
MaterialTheme.colorScheme.error
|
||||||
|
else
|
||||||
|
MaterialTheme.colorScheme.onPrimary,
|
||||||
|
modifier = Modifier.size(40.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { menuExpanded = !menuExpanded }
|
onClick = { menuExpanded = !menuExpanded }
|
||||||
|
|||||||
Reference in New Issue
Block a user