File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ fun FileInfo(uriData: UriData) {
201201 )
202202 FileInfoLine (
203203 label = stringResource(R .string.file_type),
204- content = uriData.mimeType ? : " */*"
204+ content = uriData.mimeType ? : " */*"
205205 )
206206 FileInfoLine (
207207 label = stringResource(R .string.file_size),
@@ -222,10 +222,14 @@ fun FileInfoLine(label: String, content: String) {
222222@Composable
223223fun FilePreview (uriData : UriData ) {
224224 val mimeType = uriData.mimeType
225- val fallbackFileIcon = if (mimeType?.startsWith(" image/" ) ? : false ) Icons .Outlined .Image
226- else if (mimeType?.startsWith(" audio/" ) ? : false ) Icons .Outlined .AudioFile
227- else if (mimeType?.startsWith(" video/" ) ? : false ) Icons .Outlined .VideoFile
228- else Icons .Outlined .Description
225+ val primaryType = mimeType?.substringBefore(' /' )
226+
227+ val fallbackFileIcon = when (primaryType) {
228+ " image" -> Icons .Outlined .Image
229+ " audio" -> Icons .Outlined .AudioFile
230+ " video" -> Icons .Outlined .VideoFile
231+ else -> Icons .Outlined .Description
232+ }
229233
230234 Box (
231235 modifier = Modifier
You can’t perform that action at this time.
0 commit comments