From 7ef0083a71a938cb7629b36ef5968a3c78fb9c0f Mon Sep 17 00:00:00 2001
From: tapframe <85391825+tapframe@users.noreply.github.com>
Date: Sun, 26 Apr 2026 00:58:06 +0530
Subject: [PATCH] Update localization strings to use string formatting
---
.../composeResources/values-el/strings.xml | 6 +-
.../composeResources/values-es/strings.xml | 4 +-
.../composeResources/values-it/strings.xml | 4 +-
.../composeResources/values-tr/strings.xml | 5 +-
.../composeResources/values/strings.xml | 4 +-
.../app/features/player/PlayerOverlays.kt | 160 ++++++++++--------
.../nuvio/app/features/player/PlayerScreen.kt | 11 +-
7 files changed, 113 insertions(+), 81 deletions(-)
diff --git a/composeApp/src/commonMain/composeResources/values-el/strings.xml b/composeApp/src/commonMain/composeResources/values-el/strings.xml
index 1e6107a5..a3afc52d 100644
--- a/composeApp/src/commonMain/composeResources/values-el/strings.xml
+++ b/composeApp/src/commonMain/composeResources/values-el/strings.xml
@@ -182,8 +182,8 @@
Στυλ
Υπότιτλοι
Υπότιτλοι
- Φωτεινότητα %1$d%%
- Ένταση ήχου %1$d%%
+ Φωτεινότητα %1$s
+ Ένταση ήχου %1$s
Σε σίγαση
Κατέβηκε
Προβάλλεται
@@ -1040,4 +1040,4 @@
KB
MB
GB
-
\ No newline at end of file
+
diff --git a/composeApp/src/commonMain/composeResources/values-es/strings.xml b/composeApp/src/commonMain/composeResources/values-es/strings.xml
index 725a89a0..514e6e3a 100644
--- a/composeApp/src/commonMain/composeResources/values-es/strings.xml
+++ b/composeApp/src/commonMain/composeResources/values-es/strings.xml
@@ -300,8 +300,8 @@
Estilo
Subs
Subtítulos
- Brillo %1$d%%
- Volumen %1$d%%
+ Brillo %1$s
+ Volumen %1$s
Silenciado
Descargado
Se emite
diff --git a/composeApp/src/commonMain/composeResources/values-it/strings.xml b/composeApp/src/commonMain/composeResources/values-it/strings.xml
index 5229f4d8..a2284ea0 100644
--- a/composeApp/src/commonMain/composeResources/values-it/strings.xml
+++ b/composeApp/src/commonMain/composeResources/values-it/strings.xml
@@ -182,8 +182,8 @@
Stile
Sub
Sottotitoli
- Luminosità %1$d%%
- Volume %1$d%%
+ Luminosità %1$s
+ Volume %1$s
Muto
Scaricato
In onda
diff --git a/composeApp/src/commonMain/composeResources/values-tr/strings.xml b/composeApp/src/commonMain/composeResources/values-tr/strings.xml
index c49515aa..9684bfc6 100644
--- a/composeApp/src/commonMain/composeResources/values-tr/strings.xml
+++ b/composeApp/src/commonMain/composeResources/values-tr/strings.xml
@@ -182,8 +182,8 @@
Stil
Altyazı
Altyazılar
- Parlaklık %1$d%%
- Ses %1$d%%
+ Parlaklık %1$s
+ Ses %1$s
Sessizde
İndirildi
Yayınlanma
@@ -1041,4 +1041,3 @@
MB
GB
-
diff --git a/composeApp/src/commonMain/composeResources/values/strings.xml b/composeApp/src/commonMain/composeResources/values/strings.xml
index 7ddc8923..2afb0532 100644
--- a/composeApp/src/commonMain/composeResources/values/strings.xml
+++ b/composeApp/src/commonMain/composeResources/values/strings.xml
@@ -300,8 +300,8 @@
Style
Subs
Subtitles
- Brightness %1$d%%
- Volume %1$d%%
+ Brightness %1$s
+ Volume %1$s
Muted
Downloaded
Airs
diff --git a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerOverlays.kt b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerOverlays.kt
index a9644baa..6a3a8a30 100644
--- a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerOverlays.kt
+++ b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerOverlays.kt
@@ -12,6 +12,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
@@ -288,7 +289,7 @@ internal fun PauseMetadataOverlay(
horizontalSafePadding: Dp,
modifier: Modifier = Modifier,
) {
- Column(
+ BoxWithConstraints(
modifier = modifier
.background(
Brush.horizontalGradient(
@@ -298,80 +299,107 @@ internal fun PauseMetadataOverlay(
Color.Transparent,
),
),
- )
- .padding(
- start = horizontalSafePadding + metrics.horizontalPadding,
- end = horizontalSafePadding + metrics.horizontalPadding,
- top = 40.dp,
- bottom = 120.dp,
),
- verticalArrangement = Arrangement.Bottom,
) {
- Text(
- text = stringResource(Res.string.compose_player_youre_watching),
- style = MaterialTheme.nuvioTypeScale.bodyLg,
- color = Color(0xFFB8B8B8),
- )
- androidx.compose.foundation.layout.Spacer(modifier = Modifier.height(12.dp))
-
- if (!logo.isNullOrBlank()) {
- AsyncImage(
- model = logo,
- contentDescription = title,
- contentScale = ContentScale.Fit,
- alignment = Alignment.BottomStart,
- modifier = Modifier.height(96.dp),
- )
+ val compactHeight = maxHeight < 420.dp
+ val veryCompactHeight = maxHeight < 340.dp
+ val topPadding = if (compactHeight) 24.dp else 40.dp
+ val bottomPadding = when {
+ veryCompactHeight -> 24.dp
+ compactHeight -> 40.dp
+ else -> 120.dp
+ }
+ val logoHeight = when {
+ veryCompactHeight -> 48.dp
+ compactHeight -> 64.dp
+ else -> 96.dp
+ }
+ val titleFontScale = if (compactHeight) 1.35f else 1.8f
+ val descriptionStyle = if (compactHeight) {
+ MaterialTheme.nuvioTypeScale.bodyMd.copy(lineHeight = 20.sp)
} else {
- Text(
- text = title,
- style = MaterialTheme.nuvioTypeScale.displayMd.copy(
- fontSize = max(metrics.titleSize.value * 1.8f, 32f).sp,
- fontWeight = FontWeight.ExtraBold,
+ MaterialTheme.nuvioTypeScale.bodyLg.copy(lineHeight = 24.sp)
+ }
+ val descriptionMaxLines = if (compactHeight) 2 else 3
+ val descriptionWidthFraction = if (compactHeight) 0.82f else 0.62f
+
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(
+ start = horizontalSafePadding + metrics.horizontalPadding,
+ end = horizontalSafePadding + metrics.horizontalPadding,
+ top = topPadding,
+ bottom = bottomPadding,
),
- color = Color.White,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis,
- )
- }
-
- val episodeInfo = if (isEpisode && seasonNumber != null && episodeNumber != null) {
- stringResource(Res.string.compose_player_episode_code_full, seasonNumber, episodeNumber)
- } else {
- providerName
- }
-
- Text(
- text = episodeInfo,
- style = MaterialTheme.nuvioTypeScale.bodyLg,
- color = Color(0xFFCCCCCC),
- modifier = Modifier.padding(top = 8.dp),
- )
-
- if (!episodeTitle.isNullOrBlank()) {
+ verticalArrangement = Arrangement.Bottom,
+ ) {
Text(
- text = episodeTitle,
- style = MaterialTheme.nuvioTypeScale.titleLg,
- color = Color.White,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier.padding(top = 12.dp),
+ text = stringResource(Res.string.compose_player_youre_watching),
+ style = MaterialTheme.nuvioTypeScale.bodyLg,
+ color = Color(0xFFB8B8B8),
)
- }
+ androidx.compose.foundation.layout.Spacer(modifier = Modifier.height(if (compactHeight) 8.dp else 12.dp))
+
+ if (!logo.isNullOrBlank()) {
+ AsyncImage(
+ model = logo,
+ contentDescription = title,
+ contentScale = ContentScale.Fit,
+ alignment = Alignment.BottomStart,
+ modifier = Modifier.height(logoHeight),
+ )
+ } else {
+ Text(
+ text = title,
+ style = MaterialTheme.nuvioTypeScale.displayMd.copy(
+ fontSize = max(metrics.titleSize.value * titleFontScale, 32f).sp,
+ fontWeight = FontWeight.ExtraBold,
+ ),
+ color = Color.White,
+ maxLines = if (compactHeight) 1 else 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+
+ val episodeInfo = if (isEpisode && seasonNumber != null && episodeNumber != null) {
+ stringResource(Res.string.compose_player_episode_code_full, seasonNumber, episodeNumber)
+ } else {
+ providerName
+ }
- if (!pauseDescription.isNullOrBlank()) {
Text(
- text = pauseDescription,
- style = MaterialTheme.nuvioTypeScale.bodyLg.copy(lineHeight = 24.sp),
- color = Color(0xFFD6D6D6),
- softWrap = true,
- textAlign = TextAlign.Start,
- maxLines = 3,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier
- .padding(top = 16.dp)
- .fillMaxWidth(0.62f),
+ text = episodeInfo,
+ style = MaterialTheme.nuvioTypeScale.bodyLg,
+ color = Color(0xFFCCCCCC),
+ modifier = Modifier.padding(top = if (compactHeight) 6.dp else 8.dp),
)
+
+ if (!episodeTitle.isNullOrBlank()) {
+ Text(
+ text = episodeTitle,
+ style = MaterialTheme.nuvioTypeScale.titleLg,
+ color = Color.White,
+ maxLines = if (compactHeight) 1 else 2,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(top = if (compactHeight) 8.dp else 12.dp),
+ )
+ }
+
+ if (!pauseDescription.isNullOrBlank()) {
+ Text(
+ text = pauseDescription,
+ style = descriptionStyle,
+ color = Color(0xFFD6D6D6),
+ softWrap = true,
+ textAlign = TextAlign.Start,
+ maxLines = descriptionMaxLines,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier
+ .padding(top = if (compactHeight) 10.dp else 16.dp)
+ .fillMaxWidth(descriptionWidthFraction),
+ )
+ }
}
}
}
diff --git a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerScreen.kt b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerScreen.kt
index 6363109d..e862fc29 100644
--- a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerScreen.kt
+++ b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/PlayerScreen.kt
@@ -1,6 +1,7 @@
package com.nuvio.app.features.player
import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.background
@@ -586,7 +587,7 @@ fun PlayerScreen(
showGestureFeedback(
GestureFeedbackState(
messageRes = Res.string.compose_player_brightness_level,
- messageArgs = listOf(percentage),
+ messageArgs = listOf("$percentage%"),
icon = GestureFeedbackIcon.Brightness,
),
)
@@ -601,7 +602,7 @@ fun PlayerScreen(
} else {
Res.string.compose_player_volume_level
},
- messageArgs = if (level.isMuted) emptyList() else listOf(percentage),
+ messageArgs = if (level.isMuted) emptyList() else listOf("$percentage%"),
icon = if (level.isMuted) GestureFeedbackIcon.VolumeMuted else GestureFeedbackIcon.Volume,
isDanger = level.isMuted,
),
@@ -1539,7 +1540,11 @@ fun PlayerScreen(
},
)
- if (pausedOverlayVisible && !controlsVisible && !playerControlsLocked) {
+ AnimatedVisibility(
+ visible = pausedOverlayVisible && !controlsVisible && !playerControlsLocked,
+ enter = fadeIn(animationSpec = tween(durationMillis = 220)),
+ exit = fadeOut(animationSpec = tween(durationMillis = 180)),
+ ) {
PauseMetadataOverlay(
title = title,
logo = logo,