The first public release of Fabled Minstrel #158
@@ -189,12 +189,29 @@ private fun ServerUrlForm(
|
|||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
ProbeButtons(
|
||||||
|
probing = state.probing,
|
||||||
|
canSubmit = state.url.isNotBlank(),
|
||||||
|
onSubmit = onSubmit,
|
||||||
|
onCancel = onCancel,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Continue, which shows progress while the address is probed, and Cancel beside it. */
|
||||||
|
@Composable
|
||||||
|
private fun ProbeButtons(
|
||||||
|
probing: Boolean,
|
||||||
|
canSubmit: Boolean,
|
||||||
|
onSubmit: () -> Unit,
|
||||||
|
onCancel: () -> Unit,
|
||||||
|
) {
|
||||||
Button(
|
Button(
|
||||||
onClick = onSubmit,
|
onClick = onSubmit,
|
||||||
enabled = !state.probing && state.url.isNotBlank(),
|
enabled = !probing && canSubmit,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
if (state.probing) {
|
if (probing) {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
color = MaterialTheme.colorScheme.onPrimary,
|
color = MaterialTheme.colorScheme.onPrimary,
|
||||||
@@ -204,8 +221,7 @@ private fun ServerUrlForm(
|
|||||||
Text("Continue")
|
Text("Continue")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state.probing) {
|
if (probing) {
|
||||||
TextButton(onClick = onCancel) { Text("Cancel") }
|
TextButton(onClick = onCancel) { Text("Cancel") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user