fix new warnings, regenerate lint-baseline.xml (#4684)
Mostly "StringFormatTrivial" which I think is new, but it makes totally sense to fix
This commit is contained in:
parent
a98154101b
commit
c887c8213c
24 changed files with 68 additions and 124 deletions
|
|
@ -3,6 +3,7 @@
|
|||
package com.keylesspalace.tusky.util
|
||||
|
||||
import java.text.NumberFormat
|
||||
import java.util.Locale
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.ln
|
||||
import kotlin.math.pow
|
||||
|
|
@ -24,5 +25,10 @@ fun formatNumber(num: Long, min: Int = 100000): String {
|
|||
val exp = (ln(absNum.toDouble()) / ln_1k).toInt()
|
||||
|
||||
// Suffixes here are locale-agnostic
|
||||
return String.format("%.1f%c", num / 1000.0.pow(exp.toDouble()), "KMGTPE"[exp - 1])
|
||||
return String.format(
|
||||
Locale.getDefault(),
|
||||
"%.1f%c",
|
||||
num / 1000.0.pow(exp.toDouble()),
|
||||
"KMGTPE"[exp - 1]
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ class StatusViewHelper(private val itemView: View) {
|
|||
var labelText = getLabelTypeText(context, attachments[0].type)
|
||||
if (sensitive) {
|
||||
val sensitiveText = context.getString(R.string.post_sensitive_media_title)
|
||||
labelText += String.format(" (%s)", sensitiveText)
|
||||
labelText += " ($sensitiveText)"
|
||||
}
|
||||
mediaLabel.text = labelText
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue