mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -18,7 +18,7 @@ import splitties.views.onLongClick
|
||||
|
||||
class ChangeChapterSourceAdapter(
|
||||
context: Context,
|
||||
val viewModel: ChangeBookSourceViewModel,
|
||||
val viewModel: ChangeChapterSourceViewModel,
|
||||
val callBack: CallBack
|
||||
) : DiffRecyclerAdapter<SearchBook, ItemChangeSourceBinding>(context) {
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import kotlinx.coroutines.launch
|
||||
|
||||
class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_change_source),
|
||||
Toolbar.OnMenuItemClickListener,
|
||||
ChangeBookSourceAdapter.CallBack {
|
||||
ChangeChapterSourceAdapter.CallBack {
|
||||
|
||||
constructor(name: String, author: String) : this() {
|
||||
arguments = Bundle().apply {
|
||||
@@ -45,8 +45,8 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_change_so
|
||||
private val binding by viewBinding(DialogChangeSourceBinding::bind)
|
||||
private val groups = linkedSetOf<String>()
|
||||
private val callBack: CallBack? get() = activity as? CallBack
|
||||
private val viewModel: ChangeBookSourceViewModel by viewModels()
|
||||
private val adapter by lazy { ChangeBookSourceAdapter(requireContext(), viewModel, this) }
|
||||
private val viewModel: ChangeChapterSourceViewModel by viewModels()
|
||||
private val adapter by lazy { ChangeChapterSourceAdapter(requireContext(), viewModel, this) }
|
||||
private val editSourceResult =
|
||||
registerForActivityResult(StartActivityContract(BookSourceEditActivity::class.java)) {
|
||||
viewModel.startSearch()
|
||||
|
||||
@@ -38,6 +38,7 @@ import io.legado.app.receiver.TimeBatteryReceiver
|
||||
import io.legado.app.service.BaseReadAloudService
|
||||
import io.legado.app.ui.about.AppLogDialog
|
||||
import io.legado.app.ui.book.changesource.ChangeBookSourceDialog
|
||||
import io.legado.app.ui.book.changesource.ChangeChapterSourceDialog
|
||||
import io.legado.app.ui.book.read.config.*
|
||||
import io.legado.app.ui.book.read.config.BgTextConfigDialog.Companion.BG_COLOR
|
||||
import io.legado.app.ui.book.read.config.BgTextConfigDialog.Companion.TEXT_COLOR
|
||||
@@ -245,7 +246,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
R.id.menu_chapter_change_source -> {
|
||||
binding.readMenu.runMenuOut()
|
||||
ReadBook.book?.let {
|
||||
showDialogFragment(ChangeBookSourceDialog(it.name, it.author))
|
||||
showDialogFragment(ChangeChapterSourceDialog(it.name, it.author))
|
||||
}
|
||||
}
|
||||
R.id.menu_refresh_dur -> {
|
||||
|
||||
Reference in New Issue
Block a user