Merge pull request #3456 from okou19900722/feature/3454
书源管理界面添加筛选方式--是否开启发现。 resolved #3454
This commit is contained in:
@@ -111,6 +111,20 @@ interface BookSourceDao {
|
||||
)
|
||||
fun flowNoGroup(): Flow<List<BookSourcePart>>
|
||||
|
||||
@Query(
|
||||
"""select bookSourceUrl, bookSourceName, bookSourceGroup, customOrder, enabled, enabledExplore,
|
||||
trim(loginUrl) <> '' hasLoginUrl, lastUpdateTime, respondTime, weight, trim(exploreUrl) <> '' hasExploreUrl
|
||||
from book_sources where enabledExplore = 1 order by customOrder asc"""
|
||||
)
|
||||
fun flowEnabledExplore(): Flow<List<BookSourcePart>>
|
||||
|
||||
@Query(
|
||||
"""select bookSourceUrl, bookSourceName, bookSourceGroup, customOrder, enabled, enabledExplore,
|
||||
trim(loginUrl) <> '' hasLoginUrl, lastUpdateTime, respondTime, weight, trim(exploreUrl) <> '' hasExploreUrl
|
||||
from book_sources where enabledExplore = 0 order by customOrder asc"""
|
||||
)
|
||||
fun flowDisabledExplore(): Flow<List<BookSourcePart>>
|
||||
|
||||
@Query(
|
||||
"""select * from book_sources
|
||||
where enabledExplore = 1
|
||||
@@ -193,6 +207,12 @@ interface BookSourceDao {
|
||||
@get:Query("select * from book_sources where bookSourceGroup is null or bookSourceGroup = '' or bookSourceGroup like '%未分组%'")
|
||||
val allNoGroup: List<BookSource>
|
||||
|
||||
@get:Query("select * from book_sources where enabledExplore = 1 order by customOrder")
|
||||
val allEnabledExplore: List<BookSource>
|
||||
|
||||
@get:Query("select * from book_sources where enabledExplore = 0 order by customOrder")
|
||||
val allDisabledExplore: List<BookSource>
|
||||
|
||||
@get:Query("select * from book_sources where loginUrl is not null and loginUrl != ''")
|
||||
val allLogin: List<BookSource>
|
||||
|
||||
|
||||
@@ -217,6 +217,14 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
searchView.setQuery(getString(R.string.no_group), true)
|
||||
}
|
||||
|
||||
R.id.menu_enabled_explore_group -> {
|
||||
searchView.setQuery(getString(R.string.enabled_explore), true)
|
||||
}
|
||||
|
||||
R.id.menu_disabled_explore_group -> {
|
||||
searchView.setQuery(getString(R.string.disabled_explore), true)
|
||||
}
|
||||
|
||||
R.id.menu_help -> showHelp()
|
||||
}
|
||||
if (item.groupId == R.id.source_group) {
|
||||
@@ -272,6 +280,14 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
appDb.bookSourceDao.flowNoGroup()
|
||||
}
|
||||
|
||||
searchKey == getString(R.string.enabled_explore) -> {
|
||||
appDb.bookSourceDao.flowEnabledExplore()
|
||||
}
|
||||
|
||||
searchKey == getString(R.string.disabled_explore) -> {
|
||||
appDb.bookSourceDao.flowDisabledExplore()
|
||||
}
|
||||
|
||||
searchKey.startsWith("group:") -> {
|
||||
val key = searchKey.substringAfter("group:")
|
||||
appDb.bookSourceDao.flowGroupSearch(key)
|
||||
|
||||
@@ -191,6 +191,14 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
|
||||
appDb.bookSourceDao.allNoGroup
|
||||
}
|
||||
|
||||
searchKey == appCtx.getString(R.string.enabled_explore) -> {
|
||||
appDb.bookSourceDao.allEnabledExplore
|
||||
}
|
||||
|
||||
searchKey == appCtx.getString(R.string.disabled_explore) -> {
|
||||
appDb.bookSourceDao.allDisabledExplore
|
||||
}
|
||||
|
||||
searchKey.startsWith("group:") -> {
|
||||
val key = searchKey.substringAfter("group:")
|
||||
appDb.bookSourceDao.groupSearch(key)
|
||||
|
||||
Reference in New Issue
Block a user