updatetime 和 comment 优化

当书源有改动时更新书源的lastupdatetime
改变booksourcecomment位置到booksourcegroup之下
pull/370/head
Jason Yao 4 years ago
parent e9d597c1de
commit 609fb92aee
  1. 2
      app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt

@ -11,7 +11,7 @@ interface BookSourceDao {
@Query("select * from book_sources order by customOrder asc")
fun liveDataAll(): LiveData<List<BookSource>>
@Query("select * from book_sources where bookSourceName like :searchKey or bookSourceGroup like :searchKey or bookSourceUrl like :searchKey order by customOrder asc")
@Query("select * from book_sources where bookSourceName like :searchKey or bookSourceGroup like :searchKey or bookSourceUrl like :searchKey or bookSourceComment like :searchKey order by customOrder asc")
fun liveDataSearch(searchKey: String = ""): LiveData<List<BookSource>>
@Query("select * from book_sources where enabled = 1 order by customOrder asc")

@ -63,6 +63,9 @@ class BookSourceEditActivity :
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_save -> getSource().let { source ->
if (!source.equal(viewModel.bookSource ?: BookSource())){
source.lastUpdateTime = System.currentTimeMillis()
}
if (checkSource(source)) {
viewModel.save(source) { setResult(Activity.RESULT_OK); finish() }
}
@ -170,10 +173,11 @@ class BookSourceEditActivity :
add(EditEntity("bookSourceUrl", source?.bookSourceUrl, R.string.source_url))
add(EditEntity("bookSourceName", source?.bookSourceName, R.string.source_name))
add(EditEntity("bookSourceGroup", source?.bookSourceGroup, R.string.source_group))
add(EditEntity("bookSourceComment", source?.bookSourceComment, R.string.comment))
add(EditEntity("loginUrl", source?.loginUrl, R.string.login_url))
add(EditEntity("bookUrlPattern", source?.bookUrlPattern, R.string.book_url_pattern))
add(EditEntity("header", source?.header, R.string.source_http_header))
add(EditEntity("bookSourceComment", source?.bookSourceComment, R.string.comment))
}
//搜索
val sr = source?.getSearchRule()

Loading…
Cancel
Save