Skip to content

Commit

Permalink
Minor UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksey-saenko committed Sep 24, 2024
1 parent 829f28c commit 6e83a1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions compose_compiler_config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ java.time.LocalDateTime
java.time.LocalTime
java.time.ZonedDateTime
kotlin.time.Duration

android.net.Uri
java.io.File
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,14 @@ internal fun RecognitionScreen(
.padding(8.dp)
)
}
Box(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
contentAlignment = Alignment.Center
) {
Box {
AnimatedVisibility(
visible = recognizeStatus.isNotDone(),
enter = enterTransitionButton,
exit = exitTransitionButton,
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
) {
RecognitionButtonWithTitle(
title = getButtonTitle(recognizeStatus, autostart),
Expand Down Expand Up @@ -296,16 +294,22 @@ internal fun RecognitionScreen(

// optional vibration effect
if (preferences.vibrateOnResult()) {
val vibrated = rememberSaveable { mutableStateOf(false) }
LaunchedEffect(recognizeStatus) {
val status = recognizeStatus
if (status !is RecognitionStatus.Done) return@LaunchedEffect
if (status !is RecognitionStatus.Done) {
vibrated.value = false
return@LaunchedEffect
}
if (vibrated.value) return@LaunchedEffect
when (status.result) {
is RecognitionResult.ScheduledOffline,
is RecognitionResult.Success -> viewModel.vibrateResult(true)

is RecognitionResult.Error,
is RecognitionResult.NoMatches -> viewModel.vibrateResult(false)
}
vibrated.value = true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal fun AnimatedVisibilityScope.BaseShield(
onDismissClick: () -> Unit,
content: @Composable ColumnScope.() -> Unit
) {
Surface {
Surface(modifier = modifier) {
Box {
FilledTonalIconButton(
onClick = onDismissClick,
Expand Down Expand Up @@ -68,7 +68,7 @@ internal fun AnimatedVisibilityScope.BaseShield(
)
}
Column(
modifier = modifier
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(24.dp)
Expand Down

0 comments on commit 6e83a1c

Please sign in to comment.