Skip to content

Commit

Permalink
Improved preview
Browse files Browse the repository at this point in the history
  • Loading branch information
nbradbury committed Aug 7, 2024
1 parent bca0784 commit 8537ceb
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ fun FeedbackFormScreen(
}
SubmitButton(
isEnabled = message.isNotEmpty(),
progressDialogState = progressDialogState?.value,
onClick = {
onSubmitClick(context)
}
)
progressDialogState?.value?.let {
ProgressDialog(it)
}
}
Screen(
content = content,
Expand Down Expand Up @@ -120,7 +122,6 @@ private fun MessageSection(
private fun SubmitButton(
onClick: () -> Unit,
isEnabled: Boolean,
progressDialogState: ProgressDialogState? = null,
) {
Box(
contentAlignment = Alignment.Center,
Expand All @@ -131,9 +132,6 @@ private fun SubmitButton(
horizontal = H_PADDING.dp
),
) {
if (progressDialogState != null) {
ProgressDialog(progressDialogState)
}
Button(
enabled = isEnabled,
onClick = onClick,
Expand Down Expand Up @@ -273,21 +271,30 @@ private fun Screen(
)
@Composable
private fun FeedbackFormScreenPreview() {
val attachment = FeedbackFormAttachment(
val attachment1 = FeedbackFormAttachment(
uri = Uri.parse("https://via.placeholder.com/150"),
attachmentType = FeedbackFormAttachmentType.IMAGE,
size = 123456789,
displayName = "attachment.jpg (1.2 MB)",
mimeType = "image/jpeg",
tempFile = File("/tmp/attachment.jpg")
)
val attachments = MutableStateFlow(listOf(attachment))
val attachment2 = FeedbackFormAttachment(
uri = Uri.parse("https://via.placeholder.com/150"),
attachmentType = FeedbackFormAttachmentType.VIDEO,
size = 123456789,
displayName = "attachment.mp4 (12.4 MB)",
mimeType = "video/mp4",
tempFile = File("/tmp/attachment.mp4")
)
val attachments = MutableStateFlow(listOf(attachment1, attachment2))
val messageText = MutableStateFlow("I love this app!")
val progressDialogState = MutableStateFlow<ProgressDialogState?>(
ProgressDialogState(
message = R.string.uploading,
showCancel = false,
progress = 50f / 100f,
dismissible = false,
)
)

Expand Down

0 comments on commit 8537ceb

Please sign in to comment.