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