mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Use dynamic/rule-based size calculations for transfer control view.
This commit is contained in:
committed by
Greyson Parrelli
parent
e945efac8b
commit
d7c2e6844b
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user