Use dynamic/rule-based size calculations for transfer control view.

This commit is contained in:
Cody Henthorne
2025-01-17 13:29:26 -05:00
committed by Greyson Parrelli
parent e945efac8b
commit d7c2e6844b
3 changed files with 37 additions and 27 deletions

View File

@@ -99,6 +99,18 @@ class ByteSize(val bytes: Long) {
return bytes.compareTo(other.bytes)
}
operator fun plus(other: ByteSize): ByteSize {
return ByteSize(this.inWholeBytes + other.inWholeBytes)
}
fun percentageOf(other: ByteSize): Float {
return this.inWholeBytes.toFloat() / other.inWholeBytes.toFloat()
}
operator fun minus(other: ByteSize): ByteSize {
return ByteSize(this.inWholeBytes - other.inWholeBytes)
}
enum class Size(val label: String) {
BYTE("B"),
KIBIBYTE("KB"),