|
|
|
@ -2,6 +2,7 @@ package io.legado.app.ui.dict |
|
|
|
|
|
|
|
|
|
import android.os.Bundle |
|
|
|
|
import android.text.Html |
|
|
|
|
import android.text.method.LinkMovementMethod |
|
|
|
|
import android.view.LayoutInflater |
|
|
|
|
import android.view.View |
|
|
|
|
import android.view.ViewGroup |
|
|
|
@ -10,6 +11,7 @@ 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.toastOnUi |
|
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
|
|
|
|
|
@ -48,6 +50,7 @@ class DictDialog : BaseDialogFragment() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
|
binding.tvDict.movementMethod = LinkMovementMethod() |
|
|
|
|
val word = arguments?.getString("word") |
|
|
|
|
if (word.isNullOrEmpty()) { |
|
|
|
|
toastOnUi(R.string.cannot_empty) |
|
|
|
@ -55,6 +58,7 @@ class DictDialog : BaseDialogFragment() { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
viewModel.dictHtmlData.observe(viewLifecycleOwner) { |
|
|
|
|
binding.rotateLoading.invisible() |
|
|
|
|
binding.tvDict.text = Html.fromHtml(it) |
|
|
|
|
} |
|
|
|
|
viewModel.dict(word) |
|
|
|
|