Some code style edits
This commit is contained in:
@ -135,10 +135,8 @@ private fun CallDetailsScreen(navController: NavController, callRow: CallRow) {
|
||||
detailsState,
|
||||
onDelete = { detail ->
|
||||
detailsState.remove(detail)
|
||||
// If the list becomes empty, you might want to pop back
|
||||
if (detailsState.isEmpty()) {
|
||||
if (detailsState.isEmpty())
|
||||
navController.popBackStack()
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
@ -168,7 +166,8 @@ private fun CallDetailsContent(
|
||||
@Composable
|
||||
private fun Peer(ctx: Context, callRow: CallRow) {
|
||||
val account = Account.ofAor(callRow.aor)!!
|
||||
val headerText = stringResource(R.string.peer) + " " + Utils.friendlyUri(ctx, callRow.peerUri, account)
|
||||
val headerText = stringResource(R.string.peer) + " " +
|
||||
Utils.friendlyUri(ctx, callRow.peerUri, account)
|
||||
Text(
|
||||
text = headerText,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
@ -363,9 +362,8 @@ private fun Duration(ctx: Context, detail: Details, durationText: String) {
|
||||
showDialog = showPlaybackDialog,
|
||||
mediaPlayer = mediaPlayer,
|
||||
onStop = {
|
||||
if (mediaPlayer.isPlaying) {
|
||||
if (mediaPlayer.isPlaying)
|
||||
mediaPlayer.stop()
|
||||
}
|
||||
mediaPlayer.reset()
|
||||
showPlaybackDialog.value = false
|
||||
}
|
||||
@ -433,9 +431,8 @@ private fun Duration(ctx: Context, detail: Details, durationText: String) {
|
||||
Log.d(TAG, "Using already merged file: ${mergedFile.name}")
|
||||
finalFile = mergedFile
|
||||
} else {
|
||||
if (Utils.mergeWavFiles(fileIn, fileOut, mergedFile)) {
|
||||
if (Utils.mergeWavFiles(fileIn, fileOut, mergedFile))
|
||||
finalFile = mergedFile
|
||||
}
|
||||
}
|
||||
|
||||
// If merge successful, update state and delete originals
|
||||
|
||||
@ -100,9 +100,8 @@ class CallHistoryNew(val aor: String, val peerUri: String, val direction: String
|
||||
}
|
||||
|
||||
fun clearRecordings() {
|
||||
for (h in BaresipService.callHistory) {
|
||||
for (h in BaresipService.callHistory)
|
||||
h.recording = arrayOf("", "")
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNUSED")
|
||||
|
||||
@ -45,6 +45,7 @@ import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
@ -92,7 +93,7 @@ private fun CallsScreen(navController: NavController, viewModel: ViewModel, aor:
|
||||
val callHistory: MutableState<List<CallRow>> = remember { mutableStateOf(emptyList()) }
|
||||
var isHistoryLoaded by remember { mutableStateOf(false) }
|
||||
|
||||
var refreshTrigger by remember { mutableStateOf(0) }
|
||||
var refreshTrigger by remember { mutableIntStateOf(0) }
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
|
||||
LaunchedEffect(aor, refreshTrigger) {
|
||||
@ -102,9 +103,8 @@ private fun CallsScreen(navController: NavController, viewModel: ViewModel, aor:
|
||||
|
||||
DisposableEffect(lifecycleOwner) {
|
||||
val observer = LifecycleEventObserver { _, event ->
|
||||
if (event == Lifecycle.Event.ON_RESUME) {
|
||||
if (event == Lifecycle.Event.ON_RESUME)
|
||||
refreshTrigger++
|
||||
}
|
||||
}
|
||||
lifecycleOwner.lifecycle.addObserver(observer)
|
||||
onDispose {
|
||||
|
||||
@ -1269,9 +1269,8 @@ object Utils {
|
||||
|
||||
fun createEmptyFile(path: String): File {
|
||||
val file = File(path)
|
||||
if (file.exists()) {
|
||||
if (file.exists())
|
||||
file.delete()
|
||||
}
|
||||
file.createNewFile()
|
||||
return file
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user