diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f2ace33..33c55ea 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,6 +7,8 @@ android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" /> + + (R.id.LoadingBlankText).visibility = View.GONE + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } } } @@ -274,6 +280,12 @@ class document_page : AppCompatActivity() { runOnUiThread { val grid = findViewById(R.id.DocumentGrid) grid.setAdapter(adapter) + + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } runSomethingMore?.invoke() } diff --git a/app/src/main/java/com/dazuoye/filemanager/fileSystem/WrappedFile.kt b/app/src/main/java/com/dazuoye/filemanager/fileSystem/WrappedFile.kt index b25ab4d..c35641c 100644 --- a/app/src/main/java/com/dazuoye/filemanager/fileSystem/WrappedFile.kt +++ b/app/src/main/java/com/dazuoye/filemanager/fileSystem/WrappedFile.kt @@ -129,18 +129,12 @@ class WrappedFile(private val f: File, skipCalculateDirectorySize: Boolean = fal } fun getSizeString(): String { - if (size == 0L) { - if (type == Type.DIRECTORY) { - if (!isSizeCalculated) { - // Calculate Size - size = getFolderSize(f) - isSizeCalculated = true - } else { - return "0B" - } - } else { - return "未知" - } + if (size == 0L && type == Type.DIRECTORY && !isSizeCalculated) { + // Calculate Size + size = getFolderSize(f) + isSizeCalculated = true + } else { + return "0B" } return getSizeString(size.toULong()) } diff --git a/app/src/main/java/com/dazuoye/filemanager/music_page.kt b/app/src/main/java/com/dazuoye/filemanager/music_page.kt index 4338be1..4c18795 100644 --- a/app/src/main/java/com/dazuoye/filemanager/music_page.kt +++ b/app/src/main/java/com/dazuoye/filemanager/music_page.kt @@ -9,6 +9,7 @@ import android.view.View import android.widget.AdapterView import android.widget.GridView import android.widget.ImageView +import android.widget.LinearLayout import android.widget.TextView import android.widget.Toast import androidx.activity.enableEdgeToEdge @@ -18,6 +19,7 @@ import androidx.core.content.FileProvider import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat.Type +import androidx.core.view.isVisible import com.dazuoye.filemanager.fileSystem.adapters.MusicAdapter import com.dazuoye.filemanager.fileSystem.adapters.MusicModel import com.dazuoye.filemanager.compose.SearchActivity @@ -122,6 +124,11 @@ class music_page : AppCompatActivity() { val adapter = MusicAdapter(this@music_page, models) musicGrid.setAdapter(adapter) findViewById(R.id.LoadingBlankText).visibility = View.GONE + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } } } @@ -253,6 +260,12 @@ class music_page : AppCompatActivity() { runOnUiThread { val grid = findViewById(R.id.MusicGrid) grid.setAdapter(adapter) + + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } runSomethingMore?.invoke() } diff --git a/app/src/main/java/com/dazuoye/filemanager/picture_page.kt b/app/src/main/java/com/dazuoye/filemanager/picture_page.kt index f945b45..d32960d 100644 --- a/app/src/main/java/com/dazuoye/filemanager/picture_page.kt +++ b/app/src/main/java/com/dazuoye/filemanager/picture_page.kt @@ -9,6 +9,7 @@ import android.view.View import android.widget.AdapterView import android.widget.GridView import android.widget.ImageView +import android.widget.LinearLayout import android.widget.TextView import android.widget.Toast import androidx.activity.enableEdgeToEdge @@ -116,14 +117,19 @@ class picture_page : AppCompatActivity() { val defaultText = loadingTextView.text launch { loadingText(loadingTextView, defaultText) } imageList = instance.dateOrderedList() - val imageModels = ArrayList() + val models = ArrayList() for (path in imageList) { - imageModels.add(ImageModel(File(path))) + models.add(ImageModel(File(path))) } runOnUiThread { - val adapter = ImageAdapter(this@picture_page, imageModels) + val adapter = ImageAdapter(this@picture_page, models) pictureGrid.setAdapter(adapter) findViewById(R.id.LoadingBlankText).visibility = View.GONE + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } } } @@ -247,14 +253,19 @@ class picture_page : AppCompatActivity() { 1 -> instance.sizeOrderedList() else -> listOf() } - val imageModels = ArrayList() + val models = ArrayList() for (path in imageList) { - imageModels.add(ImageModel(File(path))) + models.add(ImageModel(File(path))) } - val adapter = ImageAdapter(this, imageModels) + val adapter = ImageAdapter(this, models) runOnUiThread { val grid = findViewById(R.id.PicturePageGrid) grid.setAdapter(adapter) + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } runSomethingMore?.invoke() } diff --git a/app/src/main/java/com/dazuoye/filemanager/video_page.kt b/app/src/main/java/com/dazuoye/filemanager/video_page.kt index 5ab4486..cd1704f 100644 --- a/app/src/main/java/com/dazuoye/filemanager/video_page.kt +++ b/app/src/main/java/com/dazuoye/filemanager/video_page.kt @@ -9,6 +9,7 @@ import android.view.View import android.widget.AdapterView import android.widget.GridView import android.widget.ImageView +import android.widget.LinearLayout import android.widget.TextView import android.widget.Toast import androidx.activity.enableEdgeToEdge @@ -115,14 +116,19 @@ class video_page : AppCompatActivity() { val defaultText = loadingTextView.text launch { loadingText(loadingTextView, defaultText) } videoList = instance.dateOrderedList() - val videoModels = ArrayList() + val models = ArrayList() for (path in videoList) { - videoModels.add(VideoModel(File(path))) + models.add(VideoModel(File(path))) } runOnUiThread { - val adapter = VideoAdapter(this@video_page, videoModels) + val adapter = VideoAdapter(this@video_page, models) videoGrid.setAdapter(adapter) findViewById(R.id.LoadingBlankText).visibility = View.GONE + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } } } @@ -246,14 +252,19 @@ class video_page : AppCompatActivity() { 1 -> instance.sizeOrderedList() else -> listOf() } - val videoModels = ArrayList() + val models = ArrayList() for (path in videoList) { - videoModels.add(VideoModel(File(path))) + models.add(VideoModel(File(path))) } - val adapter = VideoAdapter(this, videoModels) + val adapter = VideoAdapter(this, models) runOnUiThread { val grid = findViewById(R.id.VideoGrid) grid.setAdapter(adapter) + findViewById(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空 + View.VISIBLE + }else{ + View.GONE + } } runSomethingMore?.invoke() } diff --git a/app/src/main/res/drawable/ic_download.xml b/app/src/main/res/drawable/ic_download.xml index d8ab46f..074431c 100644 --- a/app/src/main/res/drawable/ic_download.xml +++ b/app/src/main/res/drawable/ic_download.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/outline_all_inclusive_24.xml b/app/src/main/res/drawable/outline_all_inclusive_24.xml new file mode 100644 index 0000000..14ee119 --- /dev/null +++ b/app/src/main/res/drawable/outline_all_inclusive_24.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/app/src/main/res/layout/document_page.xml b/app/src/main/res/layout/document_page.xml index 861b378..e2558ab 100644 --- a/app/src/main/res/layout/document_page.xml +++ b/app/src/main/res/layout/document_page.xml @@ -98,4 +98,20 @@ android:textSize="78sp" android:background="@color/WhiteSmoke"/> + + + + diff --git a/app/src/main/res/layout/music_page.xml b/app/src/main/res/layout/music_page.xml index 0dcccd4..d9920c2 100644 --- a/app/src/main/res/layout/music_page.xml +++ b/app/src/main/res/layout/music_page.xml @@ -98,4 +98,21 @@ android:textSize="78sp" android:background="@color/WhiteSmoke"/> + + + + + diff --git a/app/src/main/res/layout/picture_page.xml b/app/src/main/res/layout/picture_page.xml index dca33fc..05471f8 100644 --- a/app/src/main/res/layout/picture_page.xml +++ b/app/src/main/res/layout/picture_page.xml @@ -107,5 +107,21 @@ android:background="@color/WhiteSmoke"/> + + + + diff --git a/app/src/main/res/layout/video_page.xml b/app/src/main/res/layout/video_page.xml index de49dc5..942f5ce 100644 --- a/app/src/main/res/layout/video_page.xml +++ b/app/src/main/res/layout/video_page.xml @@ -109,4 +109,20 @@ android:textSize="78sp" android:background="@color/WhiteSmoke"/> + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 79a9a2e..f30e21e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -88,5 +88,6 @@ 隐藏点文件 隐藏所有以 . 开头的文件和文件夹\n. 开头的文件(或文件夹)通常表示隐藏文件(或文件夹)\n此选项只对查看全部文件功能有效 + 无内容 关于 \ No newline at end of file