diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ec4a27604..3e76368fb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -292,12 +292,12 @@
android:hardwareAccelerated="true" />
diff --git a/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt b/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt
index 461acd396..d36f55b89 100644
--- a/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt
@@ -15,7 +15,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.permission.Permissions
import io.legado.app.lib.permission.PermissionsCompat
import io.legado.app.ui.book.read.ReadBookActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.IO
diff --git a/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt b/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt
index 9b2727782..d3d152d2f 100644
--- a/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt
@@ -9,7 +9,7 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.data.appDb
import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.ActivityAllBookmarkBinding
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.utils.launch
import io.legado.app.utils.showDialogFragment
import io.legado.app.utils.viewbindingdelegate.viewBinding
diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
index 81c1e6df4..f98802f25 100644
--- a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
@@ -24,7 +24,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.selector
import io.legado.app.model.CacheBook
import io.legado.app.ui.about.AppLogDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.IO
diff --git a/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt
index 50f1b9141..b21662c60 100644
--- a/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt
@@ -7,19 +7,18 @@ import androidx.appcompat.widget.SearchView
import androidx.lifecycle.ViewModel
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
-import io.legado.app.databinding.ActivityImportBookBinding
-import io.legado.app.data.appDb
import io.legado.app.constant.AppPattern
+import io.legado.app.data.appDb
+import io.legado.app.databinding.ActivityImportBookBinding
import io.legado.app.help.config.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.selector
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.model.localBook.LocalBook
import io.legado.app.ui.book.read.ReadBookActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
-
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
diff --git a/app/src/main/java/io/legado/app/ui/book/import/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/import/local/ImportBookActivity.kt
index d529ac105..ce38a175f 100644
--- a/app/src/main/java/io/legado/app/ui/book/import/local/ImportBookActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/import/local/ImportBookActivity.kt
@@ -19,7 +19,7 @@ import io.legado.app.lib.permission.Permissions
import io.legado.app.lib.permission.PermissionsCompat
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.book.import.BaseImportBookActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.utils.*
import kotlinx.coroutines.Dispatchers.IO
diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
index f68411af8..5927b0327 100644
--- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
@@ -41,7 +41,7 @@ import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.book.search.SearchActivity
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
import io.legado.app.ui.book.toc.TocActivityResult
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.login.SourceLoginActivity
import io.legado.app.ui.widget.dialog.PhotoDialog
import io.legado.app.ui.widget.dialog.VariableDialog
diff --git a/app/src/main/java/io/legado/app/ui/book/read/BaseReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/BaseReadBookActivity.kt
index 2108db6e5..8f9542b9d 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/BaseReadBookActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/BaseReadBookActivity.kt
@@ -32,7 +32,7 @@ import io.legado.app.model.ReadBook
import io.legado.app.ui.book.read.config.BgTextConfigDialog
import io.legado.app.ui.book.read.config.ClickActionConfigDialog
import io.legado.app.ui.book.read.config.PaddingConfigDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
index 6de0e7037..3d5eec7c9 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
@@ -61,7 +61,7 @@ import io.legado.app.ui.book.toc.TocActivityResult
import io.legado.app.ui.book.toc.rule.TxtTocRuleDialog
import io.legado.app.ui.browser.WebViewActivity
import io.legado.app.ui.dict.DictDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.login.SourceLoginActivity
import io.legado.app.ui.replace.ReplaceRuleActivity
import io.legado.app.ui.replace.edit.ReplaceEditActivity
diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
index 1d745502d..740e62955 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
@@ -31,7 +31,7 @@ import io.legado.app.lib.theme.bottomBackground
import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.lib.theme.getSecondaryTextColor
import io.legado.app.ui.book.read.ReadBookActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
import io.legado.app.utils.*
import io.legado.app.utils.compress.ZipUtils
diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
index a98b5edce..0bf632d8d 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
@@ -26,7 +26,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.model.ReadAloud
import io.legado.app.model.ReadBook
import io.legado.app.ui.association.ImportHttpTtsDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.login.SourceLoginActivity
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
index 14688482e..bdc63a534 100644
--- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
@@ -25,7 +25,7 @@ import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.book.source.debug.BookSourceDebugActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.login.SourceLoginActivity
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.widget.dialog.TextDialog
diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
index 3f685af10..e42a68310 100644
--- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
@@ -32,7 +32,7 @@ import io.legado.app.ui.book.search.SearchScope
import io.legado.app.ui.book.source.debug.BookSourceDebugActivity
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
import io.legado.app.ui.config.CheckSourceConfig
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.ui.widget.dialog.TextDialog
diff --git a/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleActivity.kt b/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleActivity.kt
index bec755a6f..ccd03f0a9 100644
--- a/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleActivity.kt
@@ -17,7 +17,7 @@ import io.legado.app.help.DirectLinkUpload
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.association.ImportTxtTocRuleDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.ui.widget.dialog.TextDialog
diff --git a/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleDialog.kt b/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleDialog.kt
index 7e6113d96..ccf4a0d0d 100644
--- a/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/book/toc/rule/TxtTocRuleDialog.kt
@@ -25,7 +25,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.association.ImportTxtTocRuleDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.ui.widget.recycler.ItemTouchCallback
diff --git a/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt b/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt
index 4cdbe8cb2..2fefd4877 100644
--- a/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt
@@ -22,7 +22,7 @@ import io.legado.app.lib.dialogs.SelectItem
import io.legado.app.lib.theme.accentColor
import io.legado.app.model.Download
import io.legado.app.ui.association.OnLineImportActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import java.net.URLDecoder
diff --git a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
index 87a9a62ad..e7070a901 100644
--- a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
+++ b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
@@ -34,7 +34,7 @@ import io.legado.app.lib.permission.PermissionsCompat
import io.legado.app.lib.prefs.fragment.PreferenceFragment
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.about.AppLogDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.*
diff --git a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
index 85368eb45..2af2932aa 100644
--- a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
+++ b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
@@ -2,7 +2,6 @@ package io.legado.app.ui.config
import android.annotation.SuppressLint
import android.content.ComponentName
-import android.content.Context
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.os.Bundle
@@ -24,7 +23,7 @@ import io.legado.app.model.CheckSource
import io.legado.app.receiver.SharedReceiverActivity
import io.legado.app.service.WebService
import io.legado.app.ui.book.read.page.provider.ImageProvider
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.widget.number.NumberPickerDialog
import io.legado.app.utils.*
import splitties.init.appCtx
diff --git a/app/src/main/java/io/legado/app/ui/dict/rule/DictRuleActivity.kt b/app/src/main/java/io/legado/app/ui/dict/rule/DictRuleActivity.kt
index 559cfbe68..68dc094a6 100644
--- a/app/src/main/java/io/legado/app/ui/dict/rule/DictRuleActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/dict/rule/DictRuleActivity.kt
@@ -18,7 +18,7 @@ import io.legado.app.help.DirectLinkUpload
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.association.ImportDictRuleDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.ui.widget.dialog.TextDialog
diff --git a/app/src/main/java/io/legado/app/ui/document/FileManageActivity.kt b/app/src/main/java/io/legado/app/ui/file/FileManageActivity.kt
similarity index 87%
rename from app/src/main/java/io/legado/app/ui/document/FileManageActivity.kt
rename to app/src/main/java/io/legado/app/ui/file/FileManageActivity.kt
index 0fe82388e..84e807aac 100644
--- a/app/src/main/java/io/legado/app/ui/document/FileManageActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/file/FileManageActivity.kt
@@ -1,8 +1,10 @@
-package io.legado.app.ui.document
+package io.legado.app.ui.file
import android.annotation.SuppressLint
import android.os.Bundle
+import android.view.View
import android.view.ViewGroup
+import android.widget.PopupMenu
import androidx.activity.viewModels
import androidx.appcompat.widget.SearchView
import androidx.core.content.FileProvider
@@ -17,7 +19,7 @@ import io.legado.app.databinding.ActivityFileManageBinding
import io.legado.app.databinding.ItemFileBinding
import io.legado.app.databinding.ItemPathPickerBinding
import io.legado.app.lib.theme.primaryTextColor
-import io.legado.app.ui.document.utils.FilePickerIcon
+import io.legado.app.ui.file.utils.FilePickerIcon
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.ConvertUtils
import io.legado.app.utils.applyTint
@@ -152,7 +154,7 @@ class FileManageActivity : VMBaseActivity
+ val item = getItemByLayoutPosition(holder.layoutPosition)
+ if (item == viewModel.lastDir) {
+ return@setOnLongClickListener true
+ }
+ item?.let {
+ showFileMenu(view, item)
+ }
+ return@setOnLongClickListener true
+ }
}
override fun convert(
@@ -179,7 +191,7 @@ class FileManageActivity : VMBaseActivity
) {
- if (item == (viewModel.subDocs.lastOrNull() ?: viewModel.rootDoc)) {
+ if (item == viewModel.lastDir) {
binding.imageView.setImageDrawable(upIcon)
binding.textView.text = dirParent
} else if (item.isDirectory) {
@@ -191,6 +203,17 @@ class FileManageActivity : VMBaseActivity viewModel.delFile(file)
+ }
+ true
+ }
+ popupMenu.show()
+ }
}
diff --git a/app/src/main/java/io/legado/app/ui/document/FileManageViewModel.kt b/app/src/main/java/io/legado/app/ui/file/FileManageViewModel.kt
similarity index 59%
rename from app/src/main/java/io/legado/app/ui/document/FileManageViewModel.kt
rename to app/src/main/java/io/legado/app/ui/file/FileManageViewModel.kt
index 01970ac79..5720f373d 100644
--- a/app/src/main/java/io/legado/app/ui/document/FileManageViewModel.kt
+++ b/app/src/main/java/io/legado/app/ui/file/FileManageViewModel.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document
+package io.legado.app.ui.file
import android.app.Application
import androidx.lifecycle.MutableLiveData
@@ -12,13 +12,20 @@ class FileManageViewModel(application: Application) : BaseViewModel(application)
var subDocs = mutableListOf()
val filesLiveData = MutableLiveData>()
+ val lastDir: File? get() = subDocs.lastOrNull() ?: rootDoc
+
fun upFiles(parentFile: File?) {
execute {
+ parentFile ?: return@execute emptyList()
if (parentFile == rootDoc) {
- parentFile?.listFiles()?.toList()
+ parentFile.listFiles()?.sortedWith(
+ compareBy({ it.isFile }, { it.name })
+ )
} else {
val list = arrayListOf(parentFile)
- parentFile?.listFiles()?.let {
+ parentFile.listFiles()?.sortedWith(
+ compareBy({ it.isFile }, { it.name })
+ )?.let {
list.addAll(it)
}
list
@@ -32,5 +39,14 @@ class FileManageViewModel(application: Application) : BaseViewModel(application)
}
}
+ fun delFile(file: File) {
+ execute {
+ file.delete()
+ }.onSuccess {
+ upFiles(lastDir)
+ }.onError {
+ context.toastOnUi(it.localizedMessage)
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/io/legado/app/ui/document/FilePickerDialog.kt b/app/src/main/java/io/legado/app/ui/file/FilePickerDialog.kt
similarity index 96%
rename from app/src/main/java/io/legado/app/ui/document/FilePickerDialog.kt
rename to app/src/main/java/io/legado/app/ui/file/FilePickerDialog.kt
index 466a0385f..89cd81f5d 100644
--- a/app/src/main/java/io/legado/app/ui/document/FilePickerDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/file/FilePickerDialog.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document
+package io.legado.app.ui.file
import android.content.DialogInterface
import android.content.Intent
@@ -14,10 +14,10 @@ import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogFileChooserBinding
import io.legado.app.lib.theme.primaryColor
-import io.legado.app.ui.document.HandleFileContract.Companion.DIR
-import io.legado.app.ui.document.HandleFileContract.Companion.FILE
-import io.legado.app.ui.document.adapter.FileAdapter
-import io.legado.app.ui.document.adapter.PathAdapter
+import io.legado.app.ui.file.HandleFileContract.Companion.DIR
+import io.legado.app.ui.file.HandleFileContract.Companion.FILE
+import io.legado.app.ui.file.adapter.FileAdapter
+import io.legado.app.ui.file.adapter.PathAdapter
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
diff --git a/app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt b/app/src/main/java/io/legado/app/ui/file/HandleFileActivity.kt
similarity index 99%
rename from app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt
rename to app/src/main/java/io/legado/app/ui/file/HandleFileActivity.kt
index e7be7c816..dedb518ae 100644
--- a/app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/file/HandleFileActivity.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document
+package io.legado.app.ui.file
import android.content.Intent
import android.net.Uri
diff --git a/app/src/main/java/io/legado/app/ui/document/HandleFileContract.kt b/app/src/main/java/io/legado/app/ui/file/HandleFileContract.kt
similarity index 98%
rename from app/src/main/java/io/legado/app/ui/document/HandleFileContract.kt
rename to app/src/main/java/io/legado/app/ui/file/HandleFileContract.kt
index 557c27f31..a75f125ea 100644
--- a/app/src/main/java/io/legado/app/ui/document/HandleFileContract.kt
+++ b/app/src/main/java/io/legado/app/ui/file/HandleFileContract.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document
+package io.legado.app.ui.file
import android.app.Activity.RESULT_OK
import android.content.Context
diff --git a/app/src/main/java/io/legado/app/ui/document/HandleFileViewModel.kt b/app/src/main/java/io/legado/app/ui/file/HandleFileViewModel.kt
similarity index 98%
rename from app/src/main/java/io/legado/app/ui/document/HandleFileViewModel.kt
rename to app/src/main/java/io/legado/app/ui/file/HandleFileViewModel.kt
index 65a613c1c..6eb110db1 100644
--- a/app/src/main/java/io/legado/app/ui/document/HandleFileViewModel.kt
+++ b/app/src/main/java/io/legado/app/ui/file/HandleFileViewModel.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document
+package io.legado.app.ui.file
import android.app.Application
import android.net.Uri
diff --git a/app/src/main/java/io/legado/app/ui/document/adapter/FileAdapter.kt b/app/src/main/java/io/legado/app/ui/file/adapter/FileAdapter.kt
similarity index 97%
rename from app/src/main/java/io/legado/app/ui/document/adapter/FileAdapter.kt
rename to app/src/main/java/io/legado/app/ui/file/adapter/FileAdapter.kt
index eadb4d514..c4e6910c2 100644
--- a/app/src/main/java/io/legado/app/ui/document/adapter/FileAdapter.kt
+++ b/app/src/main/java/io/legado/app/ui/file/adapter/FileAdapter.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document.adapter
+package io.legado.app.ui.file.adapter
import android.content.Context
@@ -9,8 +9,8 @@ import io.legado.app.databinding.ItemFilePickerBinding
import io.legado.app.help.config.AppConfig
import io.legado.app.lib.theme.getPrimaryDisabledTextColor
import io.legado.app.lib.theme.getPrimaryTextColor
-import io.legado.app.ui.document.entity.FileItem
-import io.legado.app.ui.document.utils.FilePickerIcon
+import io.legado.app.ui.file.entity.FileItem
+import io.legado.app.ui.file.utils.FilePickerIcon
import io.legado.app.utils.ConvertUtils
import io.legado.app.utils.FileUtils
import java.io.File
diff --git a/app/src/main/java/io/legado/app/ui/document/adapter/PathAdapter.kt b/app/src/main/java/io/legado/app/ui/file/adapter/PathAdapter.kt
similarity index 95%
rename from app/src/main/java/io/legado/app/ui/document/adapter/PathAdapter.kt
rename to app/src/main/java/io/legado/app/ui/file/adapter/PathAdapter.kt
index 5a085c683..cb75891b2 100644
--- a/app/src/main/java/io/legado/app/ui/document/adapter/PathAdapter.kt
+++ b/app/src/main/java/io/legado/app/ui/file/adapter/PathAdapter.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document.adapter
+package io.legado.app.ui.file.adapter
import android.content.Context
import android.os.Environment
@@ -6,7 +6,7 @@ import android.view.ViewGroup
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.databinding.ItemPathPickerBinding
-import io.legado.app.ui.document.utils.FilePickerIcon
+import io.legado.app.ui.file.utils.FilePickerIcon
import io.legado.app.utils.ConvertUtils
import java.util.*
diff --git a/app/src/main/java/io/legado/app/ui/document/entity/FileItem.kt b/app/src/main/java/io/legado/app/ui/file/entity/FileItem.kt
similarity index 84%
rename from app/src/main/java/io/legado/app/ui/document/entity/FileItem.kt
rename to app/src/main/java/io/legado/app/ui/file/entity/FileItem.kt
index 3642bdb54..a56531f60 100644
--- a/app/src/main/java/io/legado/app/ui/document/entity/FileItem.kt
+++ b/app/src/main/java/io/legado/app/ui/file/entity/FileItem.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document.entity
+package io.legado.app.ui.file.entity
import android.graphics.drawable.Drawable
diff --git a/app/src/main/java/io/legado/app/ui/document/utils/FilePickerIcon.java b/app/src/main/java/io/legado/app/ui/file/utils/FilePickerIcon.java
similarity index 99%
rename from app/src/main/java/io/legado/app/ui/document/utils/FilePickerIcon.java
rename to app/src/main/java/io/legado/app/ui/file/utils/FilePickerIcon.java
index 0f3447f6a..138b2be3e 100644
--- a/app/src/main/java/io/legado/app/ui/document/utils/FilePickerIcon.java
+++ b/app/src/main/java/io/legado/app/ui/file/utils/FilePickerIcon.java
@@ -1,4 +1,4 @@
-package io.legado.app.ui.document.utils;
+package io.legado.app.ui.file.utils;
/**
* Generated by https://github.com/gzu-liyujiang/Image2ByteVar
diff --git a/app/src/main/java/io/legado/app/ui/font/FontSelectDialog.kt b/app/src/main/java/io/legado/app/ui/font/FontSelectDialog.kt
index 87e7aea5e..1cef99016 100644
--- a/app/src/main/java/io/legado/app/ui/font/FontSelectDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/font/FontSelectDialog.kt
@@ -18,7 +18,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.permission.Permissions
import io.legado.app.lib.permission.PermissionsCompat
import io.legado.app.lib.theme.primaryColor
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.Main
diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt
index 9424ad811..89eb042c7 100644
--- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt
+++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt
@@ -25,7 +25,7 @@ import io.legado.app.ui.book.import.local.ImportBookActivity
import io.legado.app.ui.book.import.remote.RemoteBookActivity
import io.legado.app.ui.book.manage.BookshelfManageActivity
import io.legado.app.ui.book.search.SearchActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.main.MainViewModel
import io.legado.app.utils.*
diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt
index ad77bf8e9..63780d64a 100644
--- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt
+++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt
@@ -29,7 +29,7 @@ import io.legado.app.ui.book.toc.rule.TxtTocRuleActivity
import io.legado.app.ui.config.ConfigActivity
import io.legado.app.ui.config.ConfigTag
import io.legado.app.ui.dict.rule.DictRuleActivity
-import io.legado.app.ui.document.FileManageActivity
+import io.legado.app.ui.file.FileManageActivity
import io.legado.app.ui.replace.ReplaceRuleActivity
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.utils.*
diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
index c5eedf968..370ef9e7d 100644
--- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
@@ -28,7 +28,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.ui.association.ImportReplaceRuleDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.replace.edit.ReplaceEditActivity
import io.legado.app.ui.widget.SelectActionBar
diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
index 75184a3c0..1c201d139 100644
--- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
@@ -21,7 +21,7 @@ import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.model.Download
import io.legado.app.ui.association.OnLineImportActivity
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.login.SourceLoginActivity
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
diff --git a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
index c2756b0d5..8c9a43bc1 100644
--- a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
@@ -18,7 +18,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.primaryColor
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.login.SourceLoginActivity
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.rss.source.debug.RssSourceDebugActivity
diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
index b8a72e89d..63d49acec 100644
--- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
@@ -23,7 +23,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.ui.association.ImportRssSourceDialog
-import io.legado.app.ui.document.HandleFileContract
+import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity
import io.legado.app.ui.widget.SelectActionBar
diff --git a/app/src/main/res/menu/file_long_click.xml b/app/src/main/res/menu/file_long_click.xml
new file mode 100644
index 000000000..f852b2bcf
--- /dev/null
+++ b/app/src/main/res/menu/file_long_click.xml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file