+2
-2
@@ -1,6 +1,6 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
/local.properties
|
local.properties
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
@@ -12,5 +12,5 @@ node_modules/
|
|||||||
/app/google
|
/app/google
|
||||||
/app/gradle.properties
|
/app/gradle.properties
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.idea/*
|
.idea/
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.room.Entity
|
|||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
|
import io.legado.app.constant.AppLog
|
||||||
import io.legado.app.exception.NoStackTraceException
|
import io.legado.app.exception.NoStackTraceException
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
@@ -84,6 +85,7 @@ data class ReplaceRule(
|
|||||||
try {
|
try {
|
||||||
Pattern.compile(pattern)
|
Pattern.compile(pattern)
|
||||||
} catch (ex: PatternSyntaxException) {
|
} catch (ex: PatternSyntaxException) {
|
||||||
|
AppLog.put(ex.message)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package io.legado.app.data.entities
|
|||||||
|
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import io.legado.app.utils.GSON
|
|
||||||
|
|
||||||
|
|
||||||
@Entity(tableName = "txtTocRules")
|
@Entity(tableName = "txtTocRules")
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ fun Book.getExportFileName(suffix: String): String {
|
|||||||
RhinoScriptEngine.eval(jsStr, bindings).toString() + "." + suffix
|
RhinoScriptEngine.eval(jsStr, bindings).toString() + "." + suffix
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
AppLog.put("导出书名规则错误,使用默认规则\n${it.localizedMessage}", it)
|
AppLog.put("导出书名规则错误,使用默认规则\n${it.localizedMessage}", it)
|
||||||
}.getOrDefault("${name} 作者:${getRealAuthor()}.$suffix")
|
}.getOrDefault("$name 作者:${getRealAuthor()}.$suffix")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package io.legado.app.help.http
|
package io.legado.app.help.http
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import io.legado.app.help.http.CookieManager.cookieJarHeader
|
import io.legado.app.help.http.CookieManager.cookieJarHeader
|
||||||
import io.legado.app.help.http.SSLHelper.unsafeTrustManager
|
import io.legado.app.help.http.SSLHelper.unsafeTrustManager
|
||||||
import okhttp3.Call
|
import okhttp3.Call
|
||||||
@@ -797,6 +799,7 @@ class ObsoleteUrlFactory(private var client: OkHttpClient) : URLStreamHandlerFac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Should only be invoked on Java 8+ or Android API 24+.
|
// Should only be invoked on Java 8+ or Android API 24+.
|
||||||
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
override fun getContentLengthLong(): Long {
|
override fun getContentLengthLong(): Long {
|
||||||
return delegate.contentLengthLong
|
return delegate.contentLengthLong
|
||||||
}
|
}
|
||||||
@@ -846,6 +849,7 @@ class ObsoleteUrlFactory(private var client: OkHttpClient) : URLStreamHandlerFac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Should only be invoked on Java 8+ or Android API 24+.
|
// Should only be invoked on Java 8+ or Android API 24+.
|
||||||
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
override fun getHeaderFieldLong(field: String, defaultValue: Long): Long {
|
override fun getHeaderFieldLong(field: String, defaultValue: Long): Long {
|
||||||
return delegate.getHeaderFieldLong(field, defaultValue)
|
return delegate.getHeaderFieldLong(field, defaultValue)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ open class Preference(context: Context, attrs: AttributeSet) :
|
|||||||
val tvTitle = viewHolder.findViewById(R.id.preference_title) as? TextView
|
val tvTitle = viewHolder.findViewById(R.id.preference_title) as? TextView
|
||||||
tvTitle?.let {
|
tvTitle?.let {
|
||||||
tvTitle.text = title
|
tvTitle.text = title
|
||||||
tvTitle.isVisible = title != null && title.isNotEmpty()
|
tvTitle.isVisible = !title.isNullOrEmpty()
|
||||||
}
|
}
|
||||||
val tvSummary = viewHolder.findViewById(R.id.preference_desc) as? TextView
|
val tvSummary = viewHolder.findViewById(R.id.preference_desc) as? TextView
|
||||||
tvSummary?.let {
|
tvSummary?.let {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package io.legado.app.model
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.IntentAction
|
import io.legado.app.constant.IntentAction
|
||||||
import io.legado.app.data.entities.BookSource
|
|
||||||
import io.legado.app.data.entities.BookSourcePart
|
import io.legado.app.data.entities.BookSourcePart
|
||||||
import io.legado.app.help.CacheManager
|
import io.legado.app.help.CacheManager
|
||||||
import io.legado.app.help.IntentData
|
import io.legado.app.help.IntentData
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class AnalyzeByJSonPath(json: Any) {
|
|||||||
val results = ArrayList<ArrayList<*>>()
|
val results = ArrayList<ArrayList<*>>()
|
||||||
for (rl in rules) {
|
for (rl in rules) {
|
||||||
val temp = getList(rl)
|
val temp = getList(rl)
|
||||||
if (temp != null && temp.isNotEmpty()) {
|
if (!temp.isNullOrEmpty()) {
|
||||||
results.add(temp)
|
results.add(temp)
|
||||||
if (temp.isNotEmpty() && ruleAnalyzes.elementsType == "||") {
|
if (temp.isNotEmpty() && ruleAnalyzes.elementsType == "||") {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ class AnalyzeByJSoup(doc: Any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val len = elements.size
|
val len = elements.size
|
||||||
val lastIndexes = (indexDefault.size - 1).takeIf { it != -1 } ?: indexes.size - 1
|
val lastIndexes = (indexDefault.size - 1).takeIf { it != -1 } ?: (indexes.size - 1)
|
||||||
val indexSet = mutableSetOf<Int>()
|
val indexSet = mutableSetOf<Int>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class AnalyzeByXPath(doc: Any) {
|
|||||||
val results = ArrayList<List<JXNode>>()
|
val results = ArrayList<List<JXNode>>()
|
||||||
for (rl in rules) {
|
for (rl in rules) {
|
||||||
val temp = getElements(rl)
|
val temp = getElements(rl)
|
||||||
if (temp != null && temp.isNotEmpty()) {
|
if (!temp.isNullOrEmpty()) {
|
||||||
results.add(temp)
|
results.add(temp)
|
||||||
if (temp.isNotEmpty() && ruleAnalyzes.elementsType == "||") {
|
if (temp.isNotEmpty() && ruleAnalyzes.elementsType == "||") {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import io.legado.app.model.analyzeRule.AnalyzeUrl
|
|||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.apache.commons.text.StringEscapeUtils
|
import org.apache.commons.text.StringEscapeUtils
|
||||||
import org.jsoup.nodes.Entities
|
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|||||||
@@ -80,9 +80,7 @@ class PdfFile(var book: Book) {
|
|||||||
if (!File(book.coverUrl!!).exists()) {
|
if (!File(book.coverUrl!!).exists()) {
|
||||||
|
|
||||||
FileOutputStream(FileUtils.createFileIfNotExist(book.coverUrl!!)).use { out ->
|
FileOutputStream(FileUtils.createFileIfNotExist(book.coverUrl!!)).use { out ->
|
||||||
openPdfPage(renderer, 0)?.let { cover ->
|
openPdfPage(renderer, 0)?.compress(Bitmap.CompressFormat.JPEG, 90, out)
|
||||||
cover.compress(Bitmap.CompressFormat.JPEG, 90, out)
|
|
||||||
}
|
|
||||||
out.flush()
|
out.flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +157,7 @@ class PdfFile(var book: Book) {
|
|||||||
|
|
||||||
buildString {
|
buildString {
|
||||||
val start = chapter.index * PAGE_SIZE
|
val start = chapter.index * PAGE_SIZE
|
||||||
val end = Math.min((chapter.index + 1) * PAGE_SIZE, renderer.pageCount)
|
val end = ((chapter.index + 1) * PAGE_SIZE).coerceAtMost(renderer.pageCount)
|
||||||
(start until end).forEach {
|
(start until end).forEach {
|
||||||
append("<img src=").append('"').append(it).append('"').append(" >")
|
append("<img src=").append('"').append(it).append('"').append(" >")
|
||||||
.append('\n')
|
.append('\n')
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import io.legado.app.data.entities.BookChapter
|
|||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
import me.ag2s.umdlib.domain.UmdBook
|
import me.ag2s.umdlib.domain.UmdBook
|
||||||
import me.ag2s.umdlib.umd.UmdReader
|
import me.ag2s.umdlib.umd.UmdReader
|
||||||
import splitties.init.appCtx
|
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import io.legado.app.utils.HtmlFormatter
|
|||||||
import io.legado.app.utils.MD5Utils
|
import io.legado.app.utils.MD5Utils
|
||||||
import io.legado.app.utils.NetworkUtils
|
import io.legado.app.utils.NetworkUtils
|
||||||
import io.legado.app.utils.activityPendingIntent
|
import io.legado.app.utils.activityPendingIntent
|
||||||
import io.legado.app.utils.buildMainHandler
|
|
||||||
import io.legado.app.utils.cnCompare
|
import io.legado.app.utils.cnCompare
|
||||||
import io.legado.app.utils.createFolderIfNotExist
|
import io.legado.app.utils.createFolderIfNotExist
|
||||||
import io.legado.app.utils.isContentScheme
|
import io.legado.app.utils.isContentScheme
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package io.legado.app.ui.book.read.page.entities
|
package io.legado.app.ui.book.read.page.entities
|
||||||
|
|
||||||
import android.graphics.Paint.FontMetrics
|
import android.graphics.Paint.FontMetrics
|
||||||
import android.text.TextPaint
|
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import io.legado.app.ui.book.read.page.entities.column.BaseColumn
|
import io.legado.app.ui.book.read.page.entities.column.BaseColumn
|
||||||
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
||||||
import io.legado.app.utils.textHeight
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 行信息
|
* 行信息
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package io.legado.app.ui.book.read.page.entities.column
|
|||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import android.graphics.Path
|
import android.graphics.Path
|
||||||
import android.text.StaticLayout
|
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.adapter.ItemViewHolder
|
import io.legado.app.base.adapter.ItemViewHolder
|
||||||
import io.legado.app.base.adapter.RecyclerAdapter
|
import io.legado.app.base.adapter.RecyclerAdapter
|
||||||
import io.legado.app.data.entities.ReplaceRule
|
|
||||||
import io.legado.app.data.entities.TxtTocRule
|
import io.legado.app.data.entities.TxtTocRule
|
||||||
import io.legado.app.databinding.ItemTxtTocRuleBinding
|
import io.legado.app.databinding.ItemTxtTocRuleBinding
|
||||||
import io.legado.app.lib.theme.backgroundColor
|
import io.legado.app.lib.theme.backgroundColor
|
||||||
|
|||||||
@@ -75,9 +75,6 @@ class RefreshProgressBar @JvmOverloads constructor(
|
|||||||
|
|
||||||
if (secondDurProgress > 0 && secondMaxProgress > 0) {
|
if (secondDurProgress > 0 && secondMaxProgress > 0) {
|
||||||
var secondDur = secondDurProgress
|
var secondDur = secondDurProgress
|
||||||
if (secondDur < 0) {
|
|
||||||
secondDur = 0
|
|
||||||
}
|
|
||||||
if (secondDur > secondMaxProgress) {
|
if (secondDur > secondMaxProgress) {
|
||||||
secondDur = secondMaxProgress
|
secondDur = secondMaxProgress
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ val legadoPattern: Pattern = Pattern.compile("\\|\\||&&|%%|@js:|@Json:|@css:|@@|
|
|||||||
val jsonPattern: Pattern = Pattern.compile("\"[A-Za-z0-9]*?\"\\:|\"|\\{|\\}|\\[|\\]")
|
val jsonPattern: Pattern = Pattern.compile("\"[A-Za-z0-9]*?\"\\:|\"|\\{|\\}|\\[|\\]")
|
||||||
val wrapPattern: Pattern = Pattern.compile("\\\\n")
|
val wrapPattern: Pattern = Pattern.compile("\\\\n")
|
||||||
val operationPattern: Pattern =
|
val operationPattern: Pattern =
|
||||||
Pattern.compile(":|==|>|<|!=|>=|<=|->|=|>|<|%|-|-=|%=|\\+|\\-|\\-=|\\+=|\\^|\\&|\\|::|\\?|\\*")
|
Pattern.compile(":|==|>|<|!=|>=|<=|->|=|%|-|-=|%=|\\+|\\-|\\-=|\\+=|\\^|\\&|\\|::|\\?|\\*")
|
||||||
val jsPattern: Pattern = Pattern.compile("var")
|
val jsPattern: Pattern = Pattern.compile("var")
|
||||||
|
|
||||||
fun CodeView.addLegadoPattern() {
|
fun CodeView.addLegadoPattern() {
|
||||||
|
|||||||
+1
-1
@@ -23,5 +23,5 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('clean', Delete) {
|
tasks.register('clean', Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.layout.buildDirectory
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user