Show per-node loading spinner during speed test
This commit is contained in:
@@ -7,6 +7,7 @@ import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -26,6 +27,7 @@ fun NodeRow(
|
||||
node: Node,
|
||||
isActive: Boolean,
|
||||
delay: Int?,
|
||||
isTesting: Boolean = false,
|
||||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
@@ -67,8 +69,14 @@ fun NodeRow(
|
||||
)
|
||||
}
|
||||
|
||||
// Delay
|
||||
if (delay != null) {
|
||||
// Delay or loading
|
||||
if (isTesting) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.size(16.dp),
|
||||
strokeWidth = 2.dp,
|
||||
color = TextTertiary
|
||||
)
|
||||
} else if (delay != null) {
|
||||
val (text, color) = when {
|
||||
delay <= 0 -> stringResource(R.string.timeout) to Red
|
||||
delay < 300 -> "${delay}ms" to Green
|
||||
|
||||
@@ -271,6 +271,7 @@ fun NodesScreen(modifier: Modifier = Modifier) {
|
||||
node = node,
|
||||
isActive = node.active,
|
||||
delay = delays[NodeTester.nodeTag(node)],
|
||||
isTesting = isTesting,
|
||||
onClick = { selectNode(node.id) },
|
||||
onLongClick = { showNodeSheet = node }
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user