current stand

This commit is contained in:
Myzel394 2023-12-04 16:23:59 +01:00
parent 8a3bfcae4d
commit 60f53f3649
No known key found for this signature in database
GPG Key ID: 50098FCA22080F0F
4 changed files with 20 additions and 10 deletions

View File

@ -20,6 +20,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.CameraAlt import androidx.compose.material.icons.filled.CameraAlt
import androidx.compose.material.icons.filled.Mic import androidx.compose.material.icons.filled.Mic
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -65,8 +66,11 @@ fun VideoRecorderPreparationSheet(
onPreviewVisible: () -> Unit, onPreviewVisible: () -> Unit,
onPreviewHidden: () -> Unit, onPreviewHidden: () -> Unit,
showPreview: Boolean, showPreview: Boolean,
onStartRecording: () -> Unit,
) { ) {
val sheetState = rememberModalBottomSheetState(true) val sheetState = rememberModalBottomSheetState(true) { sheetValue ->
false
}
val context = LocalContext.current val context = LocalContext.current
val cameras = CameraInfo.queryAvailableCameras(context) val cameras = CameraInfo.queryAvailableCameras(context)
@ -78,9 +82,12 @@ fun VideoRecorderPreparationSheet(
ModalBottomSheet( ModalBottomSheet(
onDismissRequest = onDismiss, onDismissRequest = onDismiss,
sheetState = sheetState, sheetState = sheetState,
dragHandle = if (showPreview) { dragHandle = {
null if (showPreview)
} else null, Unit
else
BottomSheetDefaults.DragHandle()
}
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
@ -176,7 +183,7 @@ fun VideoRecorderPreparationSheet(
detectTapGestures( detectTapGestures(
onLongPress = { onLongPress = {
onPreviewVisible() onPreviewVisible()
} },
) )
}, },
horizontalArrangement = Arrangement.Center, horizontalArrangement = Arrangement.Center,

View File

@ -54,6 +54,9 @@ fun VideoRecordingStart(
onPreviewVisible = onHideAudioRecording, onPreviewVisible = onHideAudioRecording,
onPreviewHidden = onShowAudioRecording, onPreviewHidden = onShowAudioRecording,
showPreview = showPreview, showPreview = showPreview,
onStartRecording = {
videoRecorder.startRecording(context, appSettings)
},
) )
} }

View File

@ -82,7 +82,7 @@ fun RecorderScreen(
} }
} }
var isProcessingAudio by remember { mutableStateOf(false) } var isProcessing by remember { mutableStateOf(false) }
var showRecorderError by remember { mutableStateOf(false) } var showRecorderError by remember { mutableStateOf(false) }
fun saveAsLastRecording() { fun saveAsLastRecording() {
@ -122,7 +122,7 @@ fun RecorderScreen(
fun saveRecording() { fun saveRecording() {
scope.launch { scope.launch {
isProcessingAudio = true isProcessing = true
// Give the user some time to see the processing dialog // Give the user some time to see the processing dialog
delay(100) delay(100)
@ -166,7 +166,7 @@ fun RecorderScreen(
} catch (error: Exception) { } catch (error: Exception) {
Log.getStackTraceString(error) Log.getStackTraceString(error)
} finally { } finally {
isProcessingAudio = false isProcessing = false
} }
} }
} }
@ -190,7 +190,7 @@ fun RecorderScreen(
} }
} }
if (isProcessingAudio) if (isProcessing)
AlertDialog( AlertDialog(
onDismissRequest = { }, onDismissRequest = { },
icon = { icon = {

View File

@ -28,7 +28,7 @@
<string name="ui_audioRecorder_action_save_label">Save Recording</string> <string name="ui_audioRecorder_action_save_label">Save Recording</string>
<string name="ui_audioRecorder_action_start_description">Alibi will continue recording in the background and store the last <xliff:g name="durationInMinutes">%s</xliff:g> minutes at your request</string> <string name="ui_audioRecorder_action_start_description">Alibi will continue recording in the background and store the last <xliff:g name="durationInMinutes">%s</xliff:g> minutes at your request</string>
<string name="ui_audioRecorder_action_save_processing_dialog_title">Processing</string> <string name="ui_audioRecorder_action_save_processing_dialog_title">Processing</string>
<string name="ui_audioRecorder_action_save_processing_dialog_description">Processing Audio, do not close Alibi! You will be automatically prompted to save the file once it\'s ready</string> <string name="ui_audioRecorder_action_save_processing_dialog_description">Processing your recording, do not close Alibi! You will automatically be prompted to save the file once it\'s ready</string>
<string name="ui_audioRecorder_state_recording_title">Recording Audio</string> <string name="ui_audioRecorder_state_recording_title">Recording Audio</string>
<string name="ui_audioRecorder_state_recording_description">Alibi keeps recording in the background</string> <string name="ui_audioRecorder_state_recording_description">Alibi keeps recording in the background</string>