From 3fcd95407055797c965d632aa90a3cc50de097a7 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 15 Sep 2021 13:36:15 +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 --- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 7 +++---- .../legado/app/ui/book/read/config/TocRegexDialog.kt | 11 ----------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 9e8ce52b5..39b8ae10c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -278,10 +278,9 @@ class ReadBookActivity : ReadBookBaseActivity(), putExtra("author", it.author) } } - R.id.menu_toc_regex -> TocRegexDialog.show( - supportFragmentManager, - ReadBook.book?.tocUrl - ) + R.id.menu_toc_regex -> supportFragmentManager.showDialog { + putString("tocRegex", ReadBook.book?.tocUrl) + } R.id.menu_reverse_content -> ReadBook.book?.let { viewModel.reverseContent(it) } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt index ae8167cc6..e4ed1547a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt @@ -8,7 +8,6 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.Toolbar -import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView @@ -262,16 +261,6 @@ class TocRegexDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener { } } - companion object { - fun show(fragmentManager: FragmentManager, tocRegex: String? = null) { - val dialog = TocRegexDialog() - val bundle = Bundle() - bundle.putString("tocRegex", tocRegex) - dialog.arguments = bundle - dialog.show(fragmentManager, "tocRegexDialog") - } - } - interface CallBack { fun onTocRegexDialogResult(tocRegex: String) {} }