pull/1110/head
gedoor 3 years ago
parent 19027427cc
commit 762d63d4b7
  1. 4
      app/src/main/java/io/legado/app/ui/dict/DictDialog.kt
  2. 10
      app/src/main/res/layout/dialog_dict.xml

@ -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)

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
@ -9,4 +9,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<io.legado.app.ui.widget.anima.RotateLoading
android:id="@+id/rotate_loading"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center" />
</FrameLayout>
Loading…
Cancel
Save