From 77eb21b1adee66ff7308b55cc0a6b4833494498b Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 31 Aug 2019 17:45:58 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/booksource/BookSourceActivity.kt | 9 ++------- .../io/legado/app/ui/booksource/BookSourceAdapter.kt | 1 - .../io/legado/app/ui/booksource/BookSourceViewModel.kt | 7 +++++++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt index 3486589a8..c1a0c6e36 100644 --- a/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.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(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) { diff --git a/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt index 1d6869cb4..a89a01b68 100644 --- a/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt @@ -92,7 +92,6 @@ class BookSourceAdapter : PagedListAdapter