android: split the server screen's buttons out of the form (#8316)
release / go (push) Successful in 1m56s
release / web (push) Successful in 1m11s
release / integration (push) Successful in 2m42s
release / govulncheck (push) Successful in 19s
release / android (push) Failing after 2m6s
release / Build signed APK (push) Successful in 2m7s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / go (push) Successful in 1m56s
release / web (push) Successful in 1m11s
release / integration (push) Successful in 2m42s
release / govulncheck (push) Successful in 19s
release / android (push) Failing after 2m6s
release / Build signed APK (push) Successful in 2m7s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
The form ran past detekt's 60-line limit for one function once it gained the probe's progress and Cancel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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