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) {} }