feat: 优化代码

pull/106/head
kunfei 5 years ago
parent 2844bd4c21
commit 5e7f27f56b
  1. 6
      app/src/main/java/io/legado/app/help/BookHelp.kt
  2. 7
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt

@ -257,9 +257,6 @@ object BookHelp {
} }
} }
} }
if (!content.substringBefore("\n").contains(title)) {
c = title + "\n" + c
}
for (item in replaceRules) { for (item in replaceRules) {
item.pattern.let { item.pattern.let {
if (it.isNotEmpty()) { if (it.isNotEmpty()) {
@ -271,6 +268,9 @@ object BookHelp {
} }
} }
} }
if (!content.substringBefore("\n").contains(title)) {
c = title + "\n" + c
}
when (AppConfig.chineseConverterType) { when (AppConfig.chineseConverterType) {
1 -> c = ZhConvertBootstrap.newInstance().toSimple(c) 1 -> c = ZhConvertBootstrap.newInstance().toSimple(c)
2 -> c = ZhConvertBootstrap.newInstance().toTraditional(c) 2 -> c = ZhConvertBootstrap.newInstance().toTraditional(c)

@ -18,14 +18,17 @@ import io.legado.app.utils.getPrefBoolean
class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, attrs) { class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
var selectAble = context.getPrefBoolean(PreferKey.textSelectAble)
private val selectedPaint by lazy { private val selectedPaint by lazy {
Paint().apply { Paint().apply {
color = context.getCompatColor(R.color.btn_bg_press_2) color = context.getCompatColor(R.color.btn_bg_press_2)
style = Paint.Style.FILL style = Paint.Style.FILL
} }
} }
var selectAble = context.getPrefBoolean(PreferKey.textSelectAble)
var selectStartLine = 0
var selectStartChar = 0
var selectEndLine = 0
var selectEndChar = 0
private var textPage: TextPage? = null private var textPage: TextPage? = null
fun setContent(textPage: TextPage?) { fun setContent(textPage: TextPage?) {

Loading…
Cancel
Save