Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
* 修复书签界面删除条目后界面错乱bug
|
* 修复书签界面删除条目后界面错乱bug
|
||||||
* 一些带有搜索框的界面自动隐藏软键盘
|
* 一些带有搜索框的界面自动隐藏软键盘
|
||||||
|
* 本地书籍导入界面支持压缩包
|
||||||
|
|
||||||
**2023/03/14**
|
**2023/03/14**
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,11 @@ import androidx.lifecycle.ViewModel
|
|||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.VMBaseActivity
|
import io.legado.app.base.VMBaseActivity
|
||||||
import io.legado.app.databinding.ActivityImportBookBinding
|
import io.legado.app.databinding.ActivityImportBookBinding
|
||||||
|
import io.legado.app.data.appDb
|
||||||
|
import io.legado.app.constant.AppPattern
|
||||||
import io.legado.app.help.config.AppConfig
|
import io.legado.app.help.config.AppConfig
|
||||||
import io.legado.app.lib.dialogs.alert
|
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.lib.theme.primaryTextColor
|
||||||
import io.legado.app.ui.book.read.ReadBookActivity
|
import io.legado.app.ui.book.read.ReadBookActivity
|
||||||
import io.legado.app.ui.document.HandleFileContract
|
import io.legado.app.ui.document.HandleFileContract
|
||||||
@@ -90,6 +93,34 @@ abstract class BaseImportBookActivity<VM : ViewModel> : VMBaseActivity<ActivityI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun onArchiveFileClick(fileDoc: FileDoc) {
|
||||||
|
val fileNames = ArchiveUtils.getArchiveFilesName(fileDoc) {
|
||||||
|
it.matches(AppPattern.bookFileRegex)
|
||||||
|
}
|
||||||
|
if (fileNames.size == 1) {
|
||||||
|
appDb.bookDao.getBookByFileName(fileNames[0])?.let {
|
||||||
|
startReadBook(it.bookUrl)
|
||||||
|
} ?: toastOnUi(R.string.no_book_found_bookshelf)
|
||||||
|
} else {
|
||||||
|
showSelectBookReadAlert(fileNames)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showSelectBookReadAlert(fileNames: List<String>) {
|
||||||
|
if (fileNames.isEmpty()) {
|
||||||
|
toastOnUi(R.string.unsupport_archivefile_entry)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
selector(
|
||||||
|
R.string.start_read,
|
||||||
|
fileNames
|
||||||
|
) { _, name, _ ->
|
||||||
|
appDb.bookDao.getBookByFileName(name)?.let {
|
||||||
|
startReadBook(it.bookUrl)
|
||||||
|
} ?: toastOnUi(R.string.no_book_found_bookshelf)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun initSearchView() {
|
private fun initSearchView() {
|
||||||
searchView.applyTint(primaryTextColor)
|
searchView.applyTint(primaryTextColor)
|
||||||
searchView.onActionViewExpanded()
|
searchView.onActionViewExpanded()
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import androidx.documentfile.provider.DocumentFile
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.AppConst
|
import io.legado.app.constant.AppConst
|
||||||
import io.legado.app.constant.AppPattern
|
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.databinding.DialogEditTextBinding
|
import io.legado.app.databinding.DialogEditTextBinding
|
||||||
@@ -305,16 +304,7 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
|
|||||||
if (!ArchiveUtils.isArchive(fileDoc.name)) {
|
if (!ArchiveUtils.isArchive(fileDoc.name)) {
|
||||||
startReadBook(fileDoc.toString())
|
startReadBook(fileDoc.toString())
|
||||||
} else {
|
} else {
|
||||||
val fileNames = ArchiveUtils.getArchiveFilesName(fileDoc) {
|
onArchiveFileClick(fileDoc)
|
||||||
it.matches(AppPattern.bookFileRegex)
|
|
||||||
}
|
|
||||||
if (fileNames.size == 1) {
|
|
||||||
appDb.bookDao.getBookByFileName(fileNames[0])?.let {
|
|
||||||
startReadBook(it.bookUrl)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//onArchiveFileClick(fileNames)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1083,4 +1083,5 @@
|
|||||||
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
||||||
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
||||||
<string name="delete_alert">删除提醒</string>
|
<string name="delete_alert">删除提醒</string>
|
||||||
|
<string name="no_book_found_bookshelf">No book found in bookshelf</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1086,4 +1086,5 @@
|
|||||||
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
||||||
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
||||||
<string name="delete_alert">删除提醒</string>
|
<string name="delete_alert">删除提醒</string>
|
||||||
|
<string name="no_book_found_bookshelf">No book found in bookshelf</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1086,4 +1086,5 @@
|
|||||||
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
||||||
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
||||||
<string name="delete_alert">删除提醒</string>
|
<string name="delete_alert">删除提醒</string>
|
||||||
|
<string name="no_book_found_bookshelf">No book found in bookshelf</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1083,4 +1083,5 @@
|
|||||||
<string name="unsupport_archivefile_entry">压缩文件内没有支持的文件</string>
|
<string name="unsupport_archivefile_entry">压缩文件内没有支持的文件</string>
|
||||||
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
||||||
<string name="delete_alert">删除提醒</string>
|
<string name="delete_alert">删除提醒</string>
|
||||||
|
<string name="no_book_found_bookshelf">未在书架上找到所选书籍</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1085,4 +1085,5 @@
|
|||||||
<string name="unsupport_archivefile_entry">压缩文件内没有支持的文件</string>
|
<string name="unsupport_archivefile_entry">压缩文件内没有支持的文件</string>
|
||||||
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
||||||
<string name="delete_alert">删除提醒</string>
|
<string name="delete_alert">删除提醒</string>
|
||||||
|
<string name="no_book_found_bookshelf">未在书架上找到所选书籍</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1085,4 +1085,5 @@
|
|||||||
<string name="unsupport_archivefile_entry">压缩文件内没有支持的文件</string>
|
<string name="unsupport_archivefile_entry">压缩文件内没有支持的文件</string>
|
||||||
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
||||||
<string name="delete_alert">删除提醒</string>
|
<string name="delete_alert">删除提醒</string>
|
||||||
|
<string name="no_book_found_bookshelf">未在书架上找到所选书籍</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1086,4 +1086,5 @@
|
|||||||
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
<string name="unsupport_archivefile_entry">Cannot find supported files in archive</string>
|
||||||
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
<string name="no_books_dir">没有设置书籍保存位置!</string>
|
||||||
<string name="delete_alert">删除提醒</string>
|
<string name="delete_alert">删除提醒</string>
|
||||||
|
<string name="no_book_found_bookshelf">No book found in bookshelf</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user