Refactor duplicate chapter number formatters

This commit is contained in:
arkon
2023-07-23 18:09:08 -04:00
parent 7aa172c512
commit 2556e9f08c
6 changed files with 28 additions and 36 deletions

View File

@@ -21,12 +21,11 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.manga.components.MangaCover
import eu.kanade.presentation.util.formatChapterNumber
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.lang.toTimestampString
import tachiyomi.domain.history.model.HistoryWithRelations
import tachiyomi.presentation.core.components.material.padding
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
private val HISTORY_ITEM_HEIGHT = 96.dp
@@ -68,7 +67,7 @@ fun HistoryItem(
text = if (history.chapterNumber > -1) {
stringResource(
R.string.recent_manga_time,
chapterFormatter.format(history.chapterNumber),
formatChapterNumber(history.chapterNumber),
readAt,
)
} else {
@@ -88,8 +87,3 @@ fun HistoryItem(
}
}
}
private val chapterFormatter = DecimalFormat(
"#.###",
DecimalFormatSymbols().apply { decimalSeparator = '.' },
)