pull/1395/head
gedoor 3 years ago
parent c9d2fdde10
commit 8a071a2ea2
  1. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  2. 11
      app/src/main/java/io/legado/app/ui/widget/code/CodeViewExtensions.kt

@ -41,7 +41,7 @@ class BookSourceEditActivity :
override val binding by viewBinding(ActivityBookSourceEditBinding::inflate)
override val viewModel by viewModels<BookSourceEditViewModel>()
private val adapter = BookSourceEditAdapter()
private val adapter by lazy { BookSourceEditAdapter() }
private val sourceEntities: ArrayList<EditEntity> = ArrayList()
private val searchEntities: ArrayList<EditEntity> = ArrayList()
private val findEntities: ArrayList<EditEntity> = ArrayList()

@ -2,8 +2,11 @@
package io.legado.app.ui.widget.code
import android.graphics.Color
import android.content.Context
import android.widget.ArrayAdapter
import io.legado.app.R
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.secondaryTextColor
import splitties.init.appCtx
import java.util.regex.Pattern
@ -21,6 +24,10 @@ fun CodeView.addJsonPattern() {
}
fun CodeView.addJsPattern() {
addSyntaxPattern(wrapPattern, Color.DKGRAY)
addSyntaxPattern(wrapPattern, appCtx.secondaryTextColor)
addSyntaxPattern(jsPattern, appCtx.accentColor)
}
fun Context.arrayAdapter(keywords: Array<String>): ArrayAdapter<String> {
return ArrayAdapter(this, R.layout.item_text, R.id.text_view, keywords)
}
Loading…
Cancel
Save