Display attachment download progress in MB.

This commit is contained in:
Nicholas Tinsley
2024-01-05 15:34:12 -05:00
parent 940bf0603e
commit c2fd08ca80
2 changed files with 6 additions and 5 deletions

View File

@@ -657,9 +657,9 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
return if (isCompressing(currentState)) { return if (isCompressing(currentState)) {
return context.getString(R.string.TransferControlView__processing) return context.getString(R.string.TransferControlView__processing)
} else { } else {
val progressText = Formatter.formatShortFileSize(context, currentState.networkProgress.sumCompleted()) val progressMiB = currentState.networkProgress.sumCompleted() / MEBIBYTE
val totalText = Formatter.formatShortFileSize(context, currentState.networkProgress.sumTotal()) val totalMiB = currentState.networkProgress.sumTotal() / MEBIBYTE
context.resources.getString(R.string.TransferControlView__download_progress, progressText, totalText) context.resources.getString(R.string.TransferControlView__download_progress, progressMiB, totalMiB)
} }
} }
@@ -679,6 +679,7 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
private const val SECONDARY_TEXT_OFFSET_DP = 3 private const val SECONDARY_TEXT_OFFSET_DP = 3
private const val RETRY_SECONDARY_TEXT_OFFSET_DP = 6 private const val RETRY_SECONDARY_TEXT_OFFSET_DP = 6
private const val PRIMARY_TEXT_OFFSET_DP = 4 private const val PRIMARY_TEXT_OFFSET_DP = 4
private const val MEBIBYTE = 1048576f
/** /**
* A weighting compared to [UPLOAD_TASK_WEIGHT] * A weighting compared to [UPLOAD_TASK_WEIGHT]

View File

@@ -2421,8 +2421,8 @@
</plurals> </plurals>
<!-- Status update label used while the device is transcoding video as a prerequisite to uploading --> <!-- Status update label used while the device is transcoding video as a prerequisite to uploading -->
<string name="TransferControlView__processing">Processing…</string> <string name="TransferControlView__processing">Processing…</string>
<!-- Status update label used while the device is transmitting data over the network. Will take the form of "123 KB/2.0 MB" --> <!-- Status update label used while the device is transmitting data over the network. Will take the form of "1.0 MB/2.0 MB" -->
<string name="TransferControlView__download_progress">%1$s/%2$s</string> <string name="TransferControlView__download_progress">%1.1f MB/%2.1f MB</string>
<!-- UnauthorizedReminder --> <!-- UnauthorizedReminder -->