From 18716db3fd7e4164e841aea0bd7ec97fc1a399e7 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 29 Jan 2021 22:12:31 +0800 Subject: [PATCH] edit ReplaceRuleActivity.kt --- .../io/legado/app/ui/replace/ReplaceRuleActivity.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 af44e0c32..d3965882e 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 @@ -29,6 +29,7 @@ import io.legado.app.service.help.ReadBook import io.legado.app.ui.association.ImportReplaceRuleActivity import io.legado.app.ui.filepicker.FilePicker import io.legado.app.ui.filepicker.FilePickerDialog +import io.legado.app.ui.qrcode.QrCodeActivity import io.legado.app.ui.replace.edit.ReplaceEditActivity import io.legado.app.ui.widget.SelectActionBar import io.legado.app.ui.widget.recycler.DragSelectTouchHelper @@ -36,6 +37,7 @@ import io.legado.app.ui.widget.recycler.ItemTouchCallback import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.utils.* import org.jetbrains.anko.startActivity +import org.jetbrains.anko.startActivityForResult import org.jetbrains.anko.toast import java.io.File @@ -52,7 +54,8 @@ class ReplaceRuleActivity : VMBaseActivity() @@ -186,6 +189,7 @@ class ReplaceRuleActivity : VMBaseActivity showImportDialog() R.id.menu_import_source_local -> FilePicker .selectFile(this, importRequestCode, allowExtensions = arrayOf("txt", "json")) + R.id.menu_import_source_qr -> startActivityForResult(importRequestCodeQr) else -> if (item.groupId == R.id.replace_group) { searchView.setQuery("group:${item.title}", true) } @@ -263,6 +267,11 @@ class ReplaceRuleActivity : VMBaseActivity if (resultCode == Activity.RESULT_OK) { + data?.getStringExtra("result")?.let { + startActivity("source" to it) + } + } exportRequestCode -> if (resultCode == RESULT_OK) { data?.data?.let { uri -> if (uri.isContentScheme()) {