pull/35/head^2
kunfei 5 years ago
parent b5be12b231
commit a62b75832b
  1. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt

@ -54,7 +54,7 @@ class BookSourceEditActivity :
viewModel.sourceLiveData.observe(this, Observer { viewModel.sourceLiveData.observe(this, Observer {
upRecyclerView(it) upRecyclerView(it)
}) })
viewModel.setBookSource(intent.getStringExtra("data")) viewModel.initData(intent)
} }
override fun onDestroy() { override fun onDestroy() {

@ -3,6 +3,7 @@ package io.legado.app.ui.book.source.edit
import android.app.Application import android.app.Application
import android.content.ClipboardManager import android.content.ClipboardManager
import android.content.Context import android.content.Context
import android.content.Intent
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import io.legado.app.App import io.legado.app.App
import io.legado.app.base.BaseViewModel import io.legado.app.base.BaseViewModel
@ -14,8 +15,9 @@ class BookSourceEditViewModel(application: Application) : BaseViewModel(applicat
val sourceLiveData: MutableLiveData<BookSource> = MutableLiveData() val sourceLiveData: MutableLiveData<BookSource> = MutableLiveData()
var oldSourceUrl: String? = null var oldSourceUrl: String? = null
fun setBookSource(key: String?) { fun initData(intent: Intent) {
execute { execute {
val key = intent.getStringExtra("data")
var source: BookSource? = null var source: BookSource? = null
if (key != null) { if (key != null) {
source = App.db.bookSourceDao().getBookSource(key) source = App.db.bookSourceDao().getBookSource(key)

Loading…
Cancel
Save