Accurate remaining download size for partially downloaded galleries.

This commit is contained in:
Nicholas Tinsley 2023-12-21 15:25:10 -05:00 committed by Clark Chen
parent fa0661f58a
commit f6d8dcf6fd
2 changed files with 3 additions and 3 deletions

View file

@ -239,7 +239,7 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
val remainingSlides = currentState.slides.filterNot { it.transferState == AttachmentTable.TRANSFER_PROGRESS_DONE }
val downloadCount = remainingSlides.size
binding.primaryDetailsText.text = context.resources.getQuantityString(R.plurals.TransferControlView_n_items, downloadCount, downloadCount)
val byteCount = remainingSlides.sumOf { it.asAttachment().size }
val byteCount = currentState.networkProgress.sumTotal() - currentState.networkProgress.sumCompleted()
binding.secondaryDetailsText.text = Formatter.formatShortFileSize(context, byteCount)
}
@ -264,7 +264,7 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
} else {
ViewUtil.dpToPx(SECONDARY_TEXT_OFFSET_DP).toFloat()
}
val byteCount = currentState.slides.sumOf { it.asAttachment().size }
val byteCount = currentState.networkProgress.sumTotal() - currentState.networkProgress.sumCompleted()
binding.secondaryDetailsText.text = Formatter.formatShortFileSize(context, byteCount)
}

View file

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