pull/801/head
gedoor 4 years ago
parent 8234021310
commit fd92efdb1b
  1. 4
      app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt
  2. 8
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  3. 1
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt

@ -63,6 +63,10 @@ interface SearchBookDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insert(vararg searchBook: SearchBook): List<Long>
@Query("delete from searchBooks where name = :name and author = :author")
fun clear(name: String, author: String)
@Query("delete from searchBooks where time < :time")
fun clearExpired(time: Long)
}

@ -84,10 +84,10 @@ class ChangeSourceDialog : BaseDialogFragment(),
binding.toolBar.inflateMenu(R.menu.change_source)
binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
binding.toolBar.menu.findItem(R.id.menu_load_info)?.isChecked =
AppConfig.changeSourceLoadInfo
binding.toolBar.menu.findItem(R.id.menu_load_toc)?.isChecked = AppConfig.changeSourceLoadToc
binding.toolBar.menu.findItem(R.id.menu_load_info)
?.isChecked = AppConfig.changeSourceLoadInfo
binding.toolBar.menu.findItem(R.id.menu_load_toc)
?.isChecked = AppConfig.changeSourceLoadToc
}
private fun initRecyclerView() {

@ -99,6 +99,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
private fun startSearch() {
execute {
App.db.searchBookDao.clear(name, author)
bookSourceList.clear()
if (searchGroup.isBlank()) {
bookSourceList.addAll(App.db.bookSourceDao.allEnabled)

Loading…
Cancel
Save