Skip to content

Commit

Permalink
chore: Hide folder size
Browse files Browse the repository at this point in the history
  • Loading branch information
tevincent committed Nov 25, 2024
1 parent aad1334 commit 24f2766
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,22 @@ fun FileItem(
onClick: () -> Unit,
onRemove: (() -> Unit)? = null,
) {
val description = if (file.isFolder) {
""
} else {
HumanReadableSizeUtils.getHumanReadableSize(
LocalContext.current,
file.fileSize
)
}
FileItemContent(
onClick = onClick,
isCheckboxVisible = isCheckboxVisible,
isChecked = isChecked,
isRemoveButtonVisible = isRemoveButtonVisible,
onRemove = onRemove,
title = file.fileName,
description = HumanReadableSizeUtils.getHumanReadableSize(LocalContext.current, file.fileSize),
description = description,
content = {
FilePreview(
file = file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fun FileItemList(
onClick = {
if (isCheckboxVisible()) {
setUidCheckStatus(file.uid, !isUidChecked(file.uid))
} else if (file.isFolder == true) {
} else if (file.isFolder) {
onClick?.invoke(file.uid)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ val filesPreviewData = listOf(
// Non-preview file (i.e. pdf, txt, etc.)
fileName = "How to not get fired.pdf",
uid = "How to not get fired.pdf",
isFolder = false,
fileSize = 10_302_130L,
mimeType = null,
localPath = "",
Expand All @@ -38,34 +39,39 @@ val filesPreviewData = listOf(
// Preview file (i.e. png, jpg, etc.)
fileName = "Opening images tutorial.png",
uid = "Opening images tutorial.png",
isFolder = false,
fileSize = 456_782L,
mimeType = null,
localPath = "https://picsum.photos/200/300",
),
FileUi(
fileName = "The 5 step guide to turning it off and on again.docx",
uid = "The 5 step guide to turning it off and on again.docx",
isFolder = false,
fileSize = 89_723_143L,
mimeType = null,
localPath = "",
),
FileUi(
uid = UUID.randomUUID().toString(),
fileName = "Learning to Copy and Paste: A Complete Guide.docx",
isFolder = false,
fileSize = 237_866_728L,
mimeType = null,
localPath = null,
),
FileUi(
uid = UUID.randomUUID().toString(),
fileName = "Introduction to Turning It Off and On Again.pptx",
isFolder = false,
fileSize = 98_723_143L,
mimeType = null,
localPath = null,
),
FileUi(
uid = UUID.randomUUID().toString(),
fileName = "The 5-Step Guide to Not Breaking Your Code.txt",
isFolder = false,
fileSize = 57_689_032L,
mimeType = null,
localPath = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class ImportationFilesManager @Inject constructor(
FileUi(
uid = fileToImport.fileName,
fileName = fileToImport.fileName,
isFolder = false,
fileSize = fileToImport.fileSizeInBytes,
mimeType = null,
localPath = copiedFile.toUri().toString(),
Expand Down Expand Up @@ -131,6 +132,7 @@ class ImportationFilesManager @Inject constructor(
FileUi(
uid = localFile.name,
fileName = localFile.name,
isFolder = false,
fileSize = fileSizeInBytes,
mimeType = null,
localPath = localFile.toUri().toString(),
Expand Down

0 comments on commit 24f2766

Please sign in to comment.