pull/32/head
kunfei 5 years ago
parent cc51eaf123
commit d0381ed786
  1. 12
      app/src/main/java/io/legado/app/ui/bookinfo/BookInfoEditActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/bookinfo/BookInfoEditViewModel.kt

@ -11,14 +11,16 @@ import io.legado.app.utils.getViewModel
import io.legado.app.utils.toast
import kotlinx.android.synthetic.main.activity_book_info_edit.*
class BookInfoEditActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_book_info_edit) {
override val viewModel: BookInfoViewModel
get() = getViewModel(BookInfoViewModel::class.java)
class BookInfoEditActivity : VMBaseActivity<BookInfoEditViewModel>(R.layout.activity_book_info_edit) {
override val viewModel: BookInfoEditViewModel
get() = getViewModel(BookInfoEditViewModel::class.java)
override fun onActivityCreated(savedInstanceState: Bundle?) {
viewModel.bookData.observe(this, Observer { upView(it) })
intent.getStringExtra("bookUrl")?.let {
viewModel.loadBook(it)
if (viewModel.bookData.value == null) {
intent.getStringExtra("bookUrl")?.let {
viewModel.loadBook(it)
}
}
}

@ -6,7 +6,7 @@ import io.legado.app.App
import io.legado.app.base.BaseViewModel
import io.legado.app.data.entities.Book
class BookInfoViewModel(application: Application) : BaseViewModel(application) {
class BookInfoEditViewModel(application: Application) : BaseViewModel(application) {
val bookData = MutableLiveData<Book>()
Loading…
Cancel
Save