pull/32/head
kunfei 5 years ago
parent 3653599836
commit 77eb21b1ad
  1. 9
      app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt
  2. 1
      app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt
  3. 7
      app/src/main/java/io/legado/app/ui/booksource/BookSourceViewModel.kt

@ -4,7 +4,6 @@ import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.appcompat.widget.SearchView
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
@ -125,15 +124,11 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
}
override fun del(bookSource: BookSource) {
launch(IO) { App.db.bookSourceDao().delete(bookSource) }
}
override fun update(bookSource: BookSource) {
launch(IO) { App.db.bookSourceDao().update(bookSource) }
viewModel.del(bookSource)
}
override fun update(vararg bookSource: BookSource) {
launch(IO) { App.db.bookSourceDao().update(*bookSource) }
viewModel.update(*bookSource)
}
override fun edit(bookSource: BookSource) {

@ -92,7 +92,6 @@ class BookSourceAdapter : PagedListAdapter<BookSource, BookSourceAdapter.MyViewH
fun upCount(count: Int)
fun del(bookSource: BookSource)
fun edit(bookSource: BookSource)
fun update(bookSource: BookSource)
fun update(vararg bookSource: BookSource)
fun topSource(bookSource: BookSource)
}

@ -16,4 +16,11 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
}
}
fun del(bookSource: BookSource) {
execute { App.db.bookSourceDao().delete(bookSource) }
}
fun update(vararg bookSource: BookSource) {
execute { App.db.bookSourceDao().update(*bookSource) }
}
}
Loading…
Cancel
Save