Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

fix: extract remaining hardcoded UI strings to resources, remove silent exception swallowing

Davidona0a234d021604
diff --git a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt b/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
index d17d2d44..6ddb4d89 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
@@ -217,13 +217,13 @@ fun ChannelCard(
verticalAlignment = Alignment.CenterVertically
) {
if (channel.isFavorite) {
- StatusBadge(label = "FAV", containerColor = AccentAmber, contentColor = Color.Black)
+ StatusBadge(label = stringResource(R.string.badge_fav), containerColor = AccentAmber, contentColor = Color.Black)
}
if (channel.errorCount > 0) {
- StatusBadge(label = "ERR", containerColor = AccentRed)
+ StatusBadge(label = stringResource(R.string.badge_error), containerColor = AccentRed)
}
if (channel.catchUpSupported) {
- StatusBadge(label = "CATCH UP", containerColor = Primary)
+ StatusBadge(label = stringResource(R.string.badge_catch_up), containerColor = Primary)
}
StatusBadge(
label = stringResource(R.string.card_live_badge),
@@ -234,7 +234,7 @@ fun ChannelCard(
if (isLocked) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
- StatusBadge(label = "LOCKED", containerColor = SurfaceHighlight)
+ StatusBadge(label = stringResource(R.string.home_locked_short), containerColor = SurfaceHighlight)
}
}
}
@@ -273,7 +273,7 @@ fun MovieCard(
contentAlignment = Alignment.Center
) {
StatusBadge(
- label = if (isLocked) "LOCKED" else "MOVIE",
+ label = if (isLocked) stringResource(R.string.home_locked_short) else stringResource(R.string.badge_movie),
containerColor = SurfaceHighlight
)
}
@@ -301,7 +301,7 @@ fun MovieCard(
.padding(horizontal = 6.dp, vertical = 2.dp)
) {
Text(
- text = "RTG ${String.format("%.1f", movie.rating)}",
+ text = stringResource(R.string.label_rating, String.format("%.1f", movie.rating)),
style = MaterialTheme.typography.labelSmall,
color = AccentAmber
)
@@ -310,7 +310,7 @@ fun MovieCard(
if (movie.isFavorite) {
Box(modifier = Modifier.align(Alignment.TopEnd).padding(8.dp)) {
- StatusBadge(label = "FAV", containerColor = AccentRed)
+ StatusBadge(label = stringResource(R.string.badge_fav), containerColor = AccentRed)
}
}
}
@@ -351,7 +351,7 @@ fun SeriesCard(
contentAlignment = Alignment.Center
) {
StatusBadge(
- label = if (isLocked) "LOCKED" else "SERIES",
+ label = if (isLocked) stringResource(R.string.home_locked_short) else stringResource(R.string.badge_series),
containerColor = SurfaceHighlight
)
}
@@ -379,7 +379,7 @@ fun SeriesCard(
.padding(horizontal = 6.dp, vertical = 2.dp)
) {
Text(
- text = "RTG ${String.format("%.1f", series.rating)}",
+ text = stringResource(R.string.label_rating, String.format("%.1f", series.rating)),
style = MaterialTheme.typography.labelSmall,
color = AccentAmber
)
@@ -388,7 +388,7 @@ fun SeriesCard(
if (series.isFavorite) {
Box(modifier = Modifier.align(Alignment.TopEnd).padding(8.dp)) {
- StatusBadge(label = "FAV", containerColor = AccentRed)
+ StatusBadge(label = stringResource(R.string.badge_fav), containerColor = AccentRed)
}
}
}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt
index e2eef1b3..36b1184d 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt
@@ -111,12 +111,12 @@ fun LiveChannelRowCard(
horizontalArrangement = Arrangement.spacedBy(badgeSpacing),
verticalAlignment = Alignment.CenterVertically
) {
- StatusPill(label = "LIVE", containerColor = AppColors.Live)
+ StatusPill(label = stringResource(R.string.card_live_badge), containerColor = AppColors.Live)
if (channel.isFavorite) {
- StatusPill(label = "SAVED", containerColor = AppColors.Warning, contentColor = Color.Black)
+ StatusPill(label = stringResource(R.string.badge_saved), containerColor = AppColors.Warning, contentColor = Color.Black)
}
if (channel.catchUpSupported) {
- StatusPill(label = "CATCH UP", containerColor = AppColors.Brand)
+ StatusPill(label = stringResource(R.string.badge_catch_up), containerColor = AppColors.Brand)
}
}
}
@@ -223,7 +223,7 @@ fun LiveChannelRowSurface(
contentAlignment = Alignment.Center
) {
StatusPill(
- label = "LOCKED",
+ label = stringResource(R.string.home_locked_short),
containerColor = AppColors.SurfaceEmphasis,
contentColor = AppColors.TextPrimary
)
@@ -236,7 +236,7 @@ fun LiveChannelRowSurface(
.padding(12.dp)
) {
StatusPill(
- label = "MOVING",
+ label = stringResource(R.string.badge_moving),
containerColor = AppColors.Warning,
contentColor = Color.Black
)
@@ -293,7 +293,7 @@ fun EpisodeRowCard(episode: Episode, modifier: Modifier = Modifier) {
)
} else {
Text(
- text = "E${episode.episodeNumber}",
+ text = stringResource(R.string.label_episode, episode.episodeNumber),
style = MaterialTheme.typography.titleMedium,
color = AppColors.TextSecondary
)
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt
index 374453b3..2c7fa26b 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt
@@ -577,7 +577,7 @@ private fun DestinationRail(
color = AppColors.TextPrimary
)
Text(
- text = "TV",
+ text = stringResource(R.string.label_tv),
style = MaterialTheme.typography.labelSmall,
color = AppColors.TextTertiary
)
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt
index 2db0ce25..d0d2c068 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt
@@ -48,7 +48,7 @@ import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButton
fun VodSectionHeader(
title: String,
onSeeAll: (() -> Unit)? = null,
- seeAllLabel: String = "See all"
+ seeAllLabel: String = stringResource(R.string.action_see_all)
) {
Row(
modifier = Modifier
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt
index e66da455..719c6a33 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt
@@ -967,7 +967,7 @@ fun EpgOverlay(
)
Spacer(Modifier.width(12.dp))
Text(
- text = "${currentProgram.durationMinutes} min",
+ text = stringResource(R.string.label_duration_min, currentProgram.durationMinutes),
style = MaterialTheme.typography.bodySmall,
color = OnSurfaceDim
)
@@ -1088,7 +1088,7 @@ fun EpgOverlay(
)
Spacer(Modifier.width(8.dp))
Text(
- text = "${program.durationMinutes} min",
+ text = stringResource(R.string.label_duration_min, program.durationMinutes),
style = MaterialTheme.typography.bodySmall,
color = OnSurfaceDim
)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7a63445c..446f8441 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -764,4 +764,13 @@
<string name="label_rating">RTG %1$s</string>
<string name="label_episode">E%1$d</string>
<string name="label_duration_min">%1$d min</string>
+ <string name="label_tv">TV</string>
+ <string name="badge_saved">SAVED</string>
+ <string name="badge_catch_up">CATCH UP</string>
+ <string name="badge_moving">MOVING</string>
+ <string name="badge_fav">FAV</string>
+ <string name="badge_error">ERR</string>
+ <string name="badge_movie">MOVIE</string>
+ <string name="badge_series">SERIES</string>
+ <string name="action_see_all">See all</string>
</resources>
diff --git a/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.kt b/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.kt
index b97149f0..52f4f254 100644
--- a/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.kt
+++ b/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.kt
@@ -16,33 +16,29 @@ class GetCustomCategories @Inject constructor(
favoriteRepository.getGlobalFavoriteCount(contentType),
favoriteRepository.getGroupFavoriteCounts(contentType)
) { groups, globalCount, groupCounts ->
- runCatching {
- val categories = groups.map { group ->
- Category(
- id = -group.id, // Negative IDs reserve virtual groups.
- name = group.name,
- type = contentType,
- isVirtual = true,
- count = groupCounts.getOrDefault(group.id, 0)
- )
- }.toMutableList()
+ val categories = groups.map { group ->
+ Category(
+ id = -group.id, // Negative IDs reserve virtual groups.
+ name = group.name,
+ type = contentType,
+ isVirtual = true,
+ count = groupCounts.getOrDefault(group.id, 0)
+ )
+ }.toMutableList()
- // Prepend global "Favorites" virtual category.
- categories.add(
- index = 0,
- element = Category(
- id = VirtualCategoryIds.FAVORITES,
- name = "Favorites",
- type = contentType,
- isVirtual = true,
- count = globalCount
- )
+ // Prepend global "Favorites" virtual category.
+ categories.add(
+ index = 0,
+ element = Category(
+ id = VirtualCategoryIds.FAVORITES,
+ name = "Favorites",
+ type = contentType,
+ isVirtual = true,
+ count = globalCount
)
+ )
- categories
- }.getOrElse {
- emptyList()
- }
+ categories
}
}
}