pull/1155/head
gedoor 3 years ago
parent 1f761a5713
commit 55efc2e67a
  1. 71
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleDialog.kt
  2. 13
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleViewModel.kt
  3. 2
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  4. 2
      app/src/main/res/values-es-rES/strings.xml
  5. 2
      app/src/main/res/values-ja-rJP/strings.xml
  6. 2
      app/src/main/res/values-pt-rBR/strings.xml
  7. 2
      app/src/main/res/values-zh-rHK/strings.xml
  8. 2
      app/src/main/res/values-zh-rTW/strings.xml
  9. 2
      app/src/main/res/values-zh/strings.xml
  10. 2
      app/src/main/res/values/strings.xml

@ -0,0 +1,71 @@
package io.legado.app.ui.association
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.ReplaceRule
import io.legado.app.databinding.DialogRecyclerViewBinding
import io.legado.app.databinding.ItemSourceImportBinding
import io.legado.app.utils.viewbindingdelegate.viewBinding
class ImportReplaceRuleDialog : BaseDialogFragment() {
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
private val viewModel by viewModels<ImportReplaceRuleViewModel>()
lateinit var adapter: SourcesAdapter
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setTitle(R.string.import_replace_rule)
adapter = SourcesAdapter(requireContext())
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
binding.recyclerView.adapter = adapter
adapter.setItems(viewModel.allRules)
}
inner class SourcesAdapter(context: Context) :
RecyclerAdapter<ReplaceRule, ItemSourceImportBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding {
return ItemSourceImportBinding.inflate(inflater, parent, false)
}
override fun convert(
holder: ItemViewHolder,
binding: ItemSourceImportBinding,
item: ReplaceRule,
payloads: MutableList<Any>
) {
TODO("Not yet implemented")
}
override fun registerListener(holder: ItemViewHolder, binding: ItemSourceImportBinding) {
TODO("Not yet implemented")
}
}
}

@ -14,7 +14,9 @@ class ImportReplaceRuleViewModel(app: Application) : BaseViewModel(app) {
val errorLiveData = MutableLiveData<String>()
val successLiveData = MutableLiveData<ArrayList<ReplaceRule>>()
private val allRules = arrayListOf<ReplaceRule>()
val allRules = arrayListOf<ReplaceRule>()
val checkRules = arrayListOf<ReplaceRule>()
val selectStatus = arrayListOf<ReplaceRule>()
fun import(text: String) {
execute {
@ -32,7 +34,16 @@ class ImportReplaceRuleViewModel(app: Application) : BaseViewModel(app) {
}.onError {
errorLiveData.postValue(it.localizedMessage ?: "ERROR")
}.onSuccess {
comparisonSource()
successLiveData.postValue(allRules)
}
}
private fun comparisonSource() {
execute {
allRules.forEach {
}
}
}
}

@ -37,7 +37,7 @@ import io.legado.app.utils.visible
class ImportRssSourceDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
val viewModel: ImportRssSourceViewModel by activityViewModels()
private val viewModel by activityViewModels<ImportRssSourceViewModel>()
lateinit var adapter: SourcesAdapter
override fun onStart() {

@ -234,7 +234,7 @@
<string name="intro_show_null">Descripción: sin introducción</string>
<string name="open_from_other">Abrir libro externo</string>
<string name="origin_show">Origen: %s</string>
<string name="import_replace_rule">Importar reglas locales</string>
<string name="import_replace_rule">Importar reglas replace</string>
<string name="import_replace_rule_on_line">Importar reglas en línea</string>
<string name="check_update_interval">Intervalo de actualizaciones</string>
<string name="bookshelf_px_0">Lista de recientes</string>

@ -234,7 +234,7 @@
<string name="intro_show_null">Description: no introduction</string>
<string name="open_from_other">Open external book</string>
<string name="origin_show">Origin: %s</string>
<string name="import_replace_rule">Import local rules</string>
<string name="import_replace_rule">Import replace rules</string>
<string name="import_replace_rule_on_line">Import online rules</string>
<string name="check_update_interval">Check interval for updates</string>
<string name="bookshelf_px_0">By recent list</string>

@ -234,7 +234,7 @@
<string name="intro_show_null">Descrição: sem introdução</string>
<string name="open_from_other">Abrir o livro externo</string>
<string name="origin_show">Origem: %s</string>
<string name="import_replace_rule">Importar regras locais</string>
<string name="import_replace_rule">Import replace rule</string>
<string name="import_replace_rule_on_line">Importar regras on-line</string>
<string name="check_update_interval">Intervalo de atualizações</string>
<string name="bookshelf_px_0">Lista de recentes</string>

@ -231,7 +231,7 @@
<string name="intro_show_null">簡介: 暫無簡介</string>
<string name="open_from_other">打開外部書籍</string>
<string name="origin_show">來源: %s</string>
<string name="import_replace_rule">本地導入</string>
<string name="import_replace_rule">導入替換規則</string>
<string name="import_replace_rule_on_line">導入在線規則</string>
<string name="check_update_interval">檢查更新間隔</string>
<string name="bookshelf_px_0">按閲讀時間</string>

@ -233,7 +233,7 @@
<string name="intro_show_null">簡介: 暫無簡介</string>
<string name="open_from_other">打開外部書籍</string>
<string name="origin_show">來源: %s</string>
<string name="import_replace_rule">本機匯入</string>
<string name="import_replace_rule">匯入替換規則</string>
<string name="import_replace_rule_on_line">匯入線上規則</string>
<string name="check_update_interval">檢查更新間隔</string>
<string name="bookshelf_px_0">按閱讀時間</string>

@ -233,7 +233,7 @@
<string name="intro_show_null">简介: 暂无简介</string>
<string name="open_from_other">打开外部书籍</string>
<string name="origin_show">来源: %s</string>
<string name="import_replace_rule">本地导入</string>
<string name="import_replace_rule">导入替换规则</string>
<string name="import_replace_rule_on_line">导入在线规则</string>
<string name="check_update_interval">检查更新间隔</string>
<string name="bookshelf_px_0">按阅读时间</string>

@ -234,7 +234,7 @@
<string name="intro_show_null">Description: no introduction</string>
<string name="open_from_other">Open external book</string>
<string name="origin_show">Origin: %s</string>
<string name="import_replace_rule">Import local rules</string>
<string name="import_replace_rule">Import replace rules</string>
<string name="import_replace_rule_on_line">Import online rules</string>
<string name="check_update_interval">Check interval for updates</string>
<string name="bookshelf_px_0">By recent list</string>

Loading…
Cancel
Save