mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
Some checks are pending
Test Build / prepare (push) Waiting to run
Test Build / build (app, release) (push) Blocked by required conditions
Test Build / build (app, releaseA) (push) Blocked by required conditions
Test Build / prerelease (push) Blocked by required conditions
Test Build / lanzou (push) Blocked by required conditions
Test Build / test_Branch (push) Blocked by required conditions
Test Build / telegram (push) Blocked by required conditions
Some checks are pending
Test Build / prepare (push) Waiting to run
Test Build / build (app, release) (push) Blocked by required conditions
Test Build / build (app, releaseA) (push) Blocked by required conditions
Test Build / prerelease (push) Blocked by required conditions
Test Build / lanzou (push) Blocked by required conditions
Test Build / test_Branch (push) Blocked by required conditions
Test Build / telegram (push) Blocked by required conditions
This commit is contained in:
@@ -290,12 +290,12 @@ class EpubFile(var book: Book) {
|
||||
book.name = book.originName.replace(".epub", "")
|
||||
}
|
||||
|
||||
if (metadata.authors.size > 0) {
|
||||
if (metadata.authors.isNotEmpty()) {
|
||||
val author =
|
||||
metadata.authors[0].toString().replace("^, |, $".toRegex(), "")
|
||||
book.author = author
|
||||
}
|
||||
if (metadata.descriptions.size > 0) {
|
||||
if (metadata.descriptions.isNotEmpty()) {
|
||||
val desc = metadata.descriptions[0]
|
||||
book.intro = if (desc.isXml()) {
|
||||
Jsoup.parse(metadata.descriptions[0]).text()
|
||||
@@ -323,7 +323,7 @@ class EpubFile(var book: Book) {
|
||||
val doc =
|
||||
Jsoup.parse(String(resource.data, mCharset))
|
||||
val elements = doc.getElementsByTag("title")
|
||||
if (elements.size > 0) {
|
||||
if (elements.isNotEmpty()) {
|
||||
title = elements[0].text()
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
@@ -385,7 +385,7 @@ class EpubFile(var book: Book) {
|
||||
String(epubBook!!.resources.getByHref(content.href).data, mCharset)
|
||||
).getElementsByTag("title")
|
||||
title =
|
||||
if (elements.size > 0 && elements[0].text().isNotBlank())
|
||||
if (elements.isNotEmpty() && elements[0].text().isNotBlank())
|
||||
elements[0].text()
|
||||
else
|
||||
"--卷首--"
|
||||
|
||||
@@ -15,7 +15,6 @@ import io.legado.app.R
|
||||
import io.legado.app.constant.PreferKey
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.databinding.DialogEditTextBinding
|
||||
import io.legado.app.help.book.update
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.lib.dialogs.alert
|
||||
import io.legado.app.lib.permission.Permissions
|
||||
@@ -308,7 +307,7 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
|
||||
val filePath = fileDoc.toString()
|
||||
if (it.bookUrl != filePath) {
|
||||
it.bookUrl = filePath
|
||||
it.update()
|
||||
appDb.bookDao.insert(it)
|
||||
}
|
||||
startReadBook(it)
|
||||
}
|
||||
|
||||
@@ -168,14 +168,12 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
}
|
||||
private val replaceActivity =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||
it ?: return@registerForActivityResult
|
||||
if (it.resultCode == RESULT_OK) {
|
||||
viewModel.replaceRuleChanged()
|
||||
}
|
||||
}
|
||||
private val searchContentActivity =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||
it ?: return@registerForActivityResult
|
||||
it.data?.let { data ->
|
||||
val key = data.getLongExtra("key", System.currentTimeMillis())
|
||||
val index = data.getIntExtra("index", 0)
|
||||
|
||||
Reference in New Issue
Block a user