Skip to content

Commit

Permalink
fix: Progress value validation in ListItemDirectory()
Browse files Browse the repository at this point in the history
Change-Id: I638228e30cd09efe1d86296f4e9c5ff2846c1361
  • Loading branch information
XayahSuSuSu committed Oct 5, 2023
1 parent 4ef836c commit ba321c9
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ fun ListItemDirectory(
val haptic = LocalHapticFeedback.current
val selected = entity.selected
val enabled = entity.enabled
val progress = entity.availableBytes.toFloat() / entity.totalBytes
val path = entity.path
var expanded by remember { mutableStateOf(false) }

Expand Down Expand Up @@ -397,7 +398,7 @@ fun ListItemDirectory(
.weight(1f),
color = if (enabled) ColorScheme.primary() else ColorScheme.primary().copy(alpha = CommonTokens.DisabledAlpha),
trackColor = if (enabled) ColorScheme.inverseOnSurface() else ColorScheme.inverseOnSurface().copy(alpha = CommonTokens.DisabledAlpha),
progress = entity.availableBytes.toFloat() / entity.totalBytes
progress = if (progress.isNaN()) 0f else progress
)
Box(modifier = Modifier.wrapContentSize(Alignment.Center)) {
val actions = remember(entity) {
Expand Down

0 comments on commit ba321c9

Please sign in to comment.