pull/53/head
kunfei 5 years ago
parent 92d40f7336
commit e3eb5195c2
  1. 3
      app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt
  2. 13
      app/src/main/java/io/legado/app/ui/changecover/ChangeCoverDialog.kt
  3. 3
      app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt

@ -15,7 +15,8 @@ import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.toast
class BookInfoEditActivity :
VMBaseActivity<BookInfoEditViewModel>(R.layout.activity_book_info_edit) {
VMBaseActivity<BookInfoEditViewModel>(R.layout.activity_book_info_edit),
ChangeCoverDialog.CallBack {
override val viewModel: BookInfoEditViewModel
get() = getViewModel(BookInfoEditViewModel::class.java)

@ -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 {
}
}

@ -5,5 +5,8 @@ import io.legado.app.base.BaseViewModel
class ChangeCoverViewModel(application: Application) : BaseViewModel(application) {
var name: String = ""
var author: String = ""
}
Loading…
Cancel
Save