Make File path property optional
This commit is contained in:
parent
330b9f673a
commit
cdf824ac2e
@ -136,13 +136,15 @@ fun FileItem(
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(
|
||||
R.string.file_meta_path,
|
||||
file.path
|
||||
),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
if (file.path != null) {
|
||||
Text(
|
||||
text = stringResource(
|
||||
R.string.file_meta_path,
|
||||
file.path!!
|
||||
),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
}
|
||||
if (!file.isDirectory) {
|
||||
Text(
|
||||
text = stringResource(
|
||||
|
||||
@ -10,7 +10,7 @@ import kotlinx.collections.immutable.ImmutableMap
|
||||
import java.util.Locale
|
||||
|
||||
interface File : SavableSearchable {
|
||||
val path: String
|
||||
val path: String?
|
||||
val mimeType: String
|
||||
val size: Long
|
||||
val isDirectory: Boolean
|
||||
|
||||
@ -26,7 +26,7 @@ import kotlinx.coroutines.withContext
|
||||
|
||||
data class PluginFile(
|
||||
val id: String,
|
||||
override val path: String,
|
||||
override val path: String?,
|
||||
override val mimeType: String,
|
||||
override val size: Long,
|
||||
override val metaData: ImmutableMap<FileMetaType, String>,
|
||||
|
||||
@ -46,7 +46,7 @@ class PluginFileProvider(
|
||||
results.add(
|
||||
PluginFile(
|
||||
id = cursor[FileColumns.Id] ?: continue,
|
||||
path = cursor[FileColumns.Path] ?: "",
|
||||
path = cursor[FileColumns.Path],
|
||||
mimeType = cursor[FileColumns.MimeType] ?: "application/octet-stream",
|
||||
size = cursor[FileColumns.Size] ?: 0L,
|
||||
metaData = buildMap {
|
||||
|
||||
@ -76,7 +76,7 @@ data class File(
|
||||
* A path to this file. This is shown to the user purely for informational purposes.
|
||||
* It is not used to open the file.
|
||||
*/
|
||||
val path: String,
|
||||
val path: String?,
|
||||
/**
|
||||
* Whether this file is a directory. If set, a folder icon will be shown instead of a file icon.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user