From b2ce0f070d4d68a5760c586ef8332cef836e8b89 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 15 Sep 2021 15:45:10 +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 | 2 +- .../main/java/io/legado/app/ui/dict/DictDialog.kt | 14 ++++---------- 2 files changed, 5 insertions(+), 11 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 82b157b12..94bb74507 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 @@ -539,7 +539,7 @@ class ReadBookActivity : ReadBookBaseActivity(), return true } R.id.menu_dict -> { - DictDialog.show(supportFragmentManager, selectedText) + supportFragmentManager.showDialog(DictDialog(selectedText)) return true } } diff --git a/app/src/main/java/io/legado/app/ui/dict/DictDialog.kt b/app/src/main/java/io/legado/app/ui/dict/DictDialog.kt index 8d3019dbe..1e64176b9 100644 --- a/app/src/main/java/io/legado/app/ui/dict/DictDialog.kt +++ b/app/src/main/java/io/legado/app/ui/dict/DictDialog.kt @@ -7,29 +7,23 @@ import android.text.method.LinkMovementMethod import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels import io.legado.app.R import io.legado.app.base.BaseDialogFragment import io.legado.app.databinding.DialogDictBinding import io.legado.app.utils.invisible -import io.legado.app.utils.showDialog import io.legado.app.utils.toastOnUi import io.legado.app.utils.viewbindingdelegate.viewBinding /** * 词典 */ -class DictDialog : BaseDialogFragment() { +class DictDialog() : BaseDialogFragment() { - companion object { - - fun show(manager: FragmentManager, word: String) { - manager.showDialog { - putString("word", word) - } + constructor(word: String) : this() { + arguments = Bundle().apply { + putString("word", word) } - } private val viewModel by viewModels()