From 3538db3fe599d3cad54562ec517e9ecebf99b8e0 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 29 Oct 2021 10:56:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/changesource/ChangeSourceViewModel.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt index 5771fde07..9249edc92 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt @@ -116,7 +116,12 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio if (searchGroup.isBlank()) { bookSourceList.addAll(appDb.bookSourceDao.allEnabled) } else { - bookSourceList.addAll(appDb.bookSourceDao.getEnabledByGroup(searchGroup)) + val sources = appDb.bookSourceDao.getEnabledByGroup(searchGroup) + if (sources.isEmpty()) { + bookSourceList.addAll(appDb.bookSourceDao.allEnabled) + } else { + bookSourceList.addAll(sources) + } } searchStateData.postValue(true) initSearchPool()