This commit is contained in:
严尚君 2024-01-11 00:27:06 -08:00 committed by GitHub
commit 0b5d575405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 68 additions and 0 deletions

View File

@ -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>

View File

@ -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)

View File

@ -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)

View File

@ -92,6 +92,14 @@
android:id="@+id/menu_group_null"
android:title="@string/no_group" />
<item
android:id="@+id/menu_enabled_explore_group"
android:title="@string/enabled_explore" />
<item
android:id="@+id/menu_disabled_explore_group"
android:title="@string/disabled_explore" />
<group android:id="@+id/source_group">
</group>

View File

@ -729,6 +729,8 @@
<string name="import_old_summary">Seleccione una carpeta de respaldo heredada</string>
<string name="enabled">Activado</string>
<string name="disabled">Desactivado</string>
<string name="enabled_explore">Discovery Enabled</string>
<string name="disabled_explore">Discovery Disabled</string>
<string name="starting_download">Iniciando descarga</string>
<string name="already_in_download">Este libro ya está en la lista de descargas</string>
<string name="click_to_open">Haga clic para abrir</string>

View File

@ -732,6 +732,8 @@
<string name="import_old_summary">Select a legacy backup folder</string>
<string name="enabled">Enabled</string>
<string name="disabled">Disabled</string>
<string name="enabled_explore">Discovery Enabled</string>
<string name="disabled_explore">Discovery Disabled</string>
<string name="starting_download">Starting download</string>
<string name="already_in_download">This book is already in Download list</string>
<string name="click_to_open">Click to open</string>

View File

@ -730,6 +730,8 @@
<string name="import_old_summary">Selecione uma pasta Legado de Backup</string>
<string name="enabled">Ativado</string>
<string name="disabled">Desativado</string>
<string name="enabled_explore">Discovery Enabled</string>
<string name="disabled_explore">Discovery Disabled</string>
<string name="starting_download">Iniciando o download</string>
<string name="already_in_download">Este livro já está na lista de download</string>
<string name="click_to_open">Clique para abrir</string>

View File

@ -730,6 +730,8 @@ Còn </string>
<string name="import_old_summary">Chọn thư mục sao lưu kế thừa</string>
<string name="enabled">Đã bật</string>
<string name="disabled">Đã tắt</string>
<string name="enabled_explore">Discovery Enabled</string>
<string name="disabled_explore">Discovery Disabled</string>
<string name="starting_download">Bắt đầu tải xuống</string>
<string name="already_in_download">Cuốn sách này đã có trong danh sách Download</string>
<string name="click_to_open">Nhấp để mở</string>

View File

@ -723,6 +723,8 @@
<string name="import_old_summary">選擇舊版備份文件夾</string>
<string name="enabled">已啓用</string>
<string name="disabled">已禁用</string>
<string name="enabled_explore">已啟用發現</string>
<string name="disabled_explore">已禁用發現</string>
<string name="text_bottom_justify">文字底部對齊</string>
<string name="starting_download">正在啟動下載</string>
<string name="already_in_download">該書已在下載列表</string>

View File

@ -731,6 +731,8 @@
<string name="import_old_summary">選擇舊版備份資料夾</string>
<string name="enabled">已啟用</string>
<string name="disabled">已禁用</string>
<string name="enabled_explore">已啟用發現</string>
<string name="disabled_explore">已禁用發現</string>
<string name="starting_download">正在啟動下載</string>
<string name="already_in_download">該書已在下載列表</string>
<string name="click_to_open">點擊打開</string>

View File

@ -732,6 +732,8 @@
<string name="import_old_summary">选择旧版备份文件夹</string>
<string name="enabled">已启用</string>
<string name="disabled">已禁用</string>
<string name="enabled_explore">已启用发现</string>
<string name="disabled_explore">已禁用发现</string>
<string name="starting_download">正在启动下载</string>
<string name="already_in_download">该书已在下载列表</string>
<string name="click_to_open">点击打开</string>

View File

@ -734,6 +734,8 @@
<string name="import_old_summary">Select a legacy backup folder</string>
<string name="enabled">Enabled</string>
<string name="disabled">Disabled</string>
<string name="enabled_explore">Discovery Enabled</string>
<string name="disabled_explore">Discovery Disabled</string>
<string name="starting_download">Starting download</string>
<string name="already_in_download">This book is already in Download list</string>
<string name="click_to_open">Click to open</string>