Skip to content

Commit

Permalink
avoid multiple line formats or titles breaking the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanLobbenmeier committed Jan 10, 2025
1 parent ea7a98b commit fee64f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.em
import compose.icons.FeatherIcons
import compose.icons.feathericons.Download
import compose.icons.feathericons.XCircle
Expand Down Expand Up @@ -55,7 +55,12 @@ fun DownloadItemTopView(downloadItem: DownloadItem, removeItem: (DownloadItem) -
Modifier.weight(1f).padding(20.dp, 15.dp).fillMaxHeight(),
verticalArrangement = Arrangement.SpaceBetween,
) {
Text(metadata?.title ?: downloadItem.url, fontSize = 1.1.em)
Text(
metadata?.title ?: downloadItem.url,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
fontWeight = FontWeight.Bold,
)

FormatSelectorOrDownloadProgress(downloadItem, metadata)
InformationRow(metadata, downloadItem)
Expand Down Expand Up @@ -124,12 +129,15 @@ private fun DownloadInformation(downloadProgress: VideoDownloadProgress) {
Text(fileSizeString(speed) + "/s")
}
}

is DownloadStarted -> {
Text("Starting Download...")
}

is DownloadCompleted -> {
Text("Completed Download.")
}

is DownloadFailed -> {
Text("Failed to download: " + downloadProgress.e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fun <T> DropdownMenu(
readOnly = onTextInput == null,
value = value,
label = label?.let { { Text(text = it) } },
singleLine = true,
onValueChange = onTextInput ?: {},
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
)
Expand Down

0 comments on commit fee64f6

Please sign in to comment.