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:
Konrad Pozniak 2024-09-16 20:57:27 +02:00 committed by GitHub
commit c887c8213c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 68 additions and 124 deletions

View file

@ -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]
)
}

View file

@ -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