From 56216de51b25cb6519d576945ac6aad973297ee8 Mon Sep 17 00:00:00 2001 From: Kagura Date: Fri, 11 Oct 2024 21:14:25 +0800 Subject: [PATCH] fix: do not hide extension if is hidden file --- .../myapplication/compose/ui/FileColumn.kt | 18 +++++++++--------- .../byTypeFileLister/DocumentLister.kt | 2 +- .../fileSystem/byTypeFileLister/VideoLister.kt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt b/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt index 3d5de4a..73d0c26 100644 --- a/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt +++ b/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt @@ -93,7 +93,7 @@ class FileColumn(val context: Context) { isOkay = false fileList.clear() val wfList = cwd.listFiles()?.map { WrappedFile(it) } - if (wfList!=null) { + if (wfList != null) { if (sortByTime) { fileList.addAll(wfList.sortedBy { it.lastModifiedTime }) } else { @@ -170,7 +170,6 @@ class FileColumn(val context: Context) { ) } - } if (!isOkay) { Column( @@ -529,19 +528,20 @@ class FileColumn(val context: Context) { .fillMaxWidth(0.8f) ) { Text( - text = forceName ?: if (settingStorage.get(settingStorage.showExtension) == false || file.type == Type.DIRECTORY){ - file.nameWithoutExt - }else{ - file.name - }, + text = forceName + ?: if (settingStorage.get(settingStorage.showExtension) == false && !file.name.startsWith('.')) { + file.nameWithoutExt + } else { + file.name + }, fontSize = 24.sp, maxLines = 1, overflow = TextOverflow.Ellipsis ) Text( - text = forceParent ?: if (file.type == Type.FILE){ + text = forceParent ?: if (file.type == Type.FILE) { "${file.getModifiedTimeString(context)} ${file.getSizeString()}" - }else{ + } else { file.getModifiedTimeString(context) }, fontSize = 15.sp, diff --git a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/DocumentLister.kt b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/DocumentLister.kt index c451cf2..02189ec 100644 --- a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/DocumentLister.kt +++ b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/DocumentLister.kt @@ -14,7 +14,7 @@ class DocumentLister : Lister { val regex = "\\.((xls|doc|ppt)(x|)|txt|htm(l|)|pdf)".toRegex() } - val documentList = mutableListOf() + private val documentList = mutableListOf() fun initialize(onFinished: (() -> Unit)? = null) { documentList.clear() diff --git a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/VideoLister.kt b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/VideoLister.kt index acb204a..24b0293 100644 --- a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/VideoLister.kt +++ b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/VideoLister.kt @@ -14,7 +14,7 @@ class VideoLister : Lister { val regex = "\\.(mp4|avi|video|webm)$".toRegex() } - val videoList = mutableListOf() + private val videoList = mutableListOf() fun initialize(onFinished: (() -> Unit)? = null) { videoList.clear()