Skip to content

Commit 9c5f890

Browse files
authored
android: fix progress bar gap (#726)
androidx.compose.material3 1.3.0 added a gap between the active and inactive track and a stop indicator at the end. Here, we add a negative gap to compensate for the rounded cap occupying extra space past the end of the progress, and use an empty function to hide the indicator. Fixes tailscale/corp#35495 Signed-off-by: kari-ts <kari@tailscale.com>
1 parent d0442f7 commit 9c5f890

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

android/src/main/java/com/tailscale/ipn/ui/view/SharedViews.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,15 @@ fun SimpleActivityIndicator(size: Int = 32) {
126126

127127
@Composable
128128
fun ActivityIndicator(progress: Double, size: Int = 32) {
129+
// LinearProgressIndicator defaults to a 4.dp height in Material3.
130+
val height = 4.dp
131+
129132
LinearProgressIndicator(
130-
progress = progress.toFloat(),
133+
progress = {progress.toFloat()},
131134
modifier = Modifier.width(size.dp),
132135
color = ts_color_light_blue,
133136
trackColor = MaterialTheme.colorScheme.secondary,
137+
gapSize = -height,
138+
drawStopIndicator = {}
134139
)
135140
}

0 commit comments

Comments
 (0)