|
@@ -9,12 +9,15 @@ import android.view.ViewGroup
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import io.legado.app.R
|
|
import io.legado.app.R
|
|
|
import io.legado.app.databinding.ItemSourceEditBinding
|
|
import io.legado.app.databinding.ItemSourceEditBinding
|
|
|
|
|
+import io.legado.app.help.config.AppConfig
|
|
|
import io.legado.app.ui.widget.code.addJsPattern
|
|
import io.legado.app.ui.widget.code.addJsPattern
|
|
|
import io.legado.app.ui.widget.code.addJsonPattern
|
|
import io.legado.app.ui.widget.code.addJsonPattern
|
|
|
import io.legado.app.ui.widget.code.addLegadoPattern
|
|
import io.legado.app.ui.widget.code.addLegadoPattern
|
|
|
|
|
|
|
|
class BookSourceEditAdapter : RecyclerView.Adapter<BookSourceEditAdapter.MyViewHolder>() {
|
|
class BookSourceEditAdapter : RecyclerView.Adapter<BookSourceEditAdapter.MyViewHolder>() {
|
|
|
|
|
|
|
|
|
|
+ val editEntityMaxLine = AppConfig.sourceEditMaxLine
|
|
|
|
|
+
|
|
|
var editEntities: ArrayList<EditEntity> = ArrayList()
|
|
var editEntities: ArrayList<EditEntity> = ArrayList()
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
set(value) {
|
|
set(value) {
|
|
@@ -39,10 +42,12 @@ class BookSourceEditAdapter : RecyclerView.Adapter<BookSourceEditAdapter.MyViewH
|
|
|
return editEntities.size
|
|
return editEntities.size
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- class MyViewHolder(val binding: ItemSourceEditBinding) : RecyclerView.ViewHolder(binding.root) {
|
|
|
|
|
|
|
+ inner class MyViewHolder(val binding: ItemSourceEditBinding) :
|
|
|
|
|
+ RecyclerView.ViewHolder(binding.root) {
|
|
|
|
|
|
|
|
fun bind(editEntity: EditEntity) = binding.run {
|
|
fun bind(editEntity: EditEntity) = binding.run {
|
|
|
editText.setTag(R.id.tag, editEntity.key)
|
|
editText.setTag(R.id.tag, editEntity.key)
|
|
|
|
|
+ editText.maxLines = editEntityMaxLine
|
|
|
if (editText.getTag(R.id.tag1) == null) {
|
|
if (editText.getTag(R.id.tag1) == null) {
|
|
|
val listener = object : View.OnAttachStateChangeListener {
|
|
val listener = object : View.OnAttachStateChangeListener {
|
|
|
override fun onViewAttachedToWindow(v: View) {
|
|
override fun onViewAttachedToWindow(v: View) {
|