优化
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,10 @@
|
|||||||
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
|
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
|
||||||
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
|
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
|
||||||
|
|
||||||
|
**2022/06/05**
|
||||||
|
|
||||||
|
* 添加源变量说明,输入源变量界面显示说明
|
||||||
|
|
||||||
**2022/06/01**
|
**2022/06/01**
|
||||||
|
|
||||||
* 更新cronet: 102.0.5005.78
|
* 更新cronet: 102.0.5005.78
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ val appDb by lazy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
version = 49,
|
version = 50,
|
||||||
exportSchema = true,
|
exportSchema = true,
|
||||||
entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class,
|
entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class,
|
||||||
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
|
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
|
||||||
@@ -33,7 +33,8 @@ val appDb by lazy {
|
|||||||
AutoMigration(from = 45, to = 46),
|
AutoMigration(from = 45, to = 46),
|
||||||
AutoMigration(from = 46, to = 47),
|
AutoMigration(from = 46, to = 47),
|
||||||
AutoMigration(from = 47, to = 48),
|
AutoMigration(from = 47, to = 48),
|
||||||
AutoMigration(from = 48, to = 49)
|
AutoMigration(from = 48, to = 49),
|
||||||
|
AutoMigration(from = 49, to = 50)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ data class BookSource(
|
|||||||
var loginCheckJs: String? = null,
|
var loginCheckJs: String? = null,
|
||||||
// 注释
|
// 注释
|
||||||
var bookSourceComment: String? = null,
|
var bookSourceComment: String? = null,
|
||||||
|
// 自定义变量说明
|
||||||
|
var variableComment: String? = null,
|
||||||
// 最后更新时间,用于排序
|
// 最后更新时间,用于排序
|
||||||
var lastUpdateTime: Long = 0,
|
var lastUpdateTime: Long = 0,
|
||||||
// 响应时间,用于排序
|
// 响应时间,用于排序
|
||||||
@@ -211,6 +213,14 @@ data class BookSource(
|
|||||||
}?.joinToString() ?: ""
|
}?.joinToString() ?: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getDisplayVariableComment(otherComment: String): String {
|
||||||
|
return if (variableComment.isNullOrBlank()) {
|
||||||
|
otherComment
|
||||||
|
} else {
|
||||||
|
"${variableComment}\n$otherComment"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun equal(source: BookSource) =
|
fun equal(source: BookSource) =
|
||||||
equal(bookSourceName, source.bookSourceName)
|
equal(bookSourceName, source.bookSourceName)
|
||||||
&& equal(bookSourceUrl, source.bookSourceUrl)
|
&& equal(bookSourceUrl, source.bookSourceUrl)
|
||||||
|
|||||||
@@ -15,22 +15,35 @@ import splitties.init.appCtx
|
|||||||
data class RssSource(
|
data class RssSource(
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
var sourceUrl: String = "",
|
var sourceUrl: String = "",
|
||||||
|
// 名称
|
||||||
var sourceName: String = "",
|
var sourceName: String = "",
|
||||||
|
// 图标
|
||||||
var sourceIcon: String = "",
|
var sourceIcon: String = "",
|
||||||
|
// 分组
|
||||||
var sourceGroup: String? = null,
|
var sourceGroup: String? = null,
|
||||||
|
// 注释
|
||||||
var sourceComment: String? = null,
|
var sourceComment: String? = null,
|
||||||
|
// 是否启用
|
||||||
var enabled: Boolean = true,
|
var enabled: Boolean = true,
|
||||||
|
// 自定义变量说明
|
||||||
|
var variableComment: String? = null,
|
||||||
@ColumnInfo(defaultValue = "0")
|
@ColumnInfo(defaultValue = "0")
|
||||||
override var enabledCookieJar: Boolean? = false,
|
override var enabledCookieJar: Boolean? = false,
|
||||||
override var concurrentRate: String? = null, //并发率
|
//并发率
|
||||||
override var header: String? = null, // 请求头
|
override var concurrentRate: String? = null,
|
||||||
override var loginUrl: String? = null, // 登录地址
|
// 请求头
|
||||||
override var loginUi: String? = null, //登录UI
|
override var header: String? = null,
|
||||||
var loginCheckJs: String? = null, //登录检测js
|
// 登录地址
|
||||||
|
override var loginUrl: String? = null,
|
||||||
|
//登录UI
|
||||||
|
override var loginUi: String? = null,
|
||||||
|
//登录检测js
|
||||||
|
var loginCheckJs: String? = null,
|
||||||
var sortUrl: String? = null,
|
var sortUrl: String? = null,
|
||||||
var singleUrl: Boolean = false,
|
var singleUrl: Boolean = false,
|
||||||
/*列表规则*/
|
/*列表规则*/
|
||||||
var articleStyle: Int = 0, //列表样式,0,1,2
|
//列表样式,0,1,2
|
||||||
|
var articleStyle: Int = 0,
|
||||||
var ruleArticles: String? = null,
|
var ruleArticles: String? = null,
|
||||||
var ruleNextPage: String? = null,
|
var ruleNextPage: String? = null,
|
||||||
var ruleTitle: String? = null,
|
var ruleTitle: String? = null,
|
||||||
@@ -131,6 +144,14 @@ data class RssSource(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getDisplayVariableComment(otherComment: String): String {
|
||||||
|
return if (variableComment.isNullOrBlank()) {
|
||||||
|
otherComment
|
||||||
|
} else {
|
||||||
|
"${variableComment}\n$otherComment"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
|||||||
@@ -247,7 +247,11 @@ class BookInfoActivity :
|
|||||||
binding.tvToc.text = getString(R.string.toc_s, getString(R.string.loading))
|
binding.tvToc.text = getString(R.string.toc_s, getString(R.string.loading))
|
||||||
}
|
}
|
||||||
chapterList.isNullOrEmpty() -> {
|
chapterList.isNullOrEmpty() -> {
|
||||||
binding.tvToc.text = if (viewModel.isImportBookOnLine) getString(R.string.click_read_button_load) else getString(R.string.toc_s, getString(R.string.error_load_toc))
|
binding.tvToc.text =
|
||||||
|
if (viewModel.isImportBookOnLine) getString(R.string.click_read_button_load) else getString(
|
||||||
|
R.string.toc_s,
|
||||||
|
getString(R.string.error_load_toc)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
viewModel.bookData.value?.let {
|
viewModel.bookData.value?.let {
|
||||||
@@ -358,9 +362,14 @@ class BookInfoActivity :
|
|||||||
|
|
||||||
private fun setSourceVariable() {
|
private fun setSourceVariable() {
|
||||||
launch {
|
launch {
|
||||||
val variable = withContext(IO) { viewModel.bookSource?.getVariable() }
|
val source = viewModel.bookSource
|
||||||
|
if (source == null) {
|
||||||
|
toastOnUi("书源不存在")
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
val variable = withContext(IO) { source.getVariable() }
|
||||||
alert(R.string.set_source_variable) {
|
alert(R.string.set_source_variable) {
|
||||||
setMessage("源变量可在js中通过source.getVariable()获取")
|
setMessage(source.getDisplayVariableComment("源变量可在js中通过source.getVariable()获取"))
|
||||||
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
|
||||||
editView.hint = "source variable"
|
editView.hint = "source variable"
|
||||||
editView.setText(variable)
|
editView.setText(variable)
|
||||||
@@ -379,9 +388,14 @@ class BookInfoActivity :
|
|||||||
|
|
||||||
private fun setBookVariable() {
|
private fun setBookVariable() {
|
||||||
launch {
|
launch {
|
||||||
|
val source = viewModel.bookSource
|
||||||
|
if (source == null) {
|
||||||
|
toastOnUi("书源不存在")
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
val variable = withContext(IO) { viewModel.bookData.value?.getVariable("custom") }
|
val variable = withContext(IO) { viewModel.bookData.value?.getVariable("custom") }
|
||||||
alert(R.string.set_source_variable) {
|
alert(R.string.set_source_variable) {
|
||||||
setMessage("""书籍变量可在js中通过book.getVariable("custom")获取""")
|
setMessage(source.getDisplayVariableComment("""书籍变量可在js中通过book.getVariable("custom")获取"""))
|
||||||
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
|
||||||
editView.hint = "book variable"
|
editView.hint = "book variable"
|
||||||
editView.setText(variable)
|
editView.setText(variable)
|
||||||
|
|||||||
@@ -17,11 +17,8 @@ import io.legado.app.lib.dialogs.alert
|
|||||||
import io.legado.app.lib.theme.accentColor
|
import io.legado.app.lib.theme.accentColor
|
||||||
import io.legado.app.ui.login.SourceLoginActivity
|
import io.legado.app.ui.login.SourceLoginActivity
|
||||||
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity
|
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity
|
||||||
import io.legado.app.utils.StartActivityContract
|
import io.legado.app.utils.*
|
||||||
import io.legado.app.utils.gone
|
|
||||||
import io.legado.app.utils.startActivity
|
|
||||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||||
import io.legado.app.utils.visible
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
@@ -106,9 +103,14 @@ class RssSortActivity : VMBaseActivity<ActivityRssArtivlesBinding, RssSortViewMo
|
|||||||
|
|
||||||
private fun setSourceVariable() {
|
private fun setSourceVariable() {
|
||||||
launch {
|
launch {
|
||||||
val variable = withContext(Dispatchers.IO) { viewModel.rssSource?.getVariable() }
|
val source = viewModel.rssSource
|
||||||
|
if (source == null) {
|
||||||
|
toastOnUi("源不存在")
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
val variable = withContext(Dispatchers.IO) { source.getVariable() }
|
||||||
alert(R.string.set_source_variable) {
|
alert(R.string.set_source_variable) {
|
||||||
setMessage("源变量可在js中通过source.getVariable()获取")
|
setMessage(source.getDisplayVariableComment("源变量可在js中通过source.getVariable()获取"))
|
||||||
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
|
||||||
editView.hint = "source variable"
|
editView.hint = "source variable"
|
||||||
editView.setText(variable)
|
editView.setText(variable)
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
|
||||||
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
|
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
|
||||||
url?.let {
|
url?.let {
|
||||||
return shouldOverrideUrlLoading(Uri.parse(it))
|
return shouldOverrideUrlLoading(Uri.parse(it))
|
||||||
|
|||||||
Reference in New Issue
Block a user