Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fun Int.formatInt(context: Context): String {
(NumberFormat.getNumberInstance(arabicLocale) as DecimalFormat).apply {
minimumFractionDigits = 0
maximumFractionDigits = 0
isGroupingUsed = false
decimalFormatSymbols = DecimalFormatSymbols(arabicLocale).apply {
zeroDigit = DecimalStyle.of(arabicLocale).zeroDigit
}
Expand All @@ -76,6 +77,7 @@ fun Int.formatInt(context: Context): String {
NumberFormat.getNumberInstance(appLocale).apply {
minimumFractionDigits = 0
maximumFractionDigits = 0
isGroupingUsed = false
}
}
formatter.format(this)
Expand All @@ -84,6 +86,22 @@ fun Int.formatInt(context: Context): String {
}
}

fun String.formatSeasonNumber(context: Context): String {
return try {
val regex = """\d+""".toRegex()
val match = regex.find(this)
if (match != null) {
val number = match.value.toInt()
val formattedNumber = number.formatInt(context)
this.replace(match.value, formattedNumber)
} else {
this
}
} catch (e: Exception) {
this
}
}

fun LocalDate.formatDate(context: Context): String {
return try {
val appLocale = context.resources.configuration.locales[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.moscow.cineverse.designSystem.theme.Theme
import com.moscow.cineverse.image_viewer.component.SafeImageViewer
import com.moscow.cineverse.mapper.formatInt
import com.moscow.cineverse.mapper.formatRating
import com.moscow.cineverse.mapper.formatSeasonNumber
import com.moscow.cinverse.presentation.R
import kotlinx.datetime.LocalDate

Expand Down Expand Up @@ -96,7 +97,7 @@ fun SeasonCard(
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
MovieText(
text = seasonNumber,
text = seasonNumber.formatSeasonNumber(LocalContext.current),
style = Theme.textStyle.body.medium.medium,
color = Theme.colors.shade.primary
)
Expand All @@ -122,7 +123,6 @@ fun SeasonCard(
verticalAlignment = Alignment.CenterVertically
) {
if (rate != 0f) {
val movie = null
SeasonInfo(
icon = R.drawable.due_tone_star,
iconTint = Theme.colors.additional.primary.yellow,
Expand Down
Loading