diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt index 548d9a481..af44e0c32 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt @@ -154,14 +154,15 @@ class ReplaceRuleActivity : VMBaseActivity { App.db.replaceRuleDao.liveDataSearch("%$searchKey%") } + }.apply { + observe(this@ReplaceRuleActivity, { + if (dataInit) { + setResult(Activity.RESULT_OK) + } + adapter.setItems(it, adapter.diffItemCallBack) + dataInit = true + }) } - replaceRuleLiveData?.observe(this, { - if (dataInit) { - setResult(Activity.RESULT_OK) - } - adapter.setItems(it, adapter.diffItemCallBack) - dataInit = true - }) } private fun observeGroupData() { @@ -239,7 +240,7 @@ class ReplaceRuleActivity : VMBaseActivity