mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
Merge pull request #1677 from Bnyro/master
Fix for the formatShort crash
This commit is contained in:
commit
88bce6e11d
@ -3,15 +3,17 @@ package com.github.libretube.extensions
|
|||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.math.RoundingMode
|
import java.math.RoundingMode
|
||||||
|
|
||||||
|
@Suppress("KotlinConstantConditions")
|
||||||
fun Long?.formatShort(): String = when {
|
fun Long?.formatShort(): String = when {
|
||||||
this!! < 1000 -> {
|
this == null -> (0).toString()
|
||||||
|
this < 1000 -> {
|
||||||
this.toString()
|
this.toString()
|
||||||
}
|
}
|
||||||
this in 1000..999999 -> {
|
this in (1000..999999) -> {
|
||||||
val decimal = BigDecimal(this / 1000).setScale(0, RoundingMode.HALF_EVEN)
|
val decimal = BigDecimal(this / 1000).setScale(0, RoundingMode.HALF_EVEN)
|
||||||
decimal.toString() + "K"
|
decimal.toString() + "K"
|
||||||
}
|
}
|
||||||
this in 1000000..10000000 -> {
|
this in (1000000..10000000) -> {
|
||||||
val decimal = BigDecimal(this / 1000000).setScale(0, RoundingMode.HALF_EVEN)
|
val decimal = BigDecimal(this / 1000000).setScale(0, RoundingMode.HALF_EVEN)
|
||||||
decimal.toString() + "M"
|
decimal.toString() + "M"
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@
|
|||||||
<string name="contributing">Contributing</string>
|
<string name="contributing">Contributing</string>
|
||||||
<string name="donate">Donate</string>
|
<string name="donate">Donate</string>
|
||||||
<string name="update">Look for new version</string>
|
<string name="update">Look for new version</string>
|
||||||
<string name="update_summary">Click to find out if the app is up to date.</string>
|
<string name="update_summary">Check for update</string>
|
||||||
<string name="app_uptodate">Running the latest version.</string>
|
<string name="app_uptodate">Running the latest version.</string>
|
||||||
<string name="no_update_available">You are running the latest version.</string>
|
<string name="no_update_available">You are running the latest version.</string>
|
||||||
<string name="playback_speed">Playback speed</string>
|
<string name="playback_speed">Playback speed</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user