From 2e3a85ff382c9601ada3f5c1408748193fad0e0c Mon Sep 17 00:00:00 2001 From: Kagura Date: Thu, 17 Oct 2024 21:33:27 +0800 Subject: [PATCH] fix: default should show ext --- .../dazuoye/filemanager/fileSystem/adapters/Document.kt | 6 +++--- .../com/dazuoye/filemanager/fileSystem/adapters/Image.kt | 7 ++++--- .../com/dazuoye/filemanager/fileSystem/adapters/Music.kt | 6 +++--- .../com/dazuoye/filemanager/fileSystem/adapters/Video.kt | 7 ++++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Document.kt b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Document.kt index 0929253..6a942db 100644 --- a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Document.kt +++ b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Document.kt @@ -31,10 +31,10 @@ class DocumentAdapter(context: Context, list: ArrayList) : ) val model = getItem(position) ?: throw RuntimeException() val card = listView.findViewById(R.id.iconButton) - card.text = if (hideExtension == false) { - model.name - } else { + card.text = if (hideExtension == true) { model.nameWithoutExt + } else { + model.name } return listView } diff --git a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Image.kt b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Image.kt index 6fe2392..c24efca 100644 --- a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Image.kt +++ b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Image.kt @@ -39,10 +39,11 @@ class ImageAdapter(context: Context, list: ArrayList) : ) val model = getItem(position) ?: throw RuntimeException() listView.findViewById(R.id.pictureCardImage).setImageBitmap(model.thumbnail) - listView.findViewById(R.id.pictureCardText).text = if (hideExtension == false) { - model.name - } else { + val card = listView.findViewById(R.id.pictureCardText) + card.text = if (hideExtension == true) { model.nameWithoutExt + } else { + model.name } listView.setLayoutParams(LayoutParams(GridView.AUTO_FIT, 530)) diff --git a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Music.kt b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Music.kt index 984c9c5..ba7eb5d 100644 --- a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Music.kt +++ b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Music.kt @@ -31,10 +31,10 @@ class MusicAdapter(context: Context, list: ArrayList) : ) val model = getItem(position) ?: throw RuntimeException() val card = listView.findViewById(R.id.iconButton) - card.text = if (hideExtension == false) { - model.name - } else { + card.text = if (hideExtension == true) { model.nameWithoutExt + } else { + model.name } return listView } diff --git a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Video.kt b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Video.kt index bf73d3e..9aa2341 100644 --- a/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Video.kt +++ b/app/src/main/java/com/dazuoye/filemanager/fileSystem/adapters/Video.kt @@ -42,10 +42,11 @@ class VideoAdapter(context: Context, list: ArrayList) : ) val model = getItem(position) ?: throw RuntimeException() listView.findViewById(R.id.pictureCardImage).setImageBitmap(model.thumbnail) - listView.findViewById(R.id.pictureCardText).text = if (hideExtension == false) { - model.name - } else { + val card = listView.findViewById(R.id.pictureCardText) + card.text = if (hideExtension == true) { model.nameWithoutExt + } else { + model.name } listView.setLayoutParams(LayoutParams(GridView.AUTO_FIT, 530))