Fix for #1025 - change new line into dot to display whole information from addons

Also added translation for this screen
This commit is contained in:
skoruppa 2026-03-25 10:53:30 +01:00
parent 9eb5bb5c60
commit c0c19ecf10
4 changed files with 68 additions and 25 deletions

View file

@ -2,6 +2,7 @@ package com.nuvio.tv.ui.screens.player
import android.util.Log
import androidx.media3.common.Player
import com.nuvio.tv.R
import com.nuvio.tv.data.local.SubtitleStyleSettings
import com.nuvio.tv.data.repository.TraktScrobbleItem
import com.nuvio.tv.data.repository.extractYear
@ -874,8 +875,8 @@ internal fun PlayerRuntimeController.buildStreamInfoData(): StreamInfoData {
subtitleCodec = selectedSubtitle?.codec,
subtitleLanguage = selectedSubtitle?.language ?: addonSub?.lang,
subtitleSource = when {
addonSub != null -> "Addon"
selectedSubtitle != null -> "Embedded"
addonSub != null -> context.getString(R.string.stream_info_subtitle_source_addon)
selectedSubtitle != null -> context.getString(R.string.stream_info_subtitle_source_embedded)
else -> null
}
)

View file

@ -17,6 +17,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@ -24,6 +25,7 @@ import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.nuvio.tv.R
import com.nuvio.tv.ui.theme.NuvioColors
import com.nuvio.tv.ui.util.languageCodeToName
@ -57,7 +59,7 @@ private fun StreamInfoContent(data: StreamInfoData) {
// SOURCE section
val hasSourceInfo = data.addonName != null || data.streamName != null
if (hasSourceInfo) {
SectionLabel("SOURCE")
SectionLabel(stringResource(R.string.stream_info_section_source))
Spacer(modifier = Modifier.height(4.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
if (!data.addonLogo.isNullOrBlank()) {
@ -87,7 +89,7 @@ private fun StreamInfoContent(data: StreamInfoData) {
}
if (data.streamName != null && data.streamName != data.addonName) {
Text(
text = data.streamName,
text = data.streamName.replace("\n", " · "),
style = MaterialTheme.typography.bodyLarge,
color = NuvioColors.TextSecondary,
maxLines = 1,
@ -98,7 +100,7 @@ private fun StreamInfoContent(data: StreamInfoData) {
}
if (!data.streamDescription.isNullOrBlank()) {
Text(
text = data.streamDescription,
text = data.streamDescription.replace("\n", " · "),
style = MaterialTheme.typography.bodyMedium,
color = NuvioColors.TextSecondary,
maxLines = 1,
@ -112,11 +114,11 @@ private fun StreamInfoContent(data: StreamInfoData) {
// FILE section
val hasFileInfo = data.filename != null || data.fileSize != null
if (hasFileInfo) {
SectionLabel("FILE")
SectionLabel(stringResource(R.string.stream_info_section_file))
Spacer(modifier = Modifier.height(4.dp))
Row(horizontalArrangement = Arrangement.spacedBy(36.dp)) {
InfoItem(label = "Filename", value = data.filename)
InfoItem(label = "Size", value = data.fileSize?.let { formatFileSize(it) })
InfoItem(label = stringResource(R.string.stream_info_filename), value = data.filename, modifier = Modifier.weight(1f))
InfoItem(label = stringResource(R.string.stream_info_size), value = data.fileSize?.let { formatFileSize(it) })
}
Spacer(modifier = Modifier.height(16.dp))
}
@ -124,22 +126,22 @@ private fun StreamInfoContent(data: StreamInfoData) {
// VIDEO section
val hasVideoInfo = data.videoCodec != null || data.videoWidth != null || data.videoFrameRate != null || data.videoBitrate != null
if (hasVideoInfo) {
SectionLabel("VIDEO")
SectionLabel(stringResource(R.string.stream_info_section_video))
Spacer(modifier = Modifier.height(4.dp))
Row(horizontalArrangement = Arrangement.spacedBy(36.dp)) {
InfoItem(label = "Codec", value = data.videoCodec)
InfoItem(label = stringResource(R.string.stream_info_codec), value = data.videoCodec)
InfoItem(
label = "Resolution",
label = stringResource(R.string.stream_info_resolution),
value = if (data.videoWidth != null && data.videoHeight != null) {
formatResolution(data.videoWidth, data.videoHeight)
} else null
)
InfoItem(
label = "Frame Rate",
label = stringResource(R.string.stream_info_frame_rate),
value = data.videoFrameRate?.let { "%.3f fps".format(it) }
)
InfoItem(
label = "Bitrate",
label = stringResource(R.string.stream_info_bitrate),
value = data.videoBitrate?.let { formatBitrate(it) }
)
}
@ -149,17 +151,17 @@ private fun StreamInfoContent(data: StreamInfoData) {
// AUDIO section
val hasAudioInfo = data.audioCodec != null || data.audioChannels != null || data.audioLanguage != null || data.audioSampleRate != null
if (hasAudioInfo) {
SectionLabel("AUDIO")
SectionLabel(stringResource(R.string.stream_info_section_audio))
Spacer(modifier = Modifier.height(4.dp))
Row(horizontalArrangement = Arrangement.spacedBy(36.dp)) {
InfoItem(label = "Codec", value = data.audioCodec)
InfoItem(label = "Channels", value = data.audioChannels)
InfoItem(label = stringResource(R.string.stream_info_codec), value = data.audioCodec)
InfoItem(label = stringResource(R.string.stream_info_channels), value = data.audioChannels)
InfoItem(
label = "Sample Rate",
label = stringResource(R.string.stream_info_sample_rate),
value = data.audioSampleRate?.let { "${it / 1000} kHz" }
)
InfoItem(
label = "Language",
label = stringResource(R.string.stream_info_language),
value = data.audioLanguage?.let { languageCodeToName(it) }
)
}
@ -169,16 +171,16 @@ private fun StreamInfoContent(data: StreamInfoData) {
// SUBTITLE section
val hasSubtitleInfo = data.subtitleName != null || data.subtitleCodec != null || data.subtitleLanguage != null
if (hasSubtitleInfo) {
SectionLabel("SUBTITLE")
SectionLabel(stringResource(R.string.stream_info_section_subtitle))
Spacer(modifier = Modifier.height(4.dp))
Row(horizontalArrangement = Arrangement.spacedBy(36.dp)) {
InfoItem(label = "Name", value = data.subtitleName)
InfoItem(label = "Codec", value = data.subtitleCodec)
InfoItem(label = stringResource(R.string.stream_info_name), value = data.subtitleName)
InfoItem(label = stringResource(R.string.stream_info_codec), value = data.subtitleCodec)
InfoItem(
label = "Language",
label = stringResource(R.string.stream_info_language),
value = data.subtitleLanguage?.let { languageCodeToName(it) }
)
InfoItem(label = "Source", value = data.subtitleSource)
InfoItem(label = stringResource(R.string.stream_info_source), value = data.subtitleSource)
}
}
}
@ -194,9 +196,9 @@ private fun SectionLabel(text: String) {
}
@Composable
private fun InfoItem(label: String, value: String?) {
private fun InfoItem(label: String, value: String?, modifier: Modifier = Modifier) {
if (value == null) return
Column {
Column(modifier = modifier) {
Text(
text = label,
style = MaterialTheme.typography.bodySmall,

View file

@ -639,6 +639,26 @@
<string name="player_more_aspect_ratio">Proporcje obrazu</string>
<string name="player_more_open_external">Otwórz w zewnętrznym odtwarzaczu</string>
<!-- StreamInfoOverlay -->
<string name="stream_info_section_source">ŹRÓDŁO</string>
<string name="stream_info_section_file">PLIK</string>
<string name="stream_info_section_video">WIDEO</string>
<string name="stream_info_section_audio">AUDIO</string>
<string name="stream_info_section_subtitle">NAPISY</string>
<string name="stream_info_filename">Nazwa pliku</string>
<string name="stream_info_size">Rozmiar</string>
<string name="stream_info_codec">Kodek</string>
<string name="stream_info_resolution">Rozdzielczość</string>
<string name="stream_info_frame_rate">Klatki/s</string>
<string name="stream_info_bitrate">Bitrate</string>
<string name="stream_info_channels">Kanały</string>
<string name="stream_info_sample_rate">Próbkowanie</string>
<string name="stream_info_language">Język</string>
<string name="stream_info_name">Nazwa</string>
<string name="stream_info_source">Źródło</string>
<string name="stream_info_subtitle_source_addon">Dodatek</string>
<string name="stream_info_subtitle_source_embedded">Wbudowane</string>
<!-- StreamSourcesSidePanel -->
<string name="sources_title">Źródła</string>
<string name="sources_reload">Odśwież</string>

View file

@ -807,6 +807,26 @@
<string name="player_more_aspect_ratio">Aspect Ratio</string>
<string name="player_more_open_external">Open in External Player</string>
<!-- StreamInfoOverlay -->
<string name="stream_info_section_source">SOURCE</string>
<string name="stream_info_section_file">FILE</string>
<string name="stream_info_section_video">VIDEO</string>
<string name="stream_info_section_audio">AUDIO</string>
<string name="stream_info_section_subtitle">SUBTITLE</string>
<string name="stream_info_filename">Filename</string>
<string name="stream_info_size">Size</string>
<string name="stream_info_codec">Codec</string>
<string name="stream_info_resolution">Resolution</string>
<string name="stream_info_frame_rate">Frame Rate</string>
<string name="stream_info_bitrate">Bitrate</string>
<string name="stream_info_channels">Channels</string>
<string name="stream_info_sample_rate">Sample Rate</string>
<string name="stream_info_language">Language</string>
<string name="stream_info_name">Name</string>
<string name="stream_info_source">Source</string>
<string name="stream_info_subtitle_source_addon">Addon</string>
<string name="stream_info_subtitle_source_embedded">Embedded</string>
<!-- StreamSourcesSidePanel -->
<string name="sources_title">Sources</string>
<string name="sources_reload">Reload</string>