pull/2274/head
kunfei 2 years ago
parent 1ba3d30785
commit 8e5d9960b7
  1. 8
      app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt
  2. 18
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt

@ -86,7 +86,7 @@ interface BookSourceDao {
fun flowGroupExplore(key: String): Flow<List<BookSource>> fun flowGroupExplore(key: String): Flow<List<BookSource>>
@Query("select distinct bookSourceGroup from book_sources where trim(bookSourceGroup) <> ''") @Query("select distinct bookSourceGroup from book_sources where trim(bookSourceGroup) <> ''")
fun flowGroupsUnDeal(): Flow<List<String>> fun flowGroupsUnProcessed(): Flow<List<String>>
@Query("select distinct bookSourceGroup from book_sources where enabled = 1 and trim(bookSourceGroup) <> ''") @Query("select distinct bookSourceGroup from book_sources where enabled = 1 and trim(bookSourceGroup) <> ''")
fun flowGroupEnabled(): Flow<List<String>> fun flowGroupEnabled(): Flow<List<String>>
@ -132,7 +132,7 @@ interface BookSourceDao {
val allTextEnabled: List<BookSource> val allTextEnabled: List<BookSource>
@Query("select distinct bookSourceGroup from book_sources where trim(bookSourceGroup) <> ''") @Query("select distinct bookSourceGroup from book_sources where trim(bookSourceGroup) <> ''")
fun getAllGroupsUnDeal(): List<String> fun getAllGroupsUnProcessed(): List<String>
@Query("select * from book_sources where bookSourceUrl = :key") @Query("select * from book_sources where bookSourceUrl = :key")
fun getBookSource(key: String): BookSource? fun getBookSource(key: String): BookSource?
@ -172,11 +172,11 @@ interface BookSourceDao {
val allGroups: List<String> val allGroups: List<String>
get() { get() {
return dealGroups(getAllGroupsUnDeal()) return dealGroups(getAllGroupsUnProcessed())
} }
fun flowGroups(): Flow<List<String>> { fun flowGroups(): Flow<List<String>> {
return flowGroupsUnDeal().map { list -> return flowGroupsUnProcessed().map { list ->
dealGroups(list) dealGroups(list)
} }
} }

@ -506,13 +506,21 @@ class BookSourceEditActivity :
SelectItem("书源教程", "ruleHelp"), SelectItem("书源教程", "ruleHelp"),
SelectItem("js教程", "jsHelp"), SelectItem("js教程", "jsHelp"),
SelectItem("正则教程", "regexHelp"), SelectItem("正则教程", "regexHelp"),
SelectItem("选择文件", "selectFile"),
) )
val view = window.decorView.findFocus() val view = window.decorView.findFocus()
if (view is EditText && view.getTag(R.id.tag) == "bookSourceGroup") { if (view is EditText) {
helpActions.add( when (view.getTag(R.id.tag)) {
SelectItem("插入分组", "addGroup") "bookSourceGroup" -> {
) helpActions.add(
SelectItem("插入分组", "addGroup")
)
}
else -> {
helpActions.add(
SelectItem("选择文件", "selectFile")
)
}
}
} }
return helpActions return helpActions
} }

Loading…
Cancel
Save