Merge pull request #38 from gedoor/master

merge
pull/392/head
口口吕 4 years ago committed by GitHub
commit 4404f31759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/src/main/assets/updateLog.md
  2. 33
      app/src/main/java/io/legado/app/api/ReaderProvider.kt
  3. 6
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -3,6 +3,12 @@
* 关注合作公众号 **[小说拾遗]()** 获取好看的小说。
- 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。
**2020/09/18**
* 解决正文替换{{title}}问题
* 修复共用布局配置不能读取的问题
* 添加自定义源分组功能 by KKL369
* 解决跨进程调用ReaderProvider出现CursorIndexOutOfBoundsException问题
**2020/09/17**
* 优化正文搜索文字颜色
* 优化书源校验 by KKL369

@ -7,10 +7,7 @@ import android.content.ContentProvider
import android.content.ContentResolver
import android.content.ContentValues
import android.content.UriMatcher
import android.database.CharArrayBuffer
import android.database.ContentObserver
import android.database.Cursor
import android.database.DataSetObserver
import android.database.*
import android.net.Uri
import android.os.Bundle
import com.google.gson.Gson
@ -116,33 +113,15 @@ class ReaderProvider : ContentProvider() {
*
* Only getString() makes sense.
*/
private class SimpleCursor(data: ReturnData?) : Cursor {
private class SimpleCursor(data: ReturnData?) : MatrixCursor(arrayOf("result"), 1) {
private val mData: String = Gson().toJson(data)
override fun getCount() = 1
override fun getPosition() = 0
override fun move(i: Int) = true
override fun moveToPosition(i: Int) = true
override fun moveToFirst() = true
override fun moveToLast() = true
override fun moveToNext() = true
override fun moveToPrevious() = true
override fun isFirst() = true
override fun isLast() = true
override fun isBeforeFirst() = true
init {
addRow(arrayOf(mData))
}
override fun isAfterLast() = true
override fun getCount() = 1
override fun getColumnIndex(s: String) = 0

@ -335,15 +335,15 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
}
} ?: ""
if (jsEval is String) {
evalMatcher.appendReplacement(stringBuffer, jsEval)
evalMatcher.appendReplacement(stringBuffer, Pattern.quote(jsEval))
} else if (jsEval is Double && jsEval % 1.0 == 0.0) {
evalMatcher.appendReplacement(stringBuffer, String.format("%.0f", jsEval))
} else {
evalMatcher.appendReplacement(stringBuffer, jsEval.toString())
evalMatcher.appendReplacement(stringBuffer, Pattern.quote(jsEval.toString()))
}
}
evalMatcher.appendTail(stringBuffer)
val replaceRegex = Pattern.quote(stringBuffer.toString())
val replaceRegex = stringBuffer.toString()
if (replaceRegex.isNotEmpty()) {
vResult = if (rule.replaceFirst) {
val pattern = Pattern.compile(replaceRegex)

Loading…
Cancel
Save