From 862d151365942a6da632641c583cc72de329b98b Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 4 Aug 2019 15:53:13 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt | 2 +- .../main/java/io/legado/app/data/entities/SearchBook.kt | 7 ++++++- app/src/main/java/io/legado/app/model/webbook/BookList.kt | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt b/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt index dfa6794e1..3c3ea9288 100644 --- a/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt @@ -13,7 +13,7 @@ interface SearchBookDao { @Query("SELECT * FROM searchBooks") fun observeAll(): DataSource.Factory - @Query("SELECT name, author, '' bookUrl, '' origin, '' originName, min(time) time, max(intro) intro, max(kind) kind, max(coverUrl) coverUrl, max(latestChapterTitle) latestChapterTitle FROM searchBooks where time >= :time group by name and author") + @Query("SELECT name, author, '' bookUrl, '' origin, '' originName, count(origin) originCount, min(time) time, max(intro) intro, max(kind) kind, max(coverUrl) coverUrl, max(latestChapterTitle) latestChapterTitle FROM searchBooks where time >= :time group by name and author order by bookOrder and originOrder and time") fun observeNew(time: Long): DataSource.Factory diff --git a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt index 8b76eea87..d95c566c0 100644 --- a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt +++ b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt @@ -27,9 +27,14 @@ data class SearchBook( var latestChapterTitle: String? = null, var time: Long = 0L, var variable: String? = null, - var bookInfoHtml: String? = null + var bookInfoHtml: String? = null, + var originOrder: Int = 0, + var bookOrder: Int = 0 ) : Parcelable, BaseBook { + @Ignore + var originCount: Int = 0 + @IgnoredOnParcel @Ignore override var variableMap: HashMap? = null diff --git a/app/src/main/java/io/legado/app/model/webbook/BookList.kt b/app/src/main/java/io/legado/app/model/webbook/BookList.kt index cea3c9f49..295bfa3eb 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookList.kt @@ -132,6 +132,7 @@ object BookList { searchBook.latestChapterTitle = analyzeRule.getString(lastChapter ?: "") SourceDebug.printLog(bookSource.bookSourceUrl, 1, searchBook.latestChapterTitle ?: "") searchBook.time = System.currentTimeMillis() + searchBook.originOrder = bookSource.customOrder return searchBook } } @@ -184,6 +185,7 @@ object BookList { searchBook.latestChapterTitle = analyzeRule.getString(ruleLastChapter) SourceDebug.printLog(bookSource.bookSourceUrl, 1, searchBook.latestChapterTitle ?: "", printLog) searchBook.time = System.currentTimeMillis() + searchBook.originOrder = bookSource.customOrder return searchBook } return null