diff --git a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt index 9ae95e166..ecb8c9592 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt @@ -15,7 +15,8 @@ import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.toast class BookInfoEditActivity : - VMBaseActivity(R.layout.activity_book_info_edit) { + VMBaseActivity(R.layout.activity_book_info_edit), + ChangeCoverDialog.CallBack { override val viewModel: BookInfoEditViewModel get() = getViewModel(BookInfoEditViewModel::class.java) diff --git a/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverDialog.kt b/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverDialog.kt index 325e49b8c..0deebf906 100644 --- a/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverDialog.kt +++ b/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverDialog.kt @@ -30,6 +30,7 @@ class ChangeCoverDialog : DialogFragment() { } } + private var callBack: CallBack? = null private lateinit var viewModel: ChangeCoverViewModel private lateinit var adapter: CoverAdapter @@ -51,10 +52,22 @@ class ChangeCoverDialog : DialogFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + callBack = activity as? CallBack tool_bar.setTitle(R.string.change_cover_source) + arguments?.let { bundle -> + bundle.getString("name")?.let { + viewModel.name = it + } + bundle.getString("author")?.let { + viewModel.author = it + } + } recycler_view.layoutManager = GridLayoutManager(requireContext(), 3) adapter = CoverAdapter(requireContext()) recycler_view.adapter = adapter } + interface CallBack { + + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt b/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt index efb0212f9..5f12c56b2 100644 --- a/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt @@ -5,5 +5,8 @@ import io.legado.app.base.BaseViewModel class ChangeCoverViewModel(application: Application) : BaseViewModel(application) { + var name: String = "" + var author: String = "" + } \ No newline at end of file