Skip to content

Commit

Permalink
feat: Update Progress UI
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Nov 18, 2024
1 parent 1eca1fc commit baeb298
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ private fun UploadProgressScreen(
) {
AdHeader(adScreenType)

Spacer(modifier = Modifier.height(Margin.Medium))
Text(stringResource(R.string.uploadProgressIndication))
Spacer(Modifier.height(Margin.Medium))

Text(text = stringResource(R.string.uploadProgressIndication), style = SwissTransferTheme.typography.h2)

Spacer(Modifier.height(Margin.Mini))

Progress(progressState, totalSizeInBytes)
Spacer(modifier = Modifier.height(Margin.Huge))

Spacer(Modifier.height(Margin.Huge))
}

if (showBottomSheet.get()) CancelUploadBottomSheet(onCancel = onCancel, closeButtonSheet = { showBottomSheet.set(false) })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.HumanReadableSizeUtils
import com.infomaniak.swisstransfer.workers.UploadWorker
import java.util.Locale
Expand All @@ -34,10 +35,23 @@ fun Progress(
totalSizeInBytes: Long,
) {
Row {

Percentage({ progressState().uploadedSize }, totalSizeInBytes)
Text(" - ")
UploadedSize({ progressState().uploadedSize })
Text(" / ")

Text(
text = " - ",
color = SwissTransferTheme.colors.secondaryTextColor,
style = SwissTransferTheme.typography.labelRegular,
)

UploadedSize { progressState().uploadedSize }

Text(
text = " / ",
color = SwissTransferTheme.colors.secondaryTextColor,
style = SwissTransferTheme.typography.labelRegular,
)

TotalSize(totalSizeInBytes)
}
}
Expand All @@ -51,7 +65,11 @@ private fun Percentage(uploadedSizeInBytes: () -> Long, totalSizeInBytes: Long)
}
}

Text("$percentageNoDecimals%")
Text(
text = "$percentageNoDecimals%",
color = SwissTransferTheme.colors.secondaryTextColor,
style = SwissTransferTheme.typography.labelRegular,
)
}

@Composable
Expand All @@ -61,7 +79,11 @@ private fun UploadedSize(uploadedSizeInBytes: () -> Long) {
derivedStateOf { HumanReadableSizeUtils.getHumanReadableSize(context, uploadedSizeInBytes()) }
}

Text(humanReadableSize)
Text(
text = humanReadableSize,
color = SwissTransferTheme.colors.secondaryTextColor,
style = SwissTransferTheme.typography.labelRegular,
)
}

@Composable
Expand All @@ -71,5 +93,9 @@ private fun TotalSize(totalSizeInBytes: Long) {
derivedStateOf { HumanReadableSizeUtils.getHumanReadableSize(context, totalSizeInBytes) }
}

Text(humanReadableTotalSize)
Text(
text = humanReadableTotalSize,
color = SwissTransferTheme.colors.secondaryTextColor,
style = SwissTransferTheme.typography.labelRegular,
)
}

0 comments on commit baeb298

Please sign in to comment.