From 3f769950c5ae4e58ae179025a0bb1d40338b2122 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 3 Oct 2020 21:23:25 +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 --- .../legado/app/service/CheckSourceService.kt | 6 +----- .../book/source/manage/BookSourceActivity.kt | 20 +++++++++---------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/CheckSourceService.kt b/app/src/main/java/io/legado/app/service/CheckSourceService.kt index 705ff19c9..3dde78066 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -78,11 +78,7 @@ class CheckSourceService : BaseService() { allIds.addAll(ids) processIndex = 0 threadCount = min(allIds.size, threadCount) - if (backgroundVerification) { - updateNotification(0, getString(R.string.progress_show, "", 0, allIds.size)) - } else { - postEvent(EventBus.CHECK_INIT, allIds.size) - } + updateNotification(0, getString(R.string.progress_show, "", 0, allIds.size)) for (i in 0 until threadCount) { check() } diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index c461797dd..0dcfb2aa8 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -23,6 +23,7 @@ import io.legado.app.base.VMBaseActivity import io.legado.app.constant.AppPattern import io.legado.app.constant.EventBus import io.legado.app.data.entities.BookSource +import io.legado.app.help.AppConfig import io.legado.app.help.IntentDataHelp import io.legado.app.lib.dialogs.* import io.legado.app.lib.theme.ATH @@ -40,10 +41,8 @@ import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.ui.widget.text.AutoCompleteTextView import io.legado.app.utils.* import kotlinx.android.synthetic.main.activity_book_source.* -import kotlinx.android.synthetic.main.activity_book_source.recycler_view import kotlinx.android.synthetic.main.dialog_edit_text.view.* import kotlinx.android.synthetic.main.dialog_progressbar_view.* -import kotlinx.android.synthetic.main.dialog_progressbar_view.tv_footer_left import kotlinx.android.synthetic.main.view_search.* import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.startActivity @@ -300,7 +299,15 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity CheckSource.keyword = it } } - CheckSource.start(this@BookSourceActivity, adapter.getSelection()) + if (AppConfig.backgroundVerification) { + CheckSource.start(this@BookSourceActivity, adapter.getSelection()) + } else { + val bundle = Bundle() + bundle.putInt("maxProgress", adapter.getSelection().size) + CheckSourceDialog().apply { + arguments = bundle + }.show(supportFragmentManager, "CheckDialog") + } } noButton { } }.show().applyTint() @@ -390,13 +397,6 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity } override fun observeLiveBus() { - observeEvent(EventBus.CHECK_INIT) { max-> - val bundle = Bundle() - bundle.putInt("maxProgress", max) - CheckSourceDialog().apply { - arguments = bundle - }.show(supportFragmentManager, "CheckDialog") - } observeEvent(EventBus.CHECK_DONE) { groups.map { group-> if (group.contains("失效")) {