Skip to content

Commit

Permalink
add audio exists indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
tanzimfh committed Aug 8, 2024
1 parent f963d93 commit e42e6c1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Person
import androidx.compose.material.icons.rounded.Call
import androidx.compose.material.icons.rounded.Done
Expand Down Expand Up @@ -111,17 +112,17 @@ fun AudioScreen(
if (isRecording) {
audioData = audioRecorder.stopRecording()
isRecording = false
} else {
} else if (audioData == null) {
audioRecorder.startRecording()
isRecording = true
}
} else audioData = null
},
modifier = Modifier
.padding(all = 4.dp)
.align(Alignment.CenterVertically),
) {
Icon(
imageVector = if (isRecording) Icons.Rounded.Done else Icons.Rounded.Call,
imageVector = if (isRecording) Icons.Rounded.Done else if (audioData == null) Icons.Rounded.Call else Icons.Outlined.Delete,
contentDescription = stringResource(if (isRecording) R.string.stop_recording else R.string.start_recording),
)
}
Expand All @@ -142,7 +143,11 @@ fun AudioScreen(
.padding(all = 4.dp)
.align(Alignment.CenterVertically),
) {
Text(stringResource(R.string.action_go))
Text(
stringResource(R.string.action_go),
color = if (audioData == null) MaterialTheme.colorScheme.secondary
else MaterialTheme.colorScheme.primary
)
}
}
LazyRow(
Expand Down

0 comments on commit e42e6c1

Please sign in to comment.