pull/1319/head
gedoor 3 years ago
parent eac2e52150
commit b2ce0f070d
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 14
      app/src/main/java/io/legado/app/ui/dict/DictDialog.kt

@ -539,7 +539,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
return true return true
} }
R.id.menu_dict -> { R.id.menu_dict -> {
DictDialog.show(supportFragmentManager, selectedText) supportFragmentManager.showDialog(DictDialog(selectedText))
return true return true
} }
} }

@ -7,29 +7,23 @@ import android.text.method.LinkMovementMethod
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogDictBinding import io.legado.app.databinding.DialogDictBinding
import io.legado.app.utils.invisible import io.legado.app.utils.invisible
import io.legado.app.utils.showDialog
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
/** /**
* 词典 * 词典
*/ */
class DictDialog : BaseDialogFragment() { class DictDialog() : BaseDialogFragment() {
companion object { constructor(word: String) : this() {
arguments = Bundle().apply {
fun show(manager: FragmentManager, word: String) { putString("word", word)
manager.showDialog<DictDialog> {
putString("word", word)
}
} }
} }
private val viewModel by viewModels<DictViewModel>() private val viewModel by viewModels<DictViewModel>()

Loading…
Cancel
Save